On 12/16/2011 10:30 AM, Bob Proulx wrote: > severity 10311 wishlist > thanks > > Jan Engelhardt wrote: >> Give chmod a "-h" option as well > > There are several important points concerning symlinks, the mode bits, > chmod(1) and chmod(2). > > * The mode bits of a symlink are not used. The original Unix authors > ignored them and did not provide any way to change them.
That's true for Linux, but false for BSD (where the mode bits of a symlink can allow restriction on dereferencing through the symlink). > > * The mode bits of a symlink are set when they are created and never > modified nor used after that time. Linux cannot modify symlink mode bits, but BSD can, precisely because Linux does not honor symlink mode bits, but BSD does. POSIX permits both styles of operation; the new fchmodat() API is required to understand AT_SYMLINK_NOFOLLOW, but is allowed to reject it with EOPNOTSUPP (compared to the more typical EINVAL for an invalid flag bit). > > * Some operating systems do allow symlink mode bits to be set but that > feature is not wide spread. > > Since the mode bits of a symlink are not in any way significant there > isn't any urgent need to change them. Since BSD chmod can set and usefully use symlink mode bits, and GNU coreutils can target BSD, then yes, we should support chmod -h, using fchmodat(), even if it is not our highest priority to implement it. At one point I had a scratch patch in one of my local trees attempting this conversion to add chmod -h; maybe I should revisit it and submit it to the list. -- Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
