Skip to content

--crate-type=rlib + -Cdebuginfo=2 + -Zremap-cwd-prefix=. is not reproducible on Windows #129117

Open
@jieyouxu

Description

@jieyouxu

In #128456 (comment) we noticed that:

--crate-type=rlib + -C debuginfo=2 + -Z remap-cwd-prefix=. on Windows caused the rlib to be unreproducible.

# ignore-musl
# Objects are reproducible but their path is not.

Two source files:

  1. https://github.com/rust-lang/rust/blob/0ba9db87e61adcfd9a978188f61c20d9b423a099/tests/run-make/reproducible-build/reproducible-build-aux.rs
  2. https://github.com/rust-lang/rust/blob/0ba9db87e61adcfd9a978188f61c20d9b423a099/tests/run-make/reproducible-build/reproducible-build.rs

Steps:

  • Let "root" test directory be called $base_dir.
  • rustc reproducible-build-aux.rs
  • mkdir test
  • cp reproducible-build.rs test/reproducible-build.rs
  • compiler 1: rustc --crate-type=rlib -C debuginfo=2 -Zremap-cwd-prefix=. -L $cwd reproducible-build.rs
  • mv libreproducible_build.rlib libfoo.rlib
  • cd test
  • compiler 2: rustc --crate-type=rlib -C debuginfo=2 -Zremap-cwd-prefix=. -L $base_dir --out-dir=$base_dir reproducible-build.rs
  • cd $base_dir
  • check if libreproducible_build.rlib and libfoo.rlib are different

Marking as S-needs-repro as I'm not sure of the root cause or exact reproduction environment; the test case failed on x86_64-msvc ci job. I'm also not exactly sure of the intended semantics of -Z remap-cwd-prefix=..

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-reproducibilityArea: Reproducible / deterministic buildsA-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.O-windowsOperating system: WindowsS-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions