-
Notifications
You must be signed in to change notification settings - Fork 13.6k
strip prefix of temporary file names when it exceeds filesystem name length limit #145005
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This method is also used for generating output files in various places. Mangling the name of output files would break cargo and other build tools that pre-generate the expected filenames based on |
@bjorn3 would it be more appropriate to put the filename stripping in temp_path_ext_for_cgu ? those files if I understand correctly are temporary and unlinked after the rustc invocation. |
4d6eb1e
to
3239eeb
Compare
r? bjorn3 feel free to reassign |
filename[..stripped_len].hash(&mut hasher); | ||
let hash = hasher.finish::<Hash64>(); | ||
|
||
path.set_file_name(format!("{:x}-{}", hash, &filename[stripped_len..])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The start of the filename has more useful information, but we do absolutely need to preserve file extensions (plural: eg .rcgu.o
) for correctness and it isn't trivial to distinguish between file extensions and normal dot separated filename components. So I guess the current implementation is good enough.
...-large-large-large-large-large-large-large-large-large-large-large-large-large-crate-name.rs
Outdated
Show resolved
Hide resolved
3239eeb
to
7d98d96
Compare
4e616be
to
63fd877
Compare
This comment has been minimized.
This comment has been minimized.
…length limit When doing lto, rustc generates filenames that are concatenating many information. In the case of this testcase, it is concatenating crate name and rust file name, plus some hash, and the extension. In some other cases it will concatenate even more information reducing the maximum effective crate name to about 110 chars on linux filesystems where filename max length is 255 This commit is ensuring that the temporary file names are limited in size, while still reasonabily ensuring the unicity (with hashing of the stripped part)
63fd877
to
bc14ad3
Compare
@bors r+ |
strip prefix of temporary file names when it exceeds filesystem name length limit When doing lto, rustc generates filenames that are concatenating many information. In the case of this testcase, it is concatenating crate name and rust file name, plus some hash, and the extension. In some other cases it will concatenate even more information reducing the maximum effective crate name to about 110 chars on linux filesystems where filename max length is 255 This commit is ensuring that the temporary file names are limited in size, while still reasonably ensuring the unicity (with hashing of the stripped part) Fix: rust-lang#49914
Rollup of 13 pull requests Successful merges: - #122661 (Change the desugaring of `assert!` for better error output) - #142372 (Improve `--remap-path-prefix` documentation) - #143075 (compiler: Allow `extern "interrupt" fn() -> !`) - #145005 (strip prefix of temporary file names when it exceeds filesystem name length limit) - #145065 (resolve: Introduce `RibKind::Block`) - #145120 (llvm: Accept new LLVM lifetime format) - #145189 (Weekly `cargo update`) - #145261 (Improve tracing in bootstrap) - #145266 (Reduce some queries around associated items) - #145299 (doc test: fix mpsc.rs try_send doc test) - #145331 (Make std use the edition 2024 prelude) - #145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools) - #145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved) Failed merges: - #145324 (Rename and document `ONLY_HOSTS` in bootstrap) - #145372 (resolve: Miscellaneous cleanups) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 13 pull requests Successful merges: - #122661 (Change the desugaring of `assert!` for better error output) - #142372 (Improve `--remap-path-prefix` documentation) - #143075 (compiler: Allow `extern "interrupt" fn() -> !`) - #145005 (strip prefix of temporary file names when it exceeds filesystem name length limit) - #145065 (resolve: Introduce `RibKind::Block`) - #145120 (llvm: Accept new LLVM lifetime format) - #145189 (Weekly `cargo update`) - #145261 (Improve tracing in bootstrap) - #145266 (Reduce some queries around associated items) - #145299 (doc test: fix mpsc.rs try_send doc test) - #145331 (Make std use the edition 2024 prelude) - #145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools) - #145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved) Failed merges: - #145324 (Rename and document `ONLY_HOSTS` in bootstrap) - #145372 (resolve: Miscellaneous cleanups) r? `@ghost` `@rustbot` modify labels: rollup
When doing lto, rustc generates filenames that are concatenating many information.
In the case of this testcase, it is concatenating crate name and rust file name, plus some hash, and the extension. In some other cases it will concatenate even more information reducing the maximum effective crate name to about 110 chars on linux filesystems where filename max length is 255
This commit is ensuring that the temporary file names are limited in size, while still reasonably ensuring the unicity (with hashing of the stripped part)
Fix: #49914