Bug 113397

Summary: sgid directory changes permission when files are copied, created but not moved
Product: Red Hat Enterprise Linux 3 Reporter: Xander D Harkness <harkness>
Component: kernelAssignee: Stephen Tweedie <sct>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: nobody
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-01-15 11:31:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xander D Harkness 2004-01-13 15:40:51 UTC
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:

Comment 1 Tim Waugh 2004-01-13 15:54:24 UTC
Nothing to do with the 'mv' command, but the 'rename' syscall.

Comment 2 Stephen Tweedie 2004-01-15 11:31:07 UTC
"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.