Skip to content

mv cannot move files between Windows mount and linux file system #37

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

Closed
mphaney opened this issue Apr 7, 2016 · 7 comments
Closed

mv cannot move files between Windows mount and linux file system #37

mphaney opened this issue Apr 7, 2016 · 7 comments

Comments

@mphaney
Copy link

mphaney commented Apr 7, 2016

Moving a file (with mv) within the Windows file system or within the Linux file system works exactly as it should, but moving between the two file systems yields the error:
mv: cannot move 'filename' to a subdirectory of itself, '/destination/filename'

Here is a complete test scenario:

root@localhost:~# cd /mnt/c/Users/Mark/
root@localhost:/mnt/c/Users/Mark# echo test > testfile
root@localhost:/mnt/c/Users/Mark# mkdir windir
root@localhost:/mnt/c/Users/Mark# mv testfile windir/
root@localhost:/mnt/c/Users/Mark# mv windir/testfile .
root@localhost:/mnt/c/Users/Mark# mv testfile /root/
mv: cannot move ‘testfile’ to a subdirectory of itself, ‘/root/testfile’
root@localhost:/mnt/c/Users/Mark# cp testfile /root/
root@localhost:/mnt/c/Users/Mark# rm testfile
root@localhost:/mnt/c/Users/Mark# cd /root
root@localhost:~# mkdir linuxdir
root@localhost:~# mv testfile linuxdir/
root@localhost:~# mv linuxdir/testfile .
root@localhost:~# mv testfile /mnt/c/Users/Mark/
mv: cannot move ‘testfile’ to a subdirectory of itself, ‘/mnt/c/Users/Mark/testfile’
root@localhost:~# cp testfile /mnt/c/Users/Mark/
root@localhost:~# rm testfile

@jolibert
Copy link

jolibert commented Apr 7, 2016

Look at it as different environments.
You will never touch /mnt/c/
as you will never mount any files on / /mnt or other letters

@mphaney
Copy link
Author

mphaney commented Apr 7, 2016

Well, they most certainly are different environments, no question, but if I can copy from one to the other, edit Windows files from within the Linux environment, create and remove Windows files from within the Linux environment...kinda seems like move should work too, and yet it fails.

As a side note I believe the assertion that one would never touch /mnt/c/ is incorrect. The whole point of giving Windows developers Bash was so it could work harmoniously with their Windows environment, not as a completely separate system.

@crutchcorn
Copy link

Yeah, I can confirm for @mphaney's thought process. You can also touch files in /mnt/c/

@jbaribeault
Copy link

Same happens in /root for say, CPAN....it unzips the files in /root/.cpan, then can't move the directory to a build directory under /root/.cpan - insufficient permissions. Yet looking at ls output, things are fine...

@jolibert
Copy link

jolibert commented Apr 7, 2016

Just put actions on /root as UAC actions on that mini kernel.
The idea is to put developers in it, nil hackers.
If developers got hacked, their choice to put the environment in sensitive areas.

@jolibert
Copy link

jolibert commented Apr 7, 2016

And I know hundreds to hack a developer, trust me, my job

@dethoma
Copy link

dethoma commented Apr 8, 2016

Thanks for reporting this issue. We were returning ENOENT instead of EXDEV for the rename syscall. When that is addressed mv will switch to "copy then remove original" behavior.

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

No branches or pull requests

5 participants