-
Notifications
You must be signed in to change notification settings - Fork 88
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_r loops #154
Comments
I can confirm this issue. Although it probably would be considered a corner case (as you can't do it using If you run
I'd like to hear your thoughts on whether you think this should actually copy (by building a list first) or rather fail similarly to |
The |
@andreasabel I can confirm that in my manpage doesnt list anything, but I can not confirm that copying is actually done. My #!/bin/sh
# Cleanup
rm -rf A
# Create test dir
mkdir -p A/B
echo "foo" > A/bar.txt
# Test copy
cp -r A A/B
# This should not error if copying is actually performed
cat A/B/A/bar.txt # <-- error
# NOTE: A/B/A is created
# Print version
cp --version What's your output? Note that Although I get your point to other Haskell packages, as Shellys function is not called Note that there are corner cases where listing the files is not feasible due to RAM usage (i.e. a huge number of files), although I'd say they are pretty rare in reality. You can find the relevant section in the source code here: Also, due to the comment, I'm pretty sure the current behaviour is actually intended by the coreutils authors. |
cp_r "A" "A/B"
loops, creating an infinitely deep directory structure.In contrast,
cp -r A A/B
on the shell will report an error.The problem with
cp_r
is that copied directories will be copied again. This can be solved by separating the procedure into two phases: making a list what has to be copied, and then copying.I just fixed the same problem in Agda, see: agda/agda@443e603 .
Here is the test program for
cp_r
I used to confirm the bug:The text was updated successfully, but these errors were encountered: