fix(realpath): To error out in long paths#13223
Conversation
| if path_str.ends_with("/.") || path_str.ends_with("/./") { | ||
| abs.metadata()?; // raise no such file or directory error | ||
| for component in p.components() { | ||
| if let Some(name) = component.as_os_str().to_str() { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
@sylvestre review that |
This comment was marked as resolved.
This comment was marked as resolved.
I would appreciate a more polite message |
|
oh sorry, yes you are right, we need talk in a polite manner, since we are humans |
|
also, please ping me only when the testsuite is green and there are tests |
Merging this PR will not alter performance
Comparing Footnotes
|
Added tests to check behavior with long path components.
|
GNU testsuite comparison: |
|
Hi, @sylvestre now all tests passed and added tests and fix working, can you merge? i appreciate it or still |
| const OPT_RELATIVE_TO: &str = "relative-to"; | ||
| const OPT_RELATIVE_BASE: &str = "relative-base"; | ||
|
|
||
| const MAX_PATH: usize = 255; |
|
after i restore the tests, they failing that was weird, i just added the max limit then failed, i will see why |
|
the openbsd test failing because error: extern location for proc_macro2 does not exist: /home/runner/work/coreutils/coreutils/target/debug/deps/libproc_macro2-24e159babf15897f.rlib
--> /home/tester/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/yoke-derive-0.8.2/src/lifetimes.rs:5:5
|
5 | use proc_macro2::Span;
| ^^^^^^^^^^^
error[E0463]: can't find crate for `syn`
--> /home/tester/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/yoke-derive-0.8.2/src/lifetimes.rs:6:5
|
6 | use syn::ext::IdentExt as _;
| ^^^ can't find crate
error: extern location for quote does not exist: /home/runner/work/coreutils/coreutils/target/debug/deps/libquote-c6c049b8eedf5bdc.rlib
--> /home/tester/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/yoke-derive-0.8.2/src/lib.rs:25:5
|
25 | use quote::quote;
| ^^^^^
error[E0463]: can't find crate for `synstructure`
--> /home/tester/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/yoke-derive-0.8.2/src/lib.rs:29:5
|
29 | use synstructure::Structure;
| ^^^^^^^^^^^^ can't find crateabout soomething different not about realpath at all, it causing issues |
|
the 1 failing last job, is about install unrelated fully to the pr, realpath is the thing we fixed, not install that just some problems occurs with CI/CD sometimes, ci/cd race issues sometime tests successed, however the important tests passed and only 1 job failing that happen in tons of prs. but however only 1 failing not a huge problem |
|
Hi, @sylvestre i appreciate it, when you have time, can you please review it again all tests passes, the 1 failing is unrelated to the pr and restored previous tests and ignored rsplit to cspell not fails and now passed, can you review and merge? |
| .to_str() | ||
| .is_some_and(|name| name.len() > MAX_PATH) | ||
| }) { | ||
| return Err(Error::new(ErrorKind::InvalidInput, "File name too long")); |
There was a problem hiding this comment.
please use the translate! macro here
|
@cakebaker what about that one? can you review it, i appreciate it |
|
hi, @sylvestre review now. i added translate! no breaking change, or logic change, so what do you think, i appreciate it, when having time |
| abs.metadata()?; // raise no such file or directory error | ||
| let p_str = p.to_string_lossy(); | ||
| let has_trailing_dot = | ||
| p_str.ends_with("/.") || p_str.ends_with("/..") || p_str == "." || p_str == ".."; |
There was a problem hiding this comment.
we don't have a function already doing that in the code base ?
There was a problem hiding this comment.
however it needed, if i not did that, because after that pr, existing tests will fail by doing that will pass successfully and no new bugs introduced, the important thing is to me the function not contain a bug or have a logic flaw everything working as expected, only the translate! improper usage comment, i will fix soon, since that weekend i'm busy, after i have time i will do
|
The openbsd test, is failing a lot unrelatedly error: could not write output to /home/runner/work/coreutils/coreutils/target/debug/deps/aho_corasick-1847ae58157834dc.aho_corasick.3da009c13909ed9d-cgu.09.rcgu.o: No such file or directory
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-Wl,--version-script=/home/runner/work/coreutils/coreutils/target/debug/deps/rustcbbBZv3/list" "-Wl,--no-undefined-version" "-m64" "/home/runner/work/coreutils/coreutils/target/debug/deps/rustcbbBZv3/symbols.o" "<8 object files omitted>" "/home/runner/work/coreutils/coreutils/target/debug/deps/rustcbbBZv3/rmeta.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/runner/work/coreutils/coreutils/target/debug/deps/{libsyn-e65d324f9e998147,libquote-c6c049b8eedf5bdc,libproc_macro2-24e159babf15897f,libunicode_ident-035ce896c11e69f2}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-openbsd/lib/{libproc_macro-*,librustc_literal_escaper-*,libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lpthread" "-lc++abi" "-lc" "-lm" "-lutil" "-lexecinfo" "-lcompiler_rt" "-L" "/home/runner/work/coreutils/coreutils/target/debug/deps/rustcbbBZv3/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-o" "/home/runner/work/coreutils/coreutils/target/debug/deps/libdisplaydoc-1116f8cfe1ebf763.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,--strip-all" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.displaydoc.f7d8756782537b52-cgu.1.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.displaydoc.f7d8756782537b52-cgu.2.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.displaydoc.f7d8756782537b52-cgu.3.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.displaydoc.f7d8756782537b52-cgu.4.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.displaydoc.f7d8756782537b52-cgu.5.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.displaydoc.f7d8756782537b52-cgu.6.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.displaydoc.f7d8756782537b52-cgu.7.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/rustcbbBZv3/rmeta.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/displaydoc-1116f8cfe1ebf763.cd3jpn7m61t2yh1sbinfagr0p.rcgu.o'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/libsyn-e65d324f9e998147.rlib'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/libquote-c6c049b8eedf5bdc.rlib'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/libproc_macro2-24e159babf15897f.rlib'
cc: error: no such file or directory: '/home/runner/work/coreutils/coreutils/target/debug/deps/libunicode_ident-035ce896c11e69f2.rlib'
error: could not write output to /home/runner/work/coreutils/coreutils/target/debug/deps/zerofrom_derive-f10ef66f071675d7.zerofrom_derive.ef485bc99bb94f41-cgu.02.rcgu.o: No such file or directory
error: could not compile `displaydoc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `zerofrom-derive` (lib) due to 1 previous error
error: could not compile `aho-corasick` (lib) due to 1 previous error
error: failed to write `/home/runner/work/coreutils/coreutils/target/debug/.fingerprint/codspeed-8cb221c4cda03ebc/run-build-script-build-script-build`
Caused by:
No such file or directory (os error 2)
Removed 12418 files, 2.3GiB totalit is about unrelated errors, weird |
|
also https://github.com/uutils/coreutils/actions/runs/29636378118/job/88059369743?pr=13223, failing unrelatedly |
Fixes #13154
Fixes #13224