mv command deleted source file without moving to destination

Bug #1933531 reported by Tom Arons
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

 I mv'd a file to a directory where I had group write permissions, but a file existed owned by another user. I was asked if I wanted to override the permissions. I said "y". The ownership was changed on the destination file to me, but the mod time and contents of the file were not changed and the source file was deleted. I tried to duplicate the behavior, but it worked as it should with a test file.

toma@admn1:~$ ls -ld /opt/scripts
drwxrwxr-- 3 ansible ansible 4096 Jun 24 16:25 /opt/scripts
toma@admn1:~$ mv GeneratePortList.pl /opt/scripts/
mv: replace '/opt/scripts/GeneratePortList.pl', overriding mode 0755 (rwxr-xr-x)? y
toma@admn1:~$ ls -l /opt/scripts/GeneratePortList.pl
-rwxr-xr-x 1 toma domain users 2855 Jul 16 2018 /opt/scripts/GeneratePortList.pl

I have mv aliased to mv -i so I can confirm that the existing destination file was not owned by me since I was not prompted to overwrite the file.

Both source and destination are in the same file system. I cannot find the source file anywhere.

toma@admn1:~$ lsb_release -rd
Description: Ubuntu 20.04.2 LTS
Release: 20.04
toma@admn1:~$ uname -a
Linux admn1.aaisdirect.com 5.4.0-1048-aws #50-Ubuntu SMP Mon May 3 21:44:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
toma@admn1:~$ apt-cache policy coreutils
coreutils:
  Installed: 8.30-3ubuntu2
  Candidate: 8.30-3ubuntu2
  Version table:
 *** 8.30-3ubuntu2 500
        500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
     8.28-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.