cp: Fix panic when recursively copying a directory with a non-UTF8 name#11148
cp: Fix panic when recursively copying a directory with a non-UTF8 name#11148sylvestre merged 2 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
Merging this PR will improve performance by 6.49%
Performance Changes
Comparing Footnotes
|
| Some(root_path) | ||
| }; | ||
| let root_parent = | ||
| if target.exists() && !root.as_os_str().as_encoded_bytes().ends_with(b"/.") { |
There was a problem hiding this comment.
| if target.exists() && !root.as_os_str().as_encoded_bytes().ends_with(b"/.") { | |
| if target.exists() && !root.ends_with("/.") { |
I don't know whether this suggestion works, but converting to bytes might not be correct. Maybe the os_str_bytes crate would be helpful.
There was a problem hiding this comment.
Since we are querying for a two byte sequence at the end of it, what do you foresee could be the problem? Encoding issues should be out of the question at this point
There was a problem hiding this comment.
It could be more complicated than that, maybe some platform uses multi-byte encoding?
There was a problem hiding this comment.
Well, that suggestion compiled but didn't pass tests.
Missing test identified here: uutils/coreutils#11148 * tests/cp/non-utf8-name.sh: Add a new test to cover this case
|
@oech3 why is shuf_input_range[1000000] so noisy? |
|
I don't know. But I think the test is not using frozen seed at least for. |
Missing test identified here: uutils/coreutils#11148 * tests/cp/non-utf8-name.sh: Add a new test to cover this case. #207
Comparative output from GNU cp and uu cp prior to the fix: