public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14578] New: fchmodat(..., AT_SYMLINK_NOFOLLOW) returns ENOTSUP on non-symlinks
@ 2012-09-13 16:42 mgorny at gentoo dot org
  2012-09-13 17:01 ` [Bug libc/14578] " joseph at codesourcery dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: mgorny at gentoo dot org @ 2012-09-13 16:42 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14578

             Bug #: 14578
           Summary: fchmodat(..., AT_SYMLINK_NOFOLLOW) returns ENOTSUP on
                    non-symlinks
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: mgorny@gentoo.org
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Tested with glibc-2.15, the relevant code verified to be the same in current
git.
CHOST: x86_64-unknown-linux-gnu
Kernel: 3.5.0 (vanilla)

Whenever fchmodat() is called with AT_SYMLINK_NOFOLLOW on Linux, it
unconditionally fails with ENOTSUP. The following snippet from
sysdeps/unix/sysv/linux/fchmodat.c is responsible for that:

#ifndef __NR_lchmod     /* Linux so far has no lchmod syscall.  */
  if (flag & AT_SYMLINK_NOFOLLOW)
    {
      __set_errno (ENOTSUP);
      return -1;
    }
#endif

POSIX.2008 however specifies[1] that:

[EOPNOTSUPP]
  The AT_SYMLINK_NOFOLLOW bit is set in the flag argument,
  path names a symbolic link, and the system does not support changing
  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  the mode of a symbolic link.

In other words, I believe that fchmodat() should only return ENOTSUP if
AT_SYMLINK_NOFOLLOW is requested on a symbolic link. On regular files, it
should just change the mode.

[1]:http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-09-10 15:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-13 16:42 [Bug libc/14578] New: fchmodat(..., AT_SYMLINK_NOFOLLOW) returns ENOTSUP on non-symlinks mgorny at gentoo dot org
2012-09-13 17:01 ` [Bug libc/14578] " joseph at codesourcery dot com
2012-09-13 17:05 ` joseph at codesourcery dot com
2012-09-13 22:40 ` bugdal at aerifal dot cx
2012-09-13 23:07 ` joseph at codesourcery dot com
2012-09-13 23:09 ` bugdal at aerifal dot cx
2012-09-13 23:17 ` bugdal at aerifal dot cx
2012-09-14  0:46 ` joseph at codesourcery dot com
2013-07-30 16:16 ` bugdal at aerifal dot cx
2013-07-30 16:53 ` bugdal at aerifal dot cx
2013-08-02 16:21 ` bugdal at aerifal dot cx
2014-06-17  4:33 ` fweimer at redhat dot com
2020-09-10 15:40 ` [Bug libc/14578] /proc-based emulation for lchmod, fchmodat bugdal at aerifal dot cx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).