This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 171422 - chgrp alters uid of a file
chgrp alters uid of a file
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
4
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-21 12:37 EDT by Pablo Sanchez
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-08 11:37:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
trace file from 'strace chgrp -v -R adm /tmp/abc 2>/tmp/chgrp.log' (6.28 KB, text/plain)
2005-10-24 10:22 EDT, Pablo Sanchez
no flags Details

  None (edit)
Description Pablo Sanchez 2005-10-21 12:37:03 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

Description of problem:
chgrp alters the ownership of a file if the file has a link to it in the same directory (I couldn't beleive it either).

Version-Release number of selected component (if applicable):
coreutils-5.2.1-48.1

How reproducible:
Always

Steps to Reproduce:
1. login as root
2. mkdir /tmp/abc
3. touch /tmp/abc/file
4. ln -s /tmp/abc/file /tmp/abc/file.link
5. chown -v -R adm /tmp/abc
6. chgrp -v -R adm /tmp/abc
7. ls -l /tmp/abc

Actual Results:  mkdir /tmp/abc
touch /tmp/abc/file
ln -s /tmp/abc/file /tmp/abc/file.link
chown -v -R adm /tmp/abc
changed ownership of `/tmp/abc' to adm
changed ownership of `/tmp/abc/file' to adm
changed ownership of `/tmp/abc/file.link' to adm
chgrp -v -R adm /tmp/abc
changed group of `/tmp/abc' to adm
changed group of `/tmp/abc/file' to adm
changed group of `/tmp/abc/file.link' to adm
ls -l /tmp/abc
total 0
-rw-r--r--  1 root adm   0 Oct 21 12:35 file
lrwxrwxrwx  1 root root 13 Oct 21 12:35 file.link -> /tmp/abc/file


Expected Results:  -rw-r--r--  1 adm  adm   0 Oct 21 12:35 file
lrwxrwxrwx  1 root root 13 Oct 21 12:35 file.link -> /tmp/abc/file


Additional info:

the link is apparently causing the issue:
mkdir /tmp/abc
touch /tmp/abc/file
ln -s /tmp/abc/file /tmp/abc/a.file
chown -v -R adm /tmp/abc
changed ownership of `/tmp/abc' to adm
changed ownership of `/tmp/abc/a.file' to adm
changed ownership of `/tmp/abc/file' to adm
chgrp -v -R adm /tmp/abc
changed group of `/tmp/abc' to adm
changed group of `/tmp/abc/a.file' to adm
changed group of `/tmp/abc/file' to adm
ls -l /tmp/abc
total 0
lrwxrwxrwx  1 root root 13 Oct 21 12:37 a.file -> /tmp/abc/file
-rw-r--r--  1 adm  adm   0 Oct 21 12:37 file
Comment 1 Pablo Sanchez 2005-10-21 12:53:55 EDT
This behavior is OK on FC1, FC2 and FC3. Only broken on FC4.
Comment 2 Tim Waugh 2005-10-24 09:22:55 EDT
Can't reproduce this behaviour under kernel-2.6.13-1.1532_FC4:

[root@cyberelk ~]# rpm -q coreutils
coreutils-5.2.1-48.1
[root@cyberelk ~]# mkdir /tmp/abc
[root@cyberelk ~]# touch /tmp/abc/file
[root@cyberelk ~]# ln -s /tmp/abc/file /tmp/abc/file.link
[root@cyberelk ~]# chown -v -R adm /tmp/abc
changed ownership of `/tmp/abc' to adm
changed ownership of `/tmp/abc/file.link' to adm
changed ownership of `/tmp/abc/file' to adm
[root@cyberelk ~]# chgrp -v -R adm /tmp/abc
changed group of `/tmp/abc' to adm
changed group of `/tmp/abc/file.link' to adm
changed group of `/tmp/abc/file' to adm
[root@cyberelk ~]# ls -l /tmp/abc
total 0
-rw-r--r--  1 adm  adm   0 Oct 24 14:19 file
lrwxrwxrwx  1 root root 13 Oct 24 14:19 file.link -> /tmp/abc/file

1. Please provide the chgrp.log from 'strace chgrp -v -R adm /tmp/abc 2>chgrp.log'.

2. What does 'uname -r' say?
Comment 3 Pablo Sanchez 2005-10-24 10:22:55 EDT
Created attachment 120306 [details]
trace file from 'strace chgrp -v -R adm /tmp/abc 2>/tmp/chgrp.log'
Comment 4 Pablo Sanchez 2005-10-24 10:24:43 EDT
uname -r output:

2.6.13-1.1532_FC4smp
Comment 6 Tim Waugh 2005-11-08 11:37:58 EST
Thanks for the report.  This is fixed in coreutils-5.93-1 in rawhide, and FC5
will contain the fix.

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