Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Wrong biome build used for musl guest devcontainer on arm64 host #223

Closed
1 of 3 tasks
Mardoxx opened this issue May 25, 2024 · 5 comments · Fixed by #224
Closed
1 of 3 tasks

🐛 Wrong biome build used for musl guest devcontainer on arm64 host #223

Mardoxx opened this issue May 25, 2024 · 5 comments · Fixed by #224
Assignees
Labels
Bug confirmed Report has been confirmed as a valid bug

Comments

@Mardoxx
Copy link

Mardoxx commented May 25, 2024

VS Code version

1.89.1

Extension version

2.2.2

Biome version

1.7.3

Operating system

  • Windows
  • macOS
  • Linux

Description

When using a musl based linux dev container on a MacOS host (arm64) the wrong biome binary is used.

Steps to reproduce

Init a new project and install biome., then set up dev container.

.devcontainer/devcontainer.json

{
  "name": "devcontainer",
  "build": {
    "dockerfile": "Dockerfile"
  },
  "postCreateCommand": "yarn install",
  "customizations": {
    "vscode": {
      "extensions": [
        "biomejs.biome"
      ]
    }
  }
}

.devcontainer/Dockerfile

FROM alpine:latest

RUN apk update && \
    apk add --no-cache git yarn

Biome finds cli-linux-arm64

Expected behavior

Biome should find cli-linux-arm64-musl

"biome.lspBin": "./node_modules/@biomejs/cli-linux-arm64-musl/biome" makes it work

Does this issue occur when using the CLI directly?

No

Logs

Biome binary found at /workspaces/demo/node_modules/@biomejs/cli-linux-arm64/biome
Copying binary to temporary folder: file:///root/.vscode-server/data/XXXXX/workspaceStorage/XXXXX/biomejs.biome/biome
Executing Biome from: /root/.vscode-server/data/XXXXX/workspaceStorage/XXXXX/biomejs.biome/biome
[Error - 5:27:47 PM] Biome client: couldn't create connection to server.
Error: spawn /root/.vscode-server/data/XXXXX/workspaceStorage/XXXXX/biomejs.biome/biome ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:284:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[cli-stdout] end
[cli-stdout] finish
[cli-stderr] end
[cli-stderr] finish
[cli-stderr] close
[cli] close -2
[cli-stdout] close
@Mardoxx Mardoxx added the Triage label May 25, 2024
@Mardoxx
Copy link
Author

Mardoxx commented May 25, 2024

When installing biome in the guest, it also installs cli-linux-arm64 although correctly detecting musl base.

info Direct dependencies
└─ @biomejs/biome@1.7.3
info All dependencies
├─ @biomejs/biome@1.7.3
├─ @biomejs/cli-linux-arm64-musl@1.7.3
└─ @biomejs/cli-linux-arm64@1.7.3

@Mardoxx
Copy link
Author

Mardoxx commented May 25, 2024

Maybe these need tweaking:

biome-vscode/src/main.ts

Lines 465 to 469 in d9ca2b7

return pnpApi.resolveRequest(
`@biomejs/cli-${process.platform}-${process.arch}/biome${
process.platform === "win32" ? ".exe" : ""
}`,
pkgPath,

biome-vscode/src/main.ts

Lines 488 to 492 in d9ca2b7

const binaryPackage = dirname(
requireFromBiome.resolve(
`@biomejs/cli-${process.platform}-${process.arch}/package.json`,
),
);

process.arch won't return c library I don't think, so perhaps need something similar to what you have here

https://github.com/biomejs/biome/blob/b3da3ae293defe9e3f6f9c1a7f52fbf6450b40c0/packages/%40biomejs/biome/bin/biome#L5-L18

Maybe this

const { execSync } = require('child_process');

function isMusl() {
  try {
    const output = execSync('ldd --version 2>&1', { encoding: 'utf-8' });
    return output.includes('musl');
  } catch (error) {
    return false;
  }
}

@nhedger
Copy link
Member

nhedger commented May 25, 2024

Thanks, I'll take a look.

@nhedger nhedger added Bug confirmed Report has been confirmed as a valid bug and removed Triage labels May 25, 2024
@nhedger nhedger self-assigned this May 25, 2024
@nhedger nhedger mentioned this issue May 25, 2024
4 tasks
@nhedger
Copy link
Member

nhedger commented May 25, 2024

Should be fixed in v2.2.3

@Mardoxx
Copy link
Author

Mardoxx commented May 26, 2024

Fantastic thanks, seems to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug confirmed Report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants