[PATCH] getcwd: fix mingw bugs

2011-04-27 Thread Eric Blake
On mingw, getcwd(NULL,1) succeeds, even though glibc documents that with a non-zero size, the allocation will not exceed that many bytes. On mingw, getcwd has the wrong signature. However, we don't have to check for this if anything else triggers the replacement. Also, fix a type bug that crept

[RFC PATCH] fchdir: move fd shadowing into fd-hook

2011-04-27 Thread Eric Blake
In order to eventually add socket nonblocking status into fd shadowing, it is useful to move the existing fchdir name shadowing into a common file. * modules/fd-hook (Depends-on): Add dosname, dup2, filenamecat-lgpl, getcwd-lgpl, malloc-posix, realloc-posix, stdbool, strdup-posix. * modules/fchdir

Re: [PATCHv2 3/9] getcwd: enhance tests

2011-04-27 Thread Eric Blake
On 04/27/2011 11:58 AM, Eric Blake wrote: > On 04/26/2011 05:35 PM, Eric Blake wrote: >> * tests/test-getcwd-lgpl.c: New file, taken from... >> * tests/test-getcwd.c: ...old contents. Rewrite this file to >> repeat long path stress tests from m4 probe. >> * modules/getcwd-lgpl-tests: New module. >

Re: mkstemp

2011-04-27 Thread Bruno Haible
Eric Blake wrote: > > + dies from a fatal signal such as SIGQUIT, SIGKILL, or SIGABRT, SIGSEGV, > > + SIGBUS, SIGILL, SIGFPE, */ > > The grammar is a bit off, though. Should the "or" be moved to the end, SIGQUIT, SIGKILL are signals forceful kill signals from outside the program, whereas SI

[PATCHv2 3/4] hash, mgetgroups: drop xalloc dependency

2011-04-27 Thread Eric Blake
Rely on the new xalloc-oversized module to avoid requiring xalloc-die for functions documented as returning NULL on potential allocation overflow. * lib/hash.c (includes): Adjust includes. * lib/mgetgroups.c (includes): Likewise. (xgetgroups): Move... * lib/xgetgroups.c: ...to new file. * modules/

[PATCHv2 4/4] tests: drop unused link dependency

