public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
Cc: Mike Frysinger <vapier@gentoo.org>, Arnd Bergmann <arnd@arndb.de>,
	       Paul Eggert <eggert@cs.ucla.edu>,
	Roland McGrath <roland@redhat.com>,
	       linasvepstas@gmail.com,
	Chris Metcalf <cmetcalf@tilera.com>,
	       GLIBC Devel <libc-alpha@sourceware.org>,
	linux-kernel@vger.kernel.org,        libc-ports@sourceware.org,
	linux-api@vger.kernel.org
Subject: Re: [BUG] Generic syscalls -- chmod vs. fchmodat
Date: Tue, 25 Jan 2011 20:50:00 -0000	[thread overview]
Message-ID: <4D3F3308.1050305@redhat.com> (raw)
In-Reply-To: <4D3F2AD9.8060000@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1779 bytes --]

On 01/25/2011 12:56 PM, Eric Blake wrote:
>>> Treating the empty string special for AT_FDCWD is rather pointless, but
>>> at least consistent.
> 
> No, treating an empty string name argument to a *at function as a
> synonym for AT_FDCWD is a violation of POSIX.
> 
>> i dont know if the gnulib peeps are on these lists, but i think their 
>> implementations of some of the *at funcs leverage the extended behavior that 
>> is available under Linux.  or at least, i'm certain they'll have some insight 
>> into some of these nuances.
> 
> Gnulib has code to explicitly work around bugs in earlier glibc/Linux
> implementations that mistakenly treated fd, "" the same as fd, "." (at
> least modern kernels get it right, and when glibc defers to the kernel,
> those workarounds in gnulib are not needed on newer systems).

One other thing to point out - this is not the first time glibc has
added code around *at kernel syscalls in order to provide POSIX
semantics where the Linux syscall does not.  Remember that both futimens
and utimensat are implemented on top of the same syscall, and that
futimens(AT_FDCWD, times) must fail rather than set the times on ".".
See glibc commit 4286fa41 where glibc had to add code to work around the
kernel's choice of the syscall utimensat(fd, NULL, times, 0) as being
the way to implement futimens, in response to
http://sourceware.org/bugzilla/show_bug.cgi?id=10992, which was raised
because gnulib detected the POSIX compliance bug, in much the same way
that gnulib is now detecting the chmod("") bug of not failing with
ENOENT when chmod is incorrectly implemented around the sys_fchmodat
syscall.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  reply	other threads:[~2011-01-25 20:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 21:05 Linas Vepstas
2011-01-24 21:32 ` Roland McGrath
2011-01-25 12:20   ` Mike Frysinger
2011-01-25 17:45 ` Arnd Bergmann
2011-01-25 17:59   ` Roland McGrath
2011-01-25 18:34     ` Arnd Bergmann
2011-01-25 18:54       ` Roland McGrath
2011-01-25 20:31         ` Arnd Bergmann
2011-01-25 19:56       ` Mike Frysinger
2011-01-25 20:05         ` Eric Blake
2011-01-25 20:50           ` Eric Blake [this message]
2011-01-25 22:11             ` Eric Blake
2011-01-26  3:31               ` Linas Vepstas
2011-02-10 18:12     ` Andries Brouwer
2011-02-10 18:17       ` Roland McGrath
2011-02-11  9:12       ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D3F3308.1050305@redhat.com \
    --to=eblake@redhat.com \
    --cc=arnd@arndb.de \
    --cc=cmetcalf@tilera.com \
    --cc=eggert@cs.ucla.edu \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-ports@sourceware.org \
    --cc=linasvepstas@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).