From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922 Description of problem: I have a directory /home/luke/blaster with permissions: rwxr-sr-x owned by luke group is blaster cp hello blaster or touch blaster/hello creates a file with permissions rw-rw-r-- and owner luke group blaster mv hello blaster creates a file with permissions rw-rw-r-- owner and group luke Version-Release number of selected component (if applicable): coreutils-4.5.3-26 How reproducible: Sometimes Steps to Reproduce: 1.mkdir /home/luke/blaster 2.groupadd blaster 3.chgrp blaster /home/luke/blaster 4.chmod g+s /home/luke/blaster 5.cp hello blaster (works) 6.mv hello blaster (group owner still luke Actual Results: Copy and create work Expected Results: move does not change the file group to blaster Additional info:
Nothing to do with the 'mv' command, but the 'rename' syscall.
"mv" simply renames a file. It doesn't change the file at all. This is correct behaviour. The sgid bit on a directory only affects the gid assigned to *new* files created inside that directory. That's why copy and create both set the gid. Moving an existing file is not expected to change the gid.