Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

ring's build script shouldn't output rerun-if-env-changed for Cargo-related env vars #10

@sunshowers

Description

@sunshowers

(Hi! I'm aware that ring is mostly in maintenance mode at the moment. Wanted to file this bug for visibility as well as to see if there's interest in addressing it.)

Currently, ring's build script outputs a number of rerun-if-env-changed instructions (full output):

cargo:rerun-if-env-changed=CARGO_MANIFEST_DIR
cargo:rerun-if-env-changed=CARGO_PKG_NAME
cargo:rerun-if-env-changed=CARGO_PKG_VERSION_MAJOR
cargo:rerun-if-env-changed=CARGO_PKG_VERSION_MINOR
cargo:rerun-if-env-changed=CARGO_PKG_VERSION_PATCH
cargo:rerun-if-env-changed=CARGO_PKG_VERSION_PRE
cargo:rerun-if-env-changed=CARGO_MANIFEST_LINKS
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rerun-if-env-changed=OUT_DIR
cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ARCH
cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ENV
cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ENDIAN
cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_CC
cargo:rerun-if-env-changed=CC
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
cargo:rerun-if-env-changed=CFLAGS
cargo:rerun-if-env-changed=HOST_CFLAGS
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_CC
cargo:rerun-if-env-changed=CC
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
cargo:rerun-if-env-changed=CFLAGS
cargo:rerun-if-env-changed=HOST_CFLAGS
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu

While many of these are appropriate, the ones prefixed by CARGO_ should probably not be output, I believe. Cargo's documentation says in this section:

Note that the environment variables here are intended for global environment variables like CC and such, it is not possible to use this for environment variables like TARGET that Cargo sets for build scripts. The environment variables in use are those received by cargo invocations, not those received by the executable of the build script.

I think an easy fix here is to ensure that no environment variables prefixed by CARGO_ are produced. That would correctly filter out the current list, and also likely be correct if and when the build script changes.

See also, oxidecomputer/omicron#7740.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions