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

mv: fails to copy special files across filesystems #7076

Open
jfinkels opened this issue Jan 5, 2025 · 1 comment
Open

mv: fails to copy special files across filesystems #7076

jfinkels opened this issue Jan 5, 2025 · 1 comment
Labels

Comments

@jfinkels
Copy link
Collaborator

jfinkels commented Jan 5, 2025

Environment: Ubuntu 20.04, uutils main branch (git commit 1e8e16b), GNU coreutils v8.30

Steps to reproduce:

# create a directory on a different filesystem
mkdir /dev/shm/tmp
# create a special file, in this case a FIFO
mknod pipe p
mv pipe /dev/shm/tmp

What happens now: uutils mv hangs indefinitely and never terminates.

What I expected to happen: GNU mv copies the special file to the target directory

Notes: this is causing a failure in the GNU test file tests/mv/mv-special-1.sh.

Because the source file and the destination are on different filesystems, the file is copied to the destination and then the source file is removed; this can be seen by passing the --verbose option:

$ mv --verbose pipe /dev/shm/tmp
copied 'pipe' -> '/dev/shm/tmp/pipe'
removed 'pipe'
@jfinkels jfinkels added the U - mv label Jan 5, 2025
@DaringCuteSeal
Copy link
Contributor

I think we need to create a new file and copy its attributes instead of solely relying on fs::copy, kinda like how cp does it when the --no-dereference option is passed. if we do that now we'd get like three identical functions both in cp and mv relating to the attributes copying operation.

this makes me want to put the entire cp into uucore.. think the whole app. but minus the progressbar, though i will have no idea of how to expose the internal progress of the copy call to the caller. a closure should be fine? but seriously this is some refactor worthy of consideration imho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants