Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Paul Eggert
On 09/17/10 13:28, Eric Blake wrote: > I guess you're starting to convince me: the _only_ interface pattern we > need is: > > fdutimens (fd, name, time) > fdutimensat (fd, dir, name, time, flag) > fdchmod (fd, name, mode) > fdchmodat (fd, dir, name, mode, flag) > > because they are fd* wrappers a

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Eric Blake
On 09/17/2010 02:17 PM, Paul Eggert wrote: On 09/17/2010 01:40 PM, Eric Blake wrote: not to mention inconsistent with all the other *at functions On the contrary, the current gnulib name "fdutimens" is inconsistent with the usual POSIX naming conventions. In POSIX, functions like "fdopen" p

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Paul Eggert
> On 09/17/2010 01:40 PM, Eric Blake wrote: >> not to mention inconsistent with all the other *at functions On the contrary, the current gnulib name "fdutimens" is inconsistent with the usual POSIX naming conventions. In POSIX, functions like "fdopen" put the fd first. "fdutimens" (and "fdutime

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Eric Blake
On 09/17/2010 01:40 PM, Eric Blake wrote: The GNU tar convention is clearer, since it reflects the semantics better: try FD first, and use that if it works; otherwise fall back on DIR+FILE. Could we please switch to this order, while we're changing the API anyway? Hmm; I'm reluctant to make the

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Eric Blake
On 09/17/2010 12:14 PM, Paul Eggert wrote: Thanks for adding that functionality to gnulib. I prepared a patch to have GNU tar use it, but found one more problem. fdutimensat uses this signature: fdutimensat (int dir, char const *file, int fd, [ other args ] ) whereas the similar function in G

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Paul Eggert
Thanks for adding that functionality to gnulib. I prepared a patch to have GNU tar use it, but found one more problem. fdutimensat uses this signature: fdutimensat (int dir, char const *file, int fd, [ other args ] ) whereas the similar function in GNU tar uses the following order instead. fdu

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Eric Blake
On 09/17/2010 08:29 AM, Eric Blake wrote: If you like, I can install the obvious patch. Nah, I just did this (ignore atflag if fd is valid, and let utimensat rather than fdutimensat validate atflag if fd was invalid): And this, to keep the testsuite happy. diff --git i/ChangeLog w/ChangeLog

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-17 Thread Eric Blake
On 09/16/2010 05:45 PM, Paul Eggert wrote: { int result = 1; + if (atflag& ~AT_SYMLINK_NOFOLLOW) +{ + errno = EINVAL; + return -1; +} Thanks, but unfortunately this doesn't look quite right for GNU tar's purposes. Tar specifies a nonnegative FD along with a flag equal t

Re: [PATCH] fdutimensat: add an atflag parameter

2010-09-16 Thread Paul Eggert
On 09/16/10 16:28, Eric Blake wrote: > int > -fdutimensat (int dir, char const *file, int fd, struct timespec const ts[2]) > +fdutimensat (int dir, char const *file, int fd, struct timespec const ts[2], > + int atflag) > { >int result = 1; > + if (atflag & ~AT_SYMLINK_NOFOLLOW) >

[PATCH] fdutimensat: add an atflag parameter

2010-09-16 Thread Eric Blake
* lib/fdutimensat.c (fdutimensat): Add new parameter. * lib/utimens.h (fdutimensat): Update prototype. * tests/test-fdutimensat.c: Adjust test to match. * NEWS: Document the change. Suggested by Paul Eggert. Signed-off-by: Eric Blake --- > > Makes sense, and easy enough to fix. It's a gnulib AP