This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: XFS reports lchmod failure, but changes file system contents
On Wed, Feb 12, 2020 at 07:51:18PM +0000, Al Viro wrote:
> On Wed, Feb 12, 2020 at 08:15:08PM +0100, Florian Weimer wrote:
>
> > | Further, I've found some inconsistent behavior with ext4: chmod on the
> > | magic symlink fails with EOPNOTSUPP as in Florian's test, but fchmod
> > | on the O_PATH fd succeeds and changes the symlink mode. This is with
> > | 5.4. Cany anyone else confirm this? Is it a problem?
> >
> > It looks broken to me because fchmod (as an inode-changing operation)
> > is not supposed to work on O_PATH descriptors.
>
> Why? O_PATH does have an associated inode just fine; where does
> that "not supposed to" come from?
Indeed, my expectation was that both fchmod and chmod via the magic
symlink succeed, given a new enough kernel for operations on O_PATH
fds to be supported. I'd like to switch to using fstat+fchmod to do
this, and only fallback to /proc on older kernels where O_PATH fds
cause EBADF. But I'm somewhat concerned by the inconsistency between
behavior of the two approaches.
Rich