From darrylo@hpnmhjw.sr.hp.com  Mon Jun 19 00:11:38 1995
Received: from relay.hp.com (relay.hp.com [15.255.152.2])
          by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id AAA00440
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Jun 1995 00:11:37 -0700
Received: from hpmwtd.sr.hp.com by relay.hp.com with SMTP
	(1.37.109.16/15.5+ECS 3.3) id AA053925896; Mon, 19 Jun 1995 00:11:36 -0700
Received: from mina.sr.hp.com by hpmwtd.sr.hp.com with SMTP
	(15.11.1.6/15.5+ECS 3.3) id AA27696; Mon, 19 Jun 95 00:11:33 -0700
Received: by hpnmhjw.sr.hp.com
	(1.37.109.15/15.5+ECS 3.3) id AA199165866; Mon, 19 Jun 1995 00:11:06 -0700
Message-Id: <199506190711.AA199165866@hpnmhjw.sr.hp.com>
Date: Mon, 19 Jun 1995 00:11:06 -0700
From: darrylo@sr.hp.com
Reply-To: darrylo@sr.hp.com
To: FreeBSD-gnats-submit@freebsd.org, darrylo@sr.hp.com
Subject: chmod doesn't work through symlinks
X-Send-Pr-Version: 3.2

>Number:         534
>Category:       bin
>Synopsis:       chmod doesn't work through symlinks
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 19 00:20:01 1995
>Closed-Date:    Tue Jun 27 15:07:59 PDT 1995
>Last-Modified:
>Originator:     Darryl Okahata
>Release:        FreeBSD 2.0-BUILT-19950603 i386
>Organization:
At Home
>Environment:

	2.0.5R, default installed kernel

>Description:

	File permissions cannot be changed if a file is referenced via a
	symlink.

>How-To-Repeat:

	Script started on Sun Jun 18 23:28:04 1995
	bash$ mkdir t
	bash$ cd t
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:28 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	bash$ touch .x
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:28 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rw-r--r--  1 darrylo  xxx    0 Jun 18 23:28 .x
	bash$ ln -s .x .y
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:28 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rw-r--r--  1 darrylo  xxx    0 Jun 18 23:28 .x
	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:28 .y -> .x
	bash$ chmod 755 .y
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:28 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rw-r--r--  1 darrylo  xxx    0 Jun 18 23:28 .x
	^^^^^^^^^^ Permissions did not change

	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:28 .y -> .x
	bash$ chmod 755 .x
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:28 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	^^^^^^^^^^ This changed.

	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:28 .y -> .x
	bash$ chmod 644 .y
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:28 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	^^^^^^^^^^ No change.

	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:28 .y -> .x
	bash$ touch foo
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:29 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:29 .y -> .x
	-rw-r--r--  1 darrylo  xxx    0 Jun 18 23:29 foo
	bash$ ln -s foo yuk
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:29 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:29 .y -> .x
	-rw-r--r--  1 darrylo  xxx    0 Jun 18 23:29 foo
	lrwxr-xr-x  1 darrylo  xxx    3 Jun 18 23:29 yuk -> foo
	bash$ chmod 755 yuk
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:29 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:29 .y -> .x
	-rw-r--r--  1 darrylo  xxx    0 Jun 18 23:29 foo
	lrwxr-xr-x  1 darrylo  xxx    3 Jun 18 23:29 yuk -> foo
	bash$ chmod 755 foo
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:29 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:29 .y -> .x
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:29 foo
	lrwxr-xr-x  1 darrylo  xxx    3 Jun 18 23:29 yuk -> foo
	bash$ chmod 644 yuk
	bash$ ls -la
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:29 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	lrwxr-xr-x  1 darrylo  xxx    2 Jun 18 23:29 .y -> .x
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:29 foo
	lrwxr-xr-x  1 darrylo  xxx    3 Jun 18 23:29 yuk -> foo
	bash$ ls -laL
	total 4
	drwxr-xr-x  2 darrylo  xxx  512 Jun 18 23:29 .
	drwxr-xr-x  3 darrylo  xxx  512 Jun 18 23:28 ..
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .x
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:28 .y
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:29 foo
	-rwxr-xr-x  1 darrylo  xxx    0 Jun 18 23:29 yuk
	bash$ exit
	
	Script done on Sun Jun 18 23:30:08 1995

>Fix:
	
	None

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Tue Jun 27 15:07:59 PDT 1995 
State-Changed-Why:  
chmod is working as documented with symlinks.  Perhaps there 
should be more in a FAQ about almost everything involving  
symlinks and tree traversal being a little different in 
FreeBSD-2.x and other BSD4.4-based systems. 
>Unformatted:



