Re: [dev] [sbase] chmod -R and symbolic links
On Sat, Dec 21, 2019 at 07:05:45PM -0800, Michael Forney wrote:
> - Most BSD chmod(1) have -H, -L, and -P options (defaulting to -P),
> and the filesystem *does* record the mode of a symlink, but this mode
> has no affect on the kernel's access checks.
Well, most Linux FSes have the capacity to record symlink mode as well,
and Linux has the capacity to return that mode with lstat() (which is
evident whenever you list directories from the /proc file system), it
just has no interface to change the mode and no use for a symlink's
mode.
So, almost like the BSDs, just without a way to change symlink mode.
> So currently, if sbase chmod -R encounters a dangling symlink, it always fails.
>
> I can think of two possibilities here:
>
> 1. Remove the -H, -L, and -P options from chmod, always set r.follow =
> 'H', and call chmod(3) conditional on !S_ISLINK(st->st_mode).
> 2. Keep the -H, -L, and -P options, but use fchmodat(3) instead of
> chmod(3) with AT_SYMLINK_NOFOLLOW depending on r->follow and r->depth.
> If fchmodat fails with EOPNOTSUPP, ignore that and continue.
>
> Does anyone have a strong preference for 2? I'm leaning towards 1
> since it doesn't seem like those options are used commonly.
>
> -Michael
>
Removing nonstandard (thus unreliable[1]) options would appear the most
sensible to me as well. Also the least sucky, since it removes unused
features. JM2C.
Ciao,
Markus
[1] By this I mean, I cannot write scripts relying on the existance of
these options, since they might not.
Received on Sun Dec 22 2019 - 09:16:33 CET
This archive was generated by hypermail 2.3.0
: Sun Dec 22 2019 - 09:24:06 CET