2011-04-27 Thread Eric Blake
Ever since commit 2392b18099, openat and fdopendir no longer drag in xalloc-die through indirect dependencies, so these tests no longer need $(LIBINTL). * modules/areadlinkat-tests (Makefile.am): Drop stale LDADD. * modules/dirent-safer-tests (Makefile.am): Likewise. * modules/fdopendir-tests (Mak

[PATCHv2 2/4] xalloc-oversized: new module

2011-04-27 Thread Eric Blake
Due to inline functions, mere inclusion of xalloc.h can result in a link dependency on xalloc_die() on some platforms. However, there are several modules that want to use just xalloc_oversized in order to short-circuit the potential to call xalloc_die. Splitting the macro into a new header and mod

[PATCHv2 1/4] utimecmp: drop dependency on xmalloc

2011-04-27 Thread Eric Blake
utimecmp's only use of malloc was for a cache; we can always bypass the cache in low memory, and thus avoid dragging in xalloc-die. * lib/utimecmp.c (utimecmp): Work even if hash table cache fails due to memory pressure. * modules/utimecmp (Depends-on): Drop xalloc. Signed-off-by: Eric Blake ---

Re: mkstemp

2011-04-27 Thread Eric Blake
On 04/27/2011 04:37 PM, Bruno Haible wrote: > Eric Blake wrote: >>> +# On some hosts, mkstemp creates files with mode 0666, which is a security >>> +# problem. >> >> Also, it was valid in POSIX 2001, but violates POSIX 2008. > > What about mkstemps? Does it have the same problem as mkstemp? In al

Re: mkstemp

2011-04-27 Thread Bruno Haible
Eric Blake wrote: > > +# On some hosts, mkstemp creates files with mode 0666, which is a security > > +# problem. > > Also, it was valid in POSIX 2001, but violates POSIX 2008. What about mkstemps? Does it have the same problem as mkstemp? The answer is fortunately "no". The platforms x symbols

Re: [PATCH 1/2] hash, mgetgroups: drop xalloc dependency

2011-04-27 Thread Eric Blake
On 04/27/2011 02:08 AM, Bruno Haible wrote: > Eric Blake wrote: >> * modules/xgetgroups: New file, split from... >> * modules/mgetgroups: ...here. > > A NEWS entry should explain this backward incompatible change. > And coreutils/bootstrap.conf will need an update. Good catch, although the coreut

Re: parse-datetime.y & ISO8601 timestamps

2011-04-27 Thread Pádraig Brady
On 27/04/11 16:47, J.T. Conklin wrote: > First some background. > > The continuous integration build framework I maintain at work uses > timestamp files for "last_build", "last_success", etc. The contents > of each file is the timestamp in ISO 8601 format (the inode mtime is > set to the same v

mkstemps: ensure declaration

2011-04-27 Thread Bruno Haible
On MacOS X 10.5, mkstemps is declared in , not in . This leads to a failure in a testdir created by $ ./gnulib-tool --create-testdir --dir=... --with-tests --with-c++-tests mkstemps g++ -DHAVE_CONFIG_H -I. -DGNULIB_STRICT_CHECKING=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -Wall -MT test

Re: mkstemp

2011-04-27 Thread Eric Blake
On 04/27/2011 03:29 PM, Bruno Haible wrote: > Just "less likely"?! The code in module 'clean-temp' goes through all kinds of > hoops with signal handlers and 'volatile' variables to make _sure_ that the > temporary files are cleaned up. This has also been tested as part of the > 'msgfmt' program. >

Re: parse-datetime.y & ISO8601 timestamps

2011-04-27 Thread J.T. Conklin
Jim Meyering writes: >> I'm interested in comments on both the idea of supporting such time >> formats, and whether there is a better implementation. > > Thank you! This patch looks fine. > > As Paul mentioned, a complete change would be welcome, > if you can fill out paperwork. Considering that

Re: [PATCH] mkstemp: replace if system version uses wrong permissions

2011-04-27 Thread Bruno Haible
> 2011-04-27 Reuben Thomas > and Eric Blake > > + mkstemp: replace if system version uses wrong permissions > + * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Add test for non-owner > + read/write mode bits set in file created by mkstemp. > + * doc/posix-functions/mkstemp.texi (mks

Re: mkstemp

2011-04-27 Thread Bruno Haible
Eric Blake wrote: > I also think doc/posix-functions/mkstemp.texi could > use a similar comment. I added that, and pushed the modified result. Thanks, but... "The gnulib module clean-temp can create temporary files that are less likely to be left behind on signals such as SIGINT." Just "le

hash vs. xmalloc [was: [PATCH 2/2] tests: drop unused link dependency]

2011-04-27 Thread Eric Blake
On 04/27/2011 12:24 AM, Jim Meyering wrote: >> fdutimensat-tests still pulls in xalloc, via utimecmp (which >> calls xalloc_die if it can't manage a hash table). So this >> patch isn't quite perfect yet, but getting closer. Any ideas >> on whether it would be possible to make utimecmp work withou

Re: [PATCHv2 9/9] fchdir: avoid extra chdir and fix test

2011-04-27 Thread Eric Blake
On 04/26/2011 05:35 PM, Eric Blake wrote: > On Linux, with a forced ac_cv_func_fchdir=no, the test failed > because dup2 was not replaced, all because the shell variable > ac_cv_func_dup2 had not been set yet. > > Meanwhile, computing the canonical pathname of a directory on > mingw was rather exp

Re: [PATCHv2 7/9] linkat, renameat: add missing dependency

2011-04-27 Thread Eric Blake
On 04/26/2011 05:35 PM, Eric Blake wrote: > * modules/linkat (Depends-on): Require getcwd-lgpl. > * modules/renameat (Depends-on): Likewise. 6 and 7 were both pretty uncontroversial; I've now pushed them. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://

new test-lock failure on Darwin via nixos/hydra diffutils autobuilder

2011-04-27 Thread Jim Meyering
FYI, here's the log: http://hydra.nixos.org/build/1058543 Here's the relevant snippet from the log: building test-lock.log /bin/sh: line 1: 83575 Abort trap EXEEXT='' srcdir='.' LOCALE_FR='fr_FR.ISO8859-1' LOCALE_FR_UTF8='fr_FR.UTF-8' LIBSIGSEGV='' LOCALE_FR='fr_FR.ISO8859-1' LO

Re: [PATCHv2 4/9] save-cwd: reduce dependency

2011-04-27 Thread Eric Blake
On 04/27/2011 10:03 AM, Jim Meyering wrote: > Eric Blake wrote: >> On 04/27/2011 01:37 AM, Jim Meyering wrote: >>> Eric Blake wrote: save-cwd needs either a working fchdir or a working getcwd(NULL). The only platform where getcwd fixes problems not solved by getcwd-lgpl is Linux, but

Re: parse-datetime.y & ISO8601 timestamps

2011-04-27 Thread Jim Meyering
J.T. Conklin wrote: > First some background. > > The continuous integration build framework I maintain at work uses > timestamp files for "last_build", "last_success", etc. The contents > of each file is the timestamp in ISO 8601 format (the inode mtime is > set to the same value, but thats beside

Re: [PATCHv2 3/9] getcwd: enhance tests

2011-04-27 Thread Eric Blake
On 04/26/2011 05:35 PM, Eric Blake wrote: > * tests/test-getcwd-lgpl.c: New file, taken from... > * tests/test-getcwd.c: ...old contents. Rewrite this file to > repeat long path stress tests from m4 probe. > * modules/getcwd-lgpl-tests: New module. > * modules/getcwd-tests (Depends-on): Depend on

Re: [PATCHv2 2/9] getcwd-lgpl: new module

2011-04-27 Thread Eric Blake
On 04/26/2011 06:54 PM, Bruno Haible wrote: > Hi Eric, > > Now the code is clear enough that it can be understood :-) I have three > remarks: The first two were trivial fixes. >> AC_DEFUN([gl_PREREQ_GETCWD], >> [ >>AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) >>AC_REQUIRE([gl_CHECK_TYPE_STR

Re: [PATCH] mkstemp: replace if system version uses wrong permissions

2011-04-27 Thread Eric Blake
On 04/27/2011 10:24 AM, Reuben Thomas wrote: > On 27 April 2011 16:33, Eric Blake wrote: >> >> Here's the final version I'd like to push. It's modified a bit from >> your version; are you okay with it still being in your name? > > Thanks very much for polishing and testing this patch; I don't mi

Re: parse-datetime.y & ISO8601 timestamps

2011-04-27 Thread Paul Eggert
On 04/27/11 08:47, J.T. Conklin wrote: > I'm interested in comments on both the idea of supporting such time > formats, and whether there is a better implementation. Thanks. I like the idea of supporting these formats, and know of no better implementation. But we'd need to change parse-datetime.

[PATCH] passfd: avoid compiler warning

2011-04-27 Thread Eric Blake
Detected on Fedora 13 with -Wshadow. * lib/passfd.c (sendfd, recvfd): Avoid shadowing names. Reported by Laine Stump. Signed-off-by: Eric Blake --- ChangeLog|6 ++ lib/passfd.c |8 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog ind

Re: [PATCH] mkstemp: replace if system version uses wrong permissions

2011-04-27 Thread Reuben Thomas
On 27 April 2011 16:33, Eric Blake wrote: > > Here's the final version I'd like to push.  It's modified a bit from > your version; are you okay with it still being in your name? Thanks very much for polishing and testing this patch; I don't mind if my name is still on it. -- http://rrt.sc3d.org

Re: [PATCH]: Change gnulib-tool to support NetBSD's join

2011-04-27 Thread Eric Blake
On 04/27/2011 09:23 AM, J.T. Conklin wrote: > For backwards compatibility, the 4.4BSD join used by NetBSD supports a > "-a" option as if it was "-a 1 -a 2". Unfortunately, this was done in > such a way that "-a 1" and "-a 2" need to be passed as "-a1" or "-a2". Thanks. That's a violation of POSI

Re: [PATCHv2 4/9] save-cwd: reduce dependency

2011-04-27 Thread Jim Meyering
Eric Blake wrote: > On 04/27/2011 01:37 AM, Jim Meyering wrote: >> Eric Blake wrote: >>> save-cwd needs either a working fchdir or a working getcwd(NULL). >>> The only platform where getcwd fixes problems not solved by >>> getcwd-lgpl is Linux, but fchdir works there. >>> >> Hi Eric, >> >> Unfortun

parse-datetime.y & ISO8601 timestamps

2011-04-27 Thread J.T. Conklin
First some background. The continuous integration build framework I maintain at work uses timestamp files for "last_build", "last_success", etc. The contents of each file is the timestamp in ISO 8601 format (the inode mtime is set to the same value, but thats besides the point). I used this fo

[PATCH]: Change gnulib-tool to support NetBSD's join

2011-04-27 Thread J.T. Conklin
For backwards compatibility, the 4.4BSD join used by NetBSD supports a "-a" option as if it was "-a 1 -a 2". Unfortunately, this was done in such a way that "-a 1" and "-a 2" need to be passed as "-a1" or "-a2". --- ChangeLog |5 + gnulib-tool |2 +- 2 files changed, 6 insertions(

[PATCH] mkstemp: replace if system version uses wrong permissions

2011-04-27 Thread Eric Blake
From: Reuben Thomas * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Add test for non-owner read/write mode bits set in file created by mkstemp. * doc/posix-functions/mkstemp.texi (mkstemp): Document the fix. Signed-off-by: Eric Blake --- Here's the final version I'd like to push. It's modified a bit from

Re: mkstemp

2011-04-27 Thread Reuben Thomas
On 27 April 2011 15:17, Eric Blake wrote: > > Can you convince your mailer to send patches inline, or at least with > text/plain MIME type? I think my only options are to rename the patch file (which will change the mailer's diagnosed MIME type) or to manually paste the patch into the body of the

Re: mkstemp

2011-04-27 Thread Eric Blake
On 04/27/2011 07:52 AM, Reuben Thomas wrote: > On 27 April 2011 14:00, Eric Blake wrote: >> On 04/27/2011 04:05 AM, Reuben Thomas wrote: >>> On 27 April 2011 03:24, Bruno Haible wrote: > Does setting a 0600 umask (as glibc does) sound like a good thing to > add to the mkstemp-safer functi

Re: mkstemp

2011-04-27 Thread Eric Blake
On 04/27/2011 07:32 AM, Reuben Thomas wrote: > On 27 April 2011 14:00, Eric Blake wrote: >> On 04/27/2011 04:05 AM, Reuben Thomas wrote: >> >>> However, this suggests that the gnulib documentation for mkstemp >>> should direct the programmer to clean-temp, something like: >>> >>> "If you are creat

Re: mkstemp

2011-04-27 Thread Reuben Thomas
On 27 April 2011 14:00, Eric Blake wrote: > On 04/27/2011 04:05 AM, Reuben Thomas wrote: >> On 27 April 2011 03:24, Bruno Haible wrote: Does setting a 0600 umask (as glibc does) sound like a good thing to add to the mkstemp-safer functions? > > Setting umask() is bad for other reasons -

Re: mkstemp

2011-04-27 Thread Reuben Thomas
On 27 April 2011 14:00, Eric Blake wrote: > On 04/27/2011 04:05 AM, Reuben Thomas wrote: > >> However, this suggests that the gnulib documentation for mkstemp >> should direct the programmer to clean-temp, something like: >> >> "If you are creating temporary files which will later be removed, cons

Re: mkstemp

2011-04-27 Thread Eric Blake
On 04/27/2011 04:05 AM, Reuben Thomas wrote: > On 27 April 2011 03:24, Bruno Haible wrote: >>> Does setting a 0600 umask (as glibc does) sound like a good thing to >>> add to the mkstemp-safer functions? Setting umask() is bad for other reasons - it is global state, and should not be done in mult

Re: [PATCHv2 4/9] save-cwd: reduce dependency

2011-04-27 Thread Eric Blake
On 04/27/2011 01:37 AM, Jim Meyering wrote: > Eric Blake wrote: >> save-cwd needs either a working fchdir or a working getcwd(NULL). >> The only platform where getcwd fixes problems not solved by >> getcwd-lgpl is Linux, but fchdir works there. >> > Hi Eric, > > Unfortunately, that change would in

Re: mkstemp

2011-04-27 Thread Reuben Thomas
On 27 April 2011 03:24, Bruno Haible wrote: >> Does setting a 0600 umask (as glibc does) sound like a good thing to >> add to the mkstemp-safer functions? > > The application can call chmod() on its own. Why push this > into mkstemp-safer? I'm not suggesting chmod (that would surely create a race

Re: [PATCH 1/2] hash, mgetgroups: drop xalloc dependency

2011-04-27 Thread Bruno Haible
Eric Blake wrote: > * modules/xgetgroups: New file, split from... > * modules/mgetgroups: ...here. A NEWS entry should explain this backward incompatible change. And coreutils/bootstrap.conf will need an update. Bruno

Re: [PATCHv2 4/9] save-cwd: reduce dependency

2011-04-27 Thread Jim Meyering
Eric Blake wrote: > save-cwd needs either a working fchdir or a working getcwd(NULL). > The only platform where getcwd fixes problems not solved by > getcwd-lgpl is Linux, but fchdir works there. > > * modules/save-cwd (Depends-on): Use getcwd-lgpl. > > Signed-off-by: Eric Blake > --- > ChangeLog