Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Jim Meyering
Bruno Haible wrote: > Jim Meyering wrote: >> fail=0; >> -test-pread || fail=1 >> +echo abc | test-pread || fail=1 > > When I execute it step by step, on Linux (openSUSE 11.0, bash 3.2.1), I get an > error message on stderr: > > $ bash > $ : ${srcdir=.} > $ . $srcdir/init.sh --set-path=. > $ fail=0

Re: doc update

2009-11-25 Thread Simon Josefsson
Bruno Haible writes: > Simon Josefsson wrote: >> The problem with this approach is that people will have only negative >> information to decide when it would make sense to use a >> gnulib-replacement module for a function, to deal with the platform that >> doesn't yet implement it. >> >> Persona

Re: doc update

2009-11-25 Thread Simon Josefsson
Eric Blake writes: > Simon Josefsson josefsson.org> writes: > >> Personally, I think that if glibc, Mac OS X, cygwin and maybe Solaris > > Any of the BSDs? For example, FreeBSD is finally starting to provide all of > the POSIX *at interfaces, even faster than Solaris (even though it was > Sol

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 11/25/2009 3:49 PM: > When I write > echo abc 2>/dev/null | test-pread > the error message also goes away. Or we could also patch test-pread.c to consume 4 bytes from stdin, after completing the test for ESPIPE. - -- Do

Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests

2009-11-25 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 11/25/2009 3:24 PM: > + # Note that these commands are executed in a subdirectory, therefore you > + # need to prepend "../" to relative filenames in the build dir. > + # Set the exit code 0 for success, 77 for skippe

Re: doc update

2009-11-25 Thread Bruno Haible
Simon Josefsson wrote: > The problem with this approach is that people will have only negative > information to decide when it would make sense to use a > gnulib-replacement module for a function, to deal with the platform that > doesn't yet implement it. > > Personally, I think that if glibc, Mac

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Bruno Haible
Jim Meyering wrote: > fail=0; > -test-pread || fail=1 > +echo abc | test-pread || fail=1 When I execute it step by step, on Linux (openSUSE 11.0, bash 3.2.1), I get an error message on stderr: $ bash $ : ${srcdir=.} $ . $srcdir/init.sh --set-path=. $ fail=0; $ echo abc | test-pread || fail=1 bas

Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests

2009-11-25 Thread Bruno Haible
Hi Jim, > I want to use something like this for each of the tests I own ... > ... > I'll post some examples of using this new framework later today. One of the most important aspects of unit tests is that users are able to 1. execute a single test, rather than all tests, 2. single step throug

Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests

2009-11-25 Thread Bruno Haible
Hi Jim, > +test -f $srcdir/init.cfg \ > + && . $srcdir/init.cfg Directory names containing spaces are not so uncommon, especially on Cygwin. How about writing "$srcdir/init.cfg" ? Likewise in test-pread.sh. Bruno

Re: doc update

2009-11-25 Thread Eric Blake
Simon Josefsson josefsson.org> writes: > Personally, I think that if glibc, Mac OS X, cygwin and maybe Solaris Any of the BSDs? For example, FreeBSD is finally starting to provide all of the POSIX *at interfaces, even faster than Solaris (even though it was Solaris that even started the idea

Re: doc update

2009-11-25 Thread Simon Josefsson
Ben Pfaff writes: > Simon Josefsson writes: > >> --- a/doc/glibc-functions/strtof_l.texi >> +++ b/doc/glibc-functions/strtof_l.texi >> @@ -11,6 +11,9 @@ Portability problems fixed by Gnulib: >> Portability problems not fixed by Gnulib: >> @itemize >> @item >> +This function is known to be pre

Re: doc update

2009-11-25 Thread Simon Josefsson
Eric Blake writes: > Simon Josefsson josefsson.org> writes: > >> >> My patch didn't illustrate my point correctly: my point was that, >> according to Bruno (and my checks), we do know that at least Mac OS X >> 10.5 implements the *_l functions, so arguable our documentation should >> say that.

Re: doc update

2009-11-25 Thread Ben Pfaff
Simon Josefsson writes: > --- a/doc/glibc-functions/strtof_l.texi > +++ b/doc/glibc-functions/strtof_l.texi > @@ -11,6 +11,9 @@ Portability problems fixed by Gnulib: > Portability problems not fixed by Gnulib: > @itemize > @item > +This function is known to be present on all glibc platforms an

Re: doc update

2009-11-25 Thread Eric Blake
Simon Josefsson josefsson.org> writes: > > My patch didn't illustrate my point correctly: my point was that, > according to Bruno (and my checks), we do know that at least Mac OS X > 10.5 implements the *_l functions, so arguable our documentation should > say that. I still think that's overkil

Re: doc update

2009-11-25 Thread Simon Josefsson
Simon Josefsson writes: > I'm thinking of patches like this: That patch was against an old gnulib, this is what I am really thinking of: diff --git a/doc/glibc-functions/strtof_l.texi b/doc/glibc-functions/strtof_l.texi index 00e74c4..dab09a0 100644 --- a/doc/glibc-functions/strtof_l.texi +++

Re: doc update

2009-11-25 Thread Simon Josefsson
Eric Blake writes: > According to Simon Josefsson on 11/25/2009 2:43 AM: >> Bruno Haible writes: >> >>> This doc update considers that MacOS X 10.5 has most of the *_l functions >>> that >>> take a locale_t argument. >> ... >>> -This function is missing on all non-glibc platforms: >>> +This fu

Re: doc update

2009-11-25 Thread Simon Josefsson
Bruno Haible writes: > Simon Josefsson wrote: >> That is a bit open-ended, isn't it? > > Well, the list of remaining files with this wording is not too long. > And we will certainly be interested to know when some other platforms > implements the same function, because that means that the particu

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Jim Meyering
Eric Blake wrote: > Jim Meyering meyering.net> writes: > >> + off_t old_offset = __libc_lseek (fd, 0, SEEK_CUR); > >> +Depends-on: >> +unistd >> + > > Needs to depend on lseek, particularly since pread is replaced on mingw, and > mingw has an lseek bug with non-seekable files (like pipes). > > Pe

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Jim Meyering
Eric Blake wrote: > Jim Meyering meyering.net> writes: > >> + off_t old_offset = __libc_lseek (fd, 0, SEEK_CUR); > >> +Depends-on: >> +unistd >> + > > Needs to depend on lseek, particularly since pread is replaced on mingw, and > mingw has an lseek bug with non-seekable files (like pipes). Firs

Re: gettime.c:36: undefined reference to `clock_gettime'

2009-11-25 Thread Richard W.M. Jones
On Wed, Nov 25, 2009 at 04:54:21PM +, Richard W.M. Jones wrote: > Latest gnulib from git, Fedora 12 (64 bit) host: > > lib/libgnu.a(gettime.o): In function `gettime': > /home/rjones/d/libguestfs/daemon/lib/gettime.c:37: undefined reference to > `clock_gettime' False alarm - I was missing $(L

gettime.c:36: undefined reference to `clock_gettime'

2009-11-25 Thread Richard W.M. Jones
Latest gnulib from git, Fedora 12 (64 bit) host: lib/libgnu.a(gettime.o): In function `gettime': /home/rjones/d/libguestfs/daemon/lib/gettime.c:37: undefined reference to `clock_gettime' I spent a little bit of time trying to work out what you'd have to link against in order to get this symbol,

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Jim Meyering
Eric Blake wrote: > Jim Meyering meyering.net> writes: > >> + off_t old_offset = __libc_lseek (fd, 0, SEEK_CUR); > >> +Depends-on: >> +unistd >> + > > Needs to depend on lseek, particularly since pread is replaced on mingw, and > mingw has an lseek bug with non-seekable files (like pipes). > > P

pread, yet another tweak

2009-11-25 Thread Jim Meyering
Hi Rich, I'll push this shortly: diff --git a/lib/pread.c b/lib/pread.c index 632b914..7094ea7 100644 --- a/lib/pread.c +++ b/lib/pread.c @@ -23,6 +23,7 @@ #define __libc_lseek(f,o,w) lseek (f, o, w) #define __set_errno(Val) errno = (Val) +#define __libc_read(f,b,n) read (f, b, n) /* pread s

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Eric Blake
Jim Meyering meyering.net> writes: > + off_t old_offset = __libc_lseek (fd, 0, SEEK_CUR); > +Depends-on: > +unistd > + Needs to depend on lseek, particularly since pread is replaced on mingw, and mingw has an lseek bug with non-seekable files (like pipes). Perhaps test-pread.sh should also c

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Jim Meyering
Eric Blake wrote: > Richard W.M. Jones redhat.com> writes: >> I'm guessing the problem is void * vs char *, unless the off_t types >> also differ. > > The off_t types are fine. But the unistd.h header is indeed wrong; POSIX > requires void*. Thanks! This should fix it: >From 8def010e77c2bace539

Re: [PATCH 2/2] test pread (using the new init.sh framework)

2009-11-25 Thread Jim Meyering
Eric Blake wrote: > Jim Meyering meyering.net> writes: > >> +++ b/modules/pread-tests >> @@ -0,0 +1,14 @@ >> +Files: >> +tests/test-pread.c >> +tests/init.sh >> + > > Oops. I should have caught this, too. > > make[4]: *** No rule to make target `test-pread.sh', needed by `check-TESTS'. > Stop. >

Re: [PATCH 2/2] test pread (using the new init.sh framework)

2009-11-25 Thread Jim Meyering
Eric Blake wrote: > Jim Meyering meyering.net> writes: > >> #!/bin/sh >> : ${srcdir=.} ${builddir=.} > > According to the autoconf manual, $builddir is rigourously equal to '.', from > within autoconf-generated files (such as Makefile built from Makefile.in). I > can see keeping this line

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Eric Blake
Richard W.M. Jones redhat.com> writes: > I'm guessing the problem is void * vs char *, unless the off_t types > also differ. The off_t types are fine. But the unistd.h header is indeed wrong; POSIX requires void*. -- Eric Blake

Re: [PATCH 2/2] test pread (using the new init.sh framework)

2009-11-25 Thread Eric Blake
Jim Meyering meyering.net> writes: > +++ b/modules/pread-tests > @@ -0,0 +1,14 @@ > +Files: > +tests/test-pread.c > +tests/init.sh > + Oops. I should have caught this, too. make[4]: *** No rule to make target `test-pread.sh', needed by `check-TESTS'. Stop. You need to add tests/test-pread.s

Re: [PATCH 1/2] pread: new module

2009-11-25 Thread Richard W.M. Jones
I'm getting the following error when cross-compiling with --host=i686-pc-mingw32: make[4]: Entering directory `/home/rjones/d/libguestfs-mingw/daemon/lib' GENconfigmake.h CC pread.o pread.c:34: error: conflicting types for 'pread' ./unistd.h:705: note: previous declaration of

Re: vasnprintf and invalid format string

2009-11-25 Thread Bruno Haible
Eric Blake wrote: > So, it may be worth a mention in the docs that *printf behaves differently > on various platforms when given an invalid string (in the case of my > example string, both Solaris and glibc return success! rather than failing > with EINVAL, but with differing amounts and content of

Re: doc update

2009-11-25 Thread Bruno Haible
Simon Josefsson wrote: > That is a bit open-ended, isn't it? Well, the list of remaining files with this wording is not too long. And we will certainly be interested to know when some other platforms implements the same function, because that means that the particular function becomes more mainstr

Re: [PATCH 2/2] test pread (using the new init.sh framework)

2009-11-25 Thread Eric Blake
Jim Meyering meyering.net> writes: > #!/bin/sh > : ${srcdir=.} ${builddir=.} According to the autoconf manual, $builddir is rigourously equal to '.', from within autoconf-generated files (such as Makefile built from Makefile.in). I can see keeping this line so that you can run the scr

[PATCH 1/2] pread: new module

2009-11-25 Thread Jim Meyering
We needed pread in libguestfs, so I wrote this: >From f84e1a91fb3c43ba06567cbaeaf641135170d35a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 25 Nov 2009 14:33:30 +0100 Subject: [PATCH 1/2] pread: new module * modules/pread: New file. * lib/pread.c (pread): New file. * m4/pread.m4: Likew

[PATCH 2/2] test pread (using the new init.sh framework)

2009-11-25 Thread Jim Meyering
Notice how this tiny shell script drives the compiled program. There is no need to choose unique names from within the C code, nor even to clean up when done, since it's run from within a just-created directory that's removed upon completion of this single test. Also, there's no more need for the

[PATCH] tests/init.sh: new file to be used via most *.sh tests

2009-11-25 Thread Jim Meyering
I've pushed tests/init.sh, as yet unused. Obviously, this is just a proposal. I want to use something like this for each of the tests I own, because it makes it so easy to avoid conflicts: each test is run in its own directory, and there's no need to clean up afterwards, because that happens autom

utimens on older linux

2009-11-25 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 As discussed on coreutils; some Linux kernels support utimensat but not symlink timestamps. Now pushed. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9

Re: doc update

2009-11-25 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Simon Josefsson on 11/25/2009 2:43 AM: > Bruno Haible writes: > >> This doc update considers that MacOS X 10.5 has most of the *_l functions >> that >> take a locale_t argument. > ... >> -This function is missing on all non-glibc platfo

Re: vasnprintf and invalid format string

2009-11-25 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 11/25/2009 2:21 AM: >> On the cygwin list, it was pointed out that printf("%**s",1,"a","b") >> proceeds to try to print "b" with a field width of whatever the integer >> value of the pointer to "a" contained (or, in other w

[PATCH] regex: Fix fastmap for multibyte character ranges.

2009-11-25 Thread Paolo Bonzini
This is another bug in computing the fastmap. I had overlooked it when fixing the fastmap mess, because it usually does not happen with !_LIBC. However, it is there in that case too. The bug is that whenever we have a range at the beginning of the regex, the regex must be tested on any possible m

Re: doc update

2009-11-25 Thread Simon Josefsson
Bruno Haible writes: > This doc update considers that MacOS X 10.5 has most of the *_l functions that > take a locale_t argument. ... > -This function is missing on all non-glibc platforms: > +This function is missing on many platforms: > MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5

Re: version-etc not working with autoconf 2.61

2009-11-25 Thread Jim Meyering
Eric Blake wrote: > According to Jim Meyering on 11/22/2009 1:57 AM: >> Thanks for the patch. >> How about the following instead? >> Then, if some package is defining PACKAGE specially >> and expecting that value to be used here, it will still appear. > > I'd say go ahead and commit this. Done.

Re: vasnprintf and invalid format string

2009-11-25 Thread Bruno Haible
Hi Eric, > On the cygwin list, it was pointed out that printf("%**s",1,"a","b") > proceeds to try to print "b" with a field width of whatever the integer > value of the pointer to "a" contained (or, in other words, each additional > * consumes another vararg position off the stack). This quickly