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

Document possible values of --target-os and --target-arch #1161

Open
aleksanderkrauze opened this issue Mar 29, 2024 · 1 comment
Open

Document possible values of --target-os and --target-arch #1161

aleksanderkrauze opened this issue Mar 29, 2024 · 1 comment

Comments

@aleksanderkrauze
Copy link
Contributor

Possible values for CLI arguments --target-os and --target-arch are undocumented. Currently when you run cargo audit --help you only get this information:

Options:
      --target-arch <TARGET_ARCH>  filter vulnerabilities by CPU (default: no filter)
      --target-os <TARGET_OS>      filter vulnerabilities by OS (default: no filter)

and audit.toml.example has this information:

# Target Configuration
[target]
arch = "x86_64" # Ignore advisories for CPU architectures other than this one
os = "linux" # Ignore advisories for operating systems other than this one

But nowhere are listed all possible options. To get this list, I had to dig through source code to find crate platforms and there find enums Arch and OS.

Also documentation of module platforms::target is unhelpful, because it states:

Target cfg attributes. Documented in the “Conditional compilation” section of the Rust reference:

https://doc.rust-lang.org/reference/attributes.html#conditional-compilation

And linked page on conditional compilation in The Rust Reference provides only "example" target os and arch values.

Please consider either adding ability to list supported os and arch targes, or provide a link to exhaustive list of them.

@Shnatsel
Copy link
Member

Shnatsel commented Apr 9, 2024

I agree the list needs to be documented better for cargo audit.


As far as the platforms crate is concerned:

The documentation frontpage states the source for this info, but that's not the whole story because we combine the documentation page with the data from the latest nightly rustc, namely rustc --print=cfg --target x86_64-unknown-linux-gnu to get the conditional compilation values. That is where the Arch, OS etc. enum values come from.

platforms crate exists to make this info available even when there is no Rust compiler installed.

The list evolves over time, and targets are added and removed as they are added and removed from the compiler itself. Therefore I don't think simply documenting an exhaustive list will be feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants