Subject: bin/563: chmod vs. symlinks: bits don't propagate?
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 11/07/1994 20:20:05
>Number:         563
>Category:       bin
>Synopsis:       chmod doesn't add rights when called via symlink
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov  7 20:20:03 1994
>Originator:     John Kohl
>Organization:
"	"
>Release:        1.0
>Environment:
	
System: NetBSD kolvir 1.0 NetBSD 1.0 (KOLVIR) #60: Sat Nov 5 08:56:32 EST 1994 jtk@kolvir:/u1/NetBSD-1.0/src/sys/arch/i386/compile/KOLVIR i386

>Description:
When I ran chmod(1) on a symlink, I expected to see the modes reflected
on the symlink's target's inode, but they aren't.
I suspect chmod may be looking at the (apparent) modes of the symlink
rather than the modes of the target file.

>How-To-Repeat:

% cd /tmp
% touch aaaa
% chmod 400 aaaa
% ln -s aaaa bbbb
% ls -l aaaa bbbb
-r--------  1 jtk   wheel  0 Nov  7 21:27 aaaa
lrwxrwxrwt  1 root  wheel  4 Nov  7 21:27 bbbb -> aaaa
% chmod u+w bbbb
% ls -l aaaa bbbb
-r--------  1 jtk   wheel  0 Nov  7 21:27 aaaa
lrwxrwxrwt  1 root  wheel  4 Nov  7 21:28 bbbb -> aaaa
		!!! shouldn't aaaa have been rw------- ? !!!
% chmod u+w aaaa
% ls -l aaaa bbbb
-rw-------  1 jtk   wheel  0 Nov  7 21:27 aaaa
lrwxrwxrwt  1 root  wheel  4 Nov  7 21:28 bbbb -> aaaa

>Fix:
Probably something to do with stat(2) vs. lstat(2)?

>Audit-Trail:
>Unformatted: