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

om health: False negative on rosetta check #240

Open
srid opened this issue May 30, 2024 · 2 comments
Open

om health: False negative on rosetta check #240

srid opened this issue May 30, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@srid
Copy link
Member

srid commented May 30, 2024

This user installed Nix the official way on M1 mac, but as x86_64 binary:

$ file /nix/var/nix/profiles/default/bin/nix
/nix/var/nix/profiles/default/bin/nix: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|PIE>

image image
@srid srid added the bug Something isn't working label May 30, 2024
@srid
Copy link
Member Author

srid commented May 30, 2024

We are detecting the wrong arch.

MacOS {
    nix_darwin: false,
    arch: Other(
        Some(
            "x86_64",
        ),
    ),
}

This suggests that os_info.architecture() is returning wrong value.

The crate is using uname -m: https://github.com/stanislav-tkach/os_info/blob/782e7564e62252f267a066adbb4bf4809d61fa77/os_info/src/architecture.rs#L6-L7

Which returns x86_64 on Rosetta terminal. However, the difference seems to lie in the architecture of the process that uses that crate. For native process, the result is correct; for Rosetta binary (of nix-health), the result is inaccurate.

@srid srid pinned this issue May 30, 2024
@srid
Copy link
Member Author

srid commented May 30, 2024

I'm able to reproduce this on a macOS VM running in Parallels

  1. Toggle Rosetta for builtin Terminal app
  2. Open rosetta terminal
  3. Install Nix using official instructions
  4. Nix binary should be x86_64, and running nix-health should fail to catch rosetta use:

image

@srid srid self-assigned this May 30, 2024
@srid srid transferred this issue from juspay/nix-health Aug 28, 2024
@srid srid changed the title False negative on rosetta check om health: False negative on rosetta check Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant