coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

cp: modify archive flag to copy dir contents rather than dir

Open dmatos2012 opened this issue 3 years ago • 4 comments

Hello, This PR fixes #3886 to handle copying source's directory contents rather than the directory itself.

Its my first ever Rust PR. Thanks for the helpful responses, and in case something else needs to be added, i can do so np.

Thanks:)

dmatos2012 avatar Sep 18 '22 18:09 dmatos2012

I guess you saw that it failed on some other archs:


---- test_cp::test_cp_archive_on_directory_ending_dot stdout ----
current_directory_resolved: 
mkdir: C:\Users\RUNNER~1\AppData\Local\Temp\.tmphZwpwf\dir1
mkdir: C:\Users\RUNNER~1\AppData\Local\Temp\.tmphZwpwf\dir2
touch: C:\Users\RUNNER~1\AppData\Local\Temp\.tmphZwpwf\dir1/file
run: D:\a\coreutils\coreutils\target\debug\coreutils.exe cp -a dir1/. dir2
thread 'test_cp::test_cp_archive_on_directory_ending_dot' panicked at 'Command was expected to succeed.
stdout = 
 stderr = cp: XAttrs are only supported on unix.
', tests\common\util.rs:176:9


failures:
    test_cp::test_cp_archive_on_directory_ending_dot

sylvestre avatar Sep 19 '22 17:09 sylvestre

Thanks for the quick feedback. I just noticed, however I also ran the same command cp -a dir1/. dir2(on windows) on the main branch and I get the same failure. Thus, I think this behavior was present from before, but it was exposed via the test. Unless by adding that test myself, I added a non-supported feature on Windows, but I am not clear whether that is related or not.

That being said, I dont have the knowledge so far to know how to make it work for windows(given the lack of Xattrs). So if maybe you can give me some pointers, I can perhaps read up on my own, and propose a fix on different PR(or this one as well)

Thanks again

dmatos2012 avatar Sep 19 '22 19:09 dmatos2012

maybe it could be a unix test only ?

sylvestre avatar Sep 19 '22 20:09 sylvestre

Yeah, nice solution. Done :)

dmatos2012 avatar Sep 19 '22 20:09 dmatos2012

Is there anything I shall do to get that final test passing? It looks like its unrelated to this PR. I am just making sure I have addressed the issues. Let me know :) and thanks again for your time and guidance!

dmatos2012 avatar Sep 27 '22 21:09 dmatos2012

No need to worry about that test. The android build is failing on all PRs at the moment. There are some conflicts that need to be resolved though.

tertsdiepraam avatar Sep 27 '22 22:09 tertsdiepraam

That failed test is actually not because of the spurious failures from before, it's because we still need to decide how to fix #3477.

jtracey avatar Oct 13 '22 19:10 jtracey

@dmatos2012 sorry but it needs to be rebased

sylvestre avatar Feb 18 '23 20:02 sylvestre

uff I had completely forgotten about this PR :P @sylvestre , but managed to rebase :)

dmatos2012 avatar Feb 20 '23 15:02 dmatos2012

GNU testsuite comparison:

GNU test failed: tests/misc/tee. tests/misc/tee is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/tail-2/inotify-dir-recreate. tests/tail-2/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?

github-actions[bot] avatar Feb 20 '23 16:02 github-actions[bot]