cp: set status code when encountering circular symbolic links#9757
cp: set status code when encountering circular symbolic links#9757Ecordonnier merged 24 commits intouutils:mainfrom
Conversation
…n copying directory
… circular symbolic links during directory copy
tests/by-util/test_cp.rs
Outdated
| ucmd.arg(source_dir) | ||
| .arg(target_dir) | ||
| .arg("-rL") | ||
| .fails_with_code(1); |
There was a problem hiding this comment.
please also verify the output
There was a problem hiding this comment.
I updated the test to check for the output. I did not check for an exact match of the stderr since I think they might differ slightly depending on the OS and "Too many levels of symbolic links" should be a good enough indicator that the command is outputting what we expect I think.
There was a problem hiding this comment.
I don't want to make the test to complex and test for the full output for the different OSes so I updated the test to simply check for the string from walkdir.
There was a problem hiding this comment.
I updated the tests again to include windows-specific syntax for the error message
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Fixed the merge conflicts. |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Fixed the formatting issue. |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Fixed the conflicts with the tests |
|
GNU testsuite comparison: |
…#9757) * cp: set exit code when encountering circular symbolic links error when copying directory * cp: add test to ensure that cp sets the status code when encountering circular symbolic links during directory copy * cp: check that the output of circular symbolic link test has the correct message * cp: update check for stderr message * cp: update circular symbolic link test to account for directory format in windows * cp: use std::path::MAIN_SEPARATOR_STR for test
Fixes #9710
Change from using the
show_error!macro to theshow!macro which correctly sets the status code.Added a new test to validate this behavior.