[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10311: RFE: Give chmod a "-h" option as well
From: |
Bob Proulx |
Subject: |
bug#10311: RFE: Give chmod a "-h" option as well |
Date: |
Fri, 16 Dec 2011 11:24:53 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Jan Engelhardt wrote:
> Bob Proulx wrote:
> > chmod -R [does not] by default dereference[s] symlinks.
>
> It does not? Oh, in that case the report may be closed.
Here is an example test case:
$ mkdir symlink-perm-test
$ cd symlink-perm-test
$ mkdir dir1 dir2
$ date > dir1/datestamp
$ chmod go-w dir1/datestamp
$ ls -ldog dir1/datestamp
-rw-r--r-- 1 29 Dec 16 11:11 dir1/datestamp
$ ls -ldog dir2/link1
lrwxrwxrwx 1 17 Dec 16 11:12 dir2/link1 -> ../dir1/datestamp
$ cat dir2/link1
Fri Dec 16 11:11:10 MST 2011
$ chmod -v -R g+w dir2
mode of `dir2' retained as 0775 (rwxrwxr-x)
neither symbolic link `dir2/linkdir2' nor referent has been changed
neither symbolic link `dir2/link1' nor referent has been changed
$ ls -ldog dir1/datestamp
-rw-r--r-- 1 29 Dec 16 11:11 dir1/datestamp
> This behavior is however inconsistent with what chown (and many other
> tools) do by default though.
Symlinks violate some principles of least surprise. Therefore it is no
surprise that it is impossible to make all uses of symlinks
unsurprising.
Symlinks were intended to be completely transparent. There shouldn't
be any difference between a symlink and the referenced file. But some
commands do have differences anyway.
Bob