Skip to content
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

cp: Avoid following a destination symlink with -P #3101

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

refi64
Copy link
Contributor

@refi64 refi64 commented Feb 9, 2022

Previously, given 'cp -P a b', where 'a' and 'b' were both symlinks, cp
would end up replacing the target of 'b'.

Signed-off-by: Ryan Gonzalez ryan.gonzalez@collabora.com

@refi64 refi64 force-pushed the cp-dest-symlink branch 2 times, most recently from b63a4af to c1c86cf Compare February 9, 2022 02:19
@refi64
Copy link
Contributor Author

refi64 commented Feb 9, 2022

I think the CI failure is unrelated? Though, in retrospect, maybe a more proper fix would just be to not canonicalize dest if !dereference...

@refi64
Copy link
Contributor Author

refi64 commented Feb 9, 2022

The CI feature is almost definitely unrelated:

---- test_ls::test_ls_long stdout ----
current_directory_resolved: 
touch: /tmp/.tmpFvQ7IK/test-long
run: /target/x86_64-unknown-linux-musl/debug/coreutils ls -l test-long
run: /target/x86_64-unknown-linux-musl/debug/coreutils ls --long test-long
run: /target/x86_64-unknown-linux-musl/debug/coreutils ls --l test-long
run: /target/x86_64-unknown-linux-musl/debug/coreutils ls --format=long test-long
thread 'test_ls::test_ls_long' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 9, kind: Uncategorized, message: "Bad file descriptor" }', library/std/src/process.rs:1862:21


failures:
    test_ls::test_ls_long

but I can't seem to be able to retry it...

Though, in retrospect, maybe a more proper fix would just be to not canonicalize dest if !dereference...

Some testing confirmed that this PR is actually the correct behavior: even if -P is passed to GNU coreutils, the destination is still followed.

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Feb 9, 2022

I thought I fixed that failure :(
I reran the CI for you!

@refi64
Copy link
Contributor Author

refi64 commented Feb 9, 2022

@tertsdiepraam it does look like the previously failing run is passing now!

@refi64
Copy link
Contributor Author

refi64 commented Feb 9, 2022

err, it looks like macOS just hung forever...

@sylvestre
Copy link
Contributor

sorry but we have now a conflict :(
could you please have a look? thanks

Previously, given 'cp -P a b', where 'a' and 'b' were both symlinks, cp
would end up replacing the target of 'b'.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
@refi64
Copy link
Contributor Author

refi64 commented Mar 14, 2022

@sylvestre conflict should be fixed now!

@sylvestre
Copy link
Contributor

Sweet Changes from main: PASS +1 / FAIL -1 / ERROR +0 / SKIP +0

@sylvestre sylvestre merged commit 42dd19c into uutils:main Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants