Repository navigation
rm: overriding the libc call when implementation does not match gnu coreutils exactly - #9604
ChrisDryden wants to merge 7 commits into
Conversation
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
|
sorry, it needs to be rebased |
0e464e9 to
9466d55
Compare
|
GNU testsuite comparison: |
| @@ -5,6 +5,7 @@ | |||
| # spell-checker:ignore (paths) abmon deref discrim eacces getlimits getopt ginstall inacc infloop inotify reflink ; (misc) INT_OFLOW OFLOW | |||
| # spell-checker:ignore baddecode submodules xstrtol distros ; (vars/env) SRCDIR vdir rcexp xpart dired OSTYPE ; (utils) greadlink gsed multihardlink texinfo CARGOFLAGS | |||
| # spell-checker:ignore openat TOCTOU CFLAGS tmpfs gnproc | |||
| # spell-checker:ignore hfsplus casefold chattr dirp memcpy | |||
|
need to be rebased |
9466d55 to
5ae2096
Compare
| # * the selinux crate is handling errors | ||
| # * the test says "maybe we should not fail when no context available" | ||
| sed -i -e "s|returns_ 1||g" tests/cp/no-ctx.sh | ||
| "${SED}" -i -e "s|returns_ 1||g" tests/cp/no-ctx.sh |
Merging this PR will improve performance by 12.07%
Performance Changes
Tip Curious why this is faster? Comment Comparing Footnotes
|
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
This comment was marked as resolved.
This comment was marked as resolved.
|
sorry but it needs to be rebased |
| }; | ||
|
|
||
| // Check if readdir failed partway through (partial read) | ||
| if let Some(err) = take_errno() { |
There was a problem hiding this comment.
this is probably what makes clippy fail (collapsible_if), please use if let ... && ...
| }; | ||
|
|
||
| // Check if readdir failed partway through (partial read) | ||
| if let Some(err) = take_errno() { |
There was a problem hiding this comment.
please add a test in tests/by-util/test_rm.rs too
| } | ||
|
|
||
| /// Clear errno and return any error that was set after an operation | ||
| /// This is used because the nix library does not propagate folder reading errors correctly |
There was a problem hiding this comment.
is that true? dir.iter() already yields Err and we propagate it with ? just below
|
|
||
| /// Clear errno and return any error that was set after an operation | ||
| /// This is used because the nix library does not propagate folder reading errors correctly | ||
| pub fn take_errno() -> Option<io::Error> { |
There was a problem hiding this comment.
relying on errno after a successful call is fragile: dup/closedir/malloc can leave it set even when read_dir succeeded.
could read_dir_entries return the partial entries + the error instead?
| "${SED}" -i -e "s|returns_ 1||g" tests/cp/no-ctx.sh | ||
|
|
||
| # uutils rm uses nix which calls readdir64_r, so add a wrapper that delegates to the readdir hook | ||
| "${SED}" -i '/^struct dirent \*readdir/i\ |
There was a problem hiding this comment.
injecting C into the GNU test with sed is hard to maintain, could this be a quilt patch in util/gnu-patches/ instead?
There was a problem hiding this comment.
It seems readdir64_r is unrecommended syscall. We should ask nix to stop using that instead of patching the test.
There was a problem hiding this comment.
But backend syscall might be changed after this PR was submitted since this PR is old.
We need to re-investigate reason for failure of tests/rm/rm-readdir-fail now.
|
This PR can be closed as dd39af2 was merged. |
|
sorry but it needs to be rebased |
This was originally intended to be a demonstration for how we could modify the integration tests to recognize the libc calls we were using.
I discovered that I could wrap the implementation in this helper method to be able to address this tests in a relatively readable way compared to modifying the original code.
As it stands I believe there are three skipped tests in total right now that are skipped for this reason