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

Consider changing hashing behavior for executables. #8332

Open
ehuss opened this issue Jun 5, 2020 · 1 comment
Open

Consider changing hashing behavior for executables. #8332

ehuss opened this issue Jun 5, 2020 · 1 comment
Labels
A-rebuild-detection Area: rebuild detection and fingerprinting S-triage Status: This issue is waiting on initial triage.

Comments

@ehuss
Copy link
Contributor

ehuss commented Jun 5, 2020

Cargo has some inconsistent behavior on whether or not it embeds a hash in the filename for executables. #8329 just changed it for macOS, and @joshtriplett pointed out we might want to choose a more consistent behavior across all platforms. Details are elaborated in https://github.com/rust-lang/cargo/blame/de31a3498dcf1641eaa619988df96321c66d2f8b/src/cargo/core/compiler/context/compilation_files.rs#L601-L634. In general, executables on Windows and macOS do not have a hash, and other platforms do. This is primarily because of embedded paths to their external debug information.

One downside of not including the hash is that Cargo is unable to cache multiple copies of the same executable. This can happen with different features and different rustc versions.

Another thing to consider is the impact on reproducible builds, where the filename may get embedded in some scenarios (needs some investigation).

Here are a few options:

  1. Don't include the hash on any platform. Caching different copies of the same executable is probably a rare thing.
  2. Place the executables into a hashed directory (like deps/bin-foo-64db4e4bf99c12dd/foo). I can't remember, but that may still be a problem on Windows which embeds an absolute path to the pdb file.
  3. Leave as-is with the inconsistent behavior.

I'd probably lean towards 1, but I would like to get some experience with the new macOS behavior for at least a few months to see how annoying it might be.

There's also some discussions of supporting split-debuginfo on Linux (rust-lang/rust#34651). I have zero experience with that, but I'm curious if that would be impacted in a similar way.

@ehuss ehuss added the A-rebuild-detection Area: rebuild detection and fingerprinting label Jun 5, 2020
@lilydjwg
Copy link

lilydjwg commented Jun 24, 2020

I guess I'll have some crates to be frequently rebuild because I put the target directory at the same place for all projects (to reuse across projects as well as put cache separate from important data).

Linux users are somewhat unique because they have btrfs/zfs/lvm snapshots and rsync.

@epage epage added the S-triage Status: This issue is waiting on initial triage. label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rebuild-detection Area: rebuild detection and fingerprinting S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants