Hide Forgot
Description of problem: When mv is mistakenly given arguments including a directory listed at least twice as a source as well as the destination, it will destroy that directory and everything in it will be lost. Version-Release number of selected component (if applicable): coreutils-8.24-4.fc23.x86_64 How reproducible: Trivially reproducible with steps Steps to Reproduce: 1. mkdir test 2. mv test test test Actual results: mv: cannot move 'test' to a subdirectory of itself, 'test/test' mv: warning: source directory 'test' specified more than once (and the directory and all contents are destroyed) Expected results: (per EPEL7) mv: cannot move 'test' to a subdirectory of itself, 'test/test' mv: will not create hard link 'test/test' to directory 'test/test' (and the directory remains unchanged with contents intact) Additional info:
Ouch, this looks like due to the 'return true' at: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.23-31-g90aa291 I'll fix this upstream this evening.
This avoids the issue at least. Full patch coming up... @@ -2281,7 +2283,8 @@ copy_internal (char const *src_name, char const *dst_name, /* We only do backups in move mode and for non dirs, and in move mode this won't be the issue as the source will be missing for subsequent attempts. - There we just warn and return here. */ + Therefore we just warn and return here. */ + *copy_into_self = true; return true; } else if (x->dereference == DEREF_ALWAYS
Created attachment 1113926 [details] proposed upstream fix
Thanks for the patch and quick fix - there is a typo in the NEWS entry (no londer). Other than that, looks fine, I'll apply this to rawhide and f23...well - later today ;).
coreutils-8.24-5.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-477caff2e3
coreutils-8.24-5.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-477caff2e3
coreutils-8.24-5.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.