Bug 113397 - sgid directory changes permission when files are copied, created but not moved
Summary: sgid directory changes permission when files are copied, created but not moved
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel
Version: 3.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Stephen Tweedie
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-01-13 15:40 UTC by Xander D Harkness
Modified: 2016-06-07 22:44 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2004-01-15 11:31:07 UTC


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.