I'm trying to rename a file using the regular mv
command which has worked countless times before.
$ ls -l |grep "Picture 001"
-rwxrwxrwx 1 rolf rolf 657711 Feb 19 21:42 Picture 001_19.jpg
$ mv "Picture 001_19.jpg" "Picture 001_19_u.jpg"
mv: cannot move 'Picture 001_19.jpg' to a subdirectory of itself, 'Picture 001_19_u.jpg'
Can anyone tell me why mv
suddenly refuses to rename this file?
How has mv
decided that Picture 001_19_d.jpg
is a directory name, and not a file name?
I tried running the same command with argument -T
.
From the mv
manpage:
-T, --no-target-directory
treat DEST as a normal file
The result are exactly the same.
This is confusing and frustrating!
Is it a bug?
$ mv --version
mv (GNU coreutils) 8.30
Update
It does appear to be a bug
$ echo "blah" > tt
$ mv tt tt1
mv: cannot move 'tt' to a subdirectory of itself, '../tt'
$ mv tt ../
mv: cannot move 'tt' to a subdirectory of itself, '../tt'
The problem happens when I run mv
on a mounted external drive, on a writable NTFS partition.
When I copy it to my Desktop folder, which is hosted on an Ext4 partition and I try mv
there, then it works without problem.
Update 2
$ sudo apt-show-versions coreutils
[sudo] password for rolf:
coreutils:amd64/sid 8.30-2 uptodate
coreutils:i386 not installed
Indeed I seem to be running a buggy version (as per this answer).
chkdsk
(from Windows) to repair the NTFS volume?backup2l
saving to an external drive formatted with ZFS. I don't see how it can be filesystem corruption as ZFS should detect this.mv
worked fine. Upgraded back to 8.30-2 and it gives the above error. Currently leaving my system on 8.30-1 and will go and see if there's a bug report.