Re: new module for temporary files in temporary directories

2006-07-06 Thread Paul Eggert
Ben Pfaff <[EMAIL PROTECTED]> writes:

> The issue at hand, as I understand it, is not even the general
> behavior of signals.  It is the behavior of fatal signals.  That
> is, a the program terminates without ever returning from the
> signal handler.  This is much simpler than the general problem

Yes, good point; it is simpler.  However, my impression is that the
new module's cleanup function is intended to be callable even from
non-fatal signal handlers, so I don't think we have the simpler case
here.  But for now let's concentrate on the simpler case.

> However, I believe that if the assignment in main were changed to
> the following, then the signal handler would be guaranteed to see
> 1 in x if the signal arrived in getchar;
> *(sig_atomic_t volatile *) &x = 1;

OK, so it sounds like your idea is that, if all accesses to an object
are via a volatile lvalue, then the object is volatile, even if it was
not originally defined to be a volatile object.  This idea has an
intuitive appeal, though I submit that it does not follow from the
standard; the standard does not explicitly specify or even suggest
this "all accesses" rule.

A problem I see with this idea is 6.7.3.(6), which says "An object
that has volatile-qualified type may be modified in ways unknown to
the implementation or have other unknown side effects."  So a volatile
object (I assume this is the same as "an object that has
volatile-qualified type" in your model?) can spontaneously change, for
reasons unknown to and outside the control of the program; this point
is underlined later in the paragraph.  But if all accesses to a
humdrum "static int x;" object are via volatile lvalues, and if that
means "x" is a volatile object, doesn't this also mean "x" might
spontaneously change?

One way out of this mess would be to say that we are making an extra
assumption, not present in the standard, that volatile objects do not
spontaneously change and that they have no unknown side effects.  To
some extent we must make this assumption anyway, or we'll get nowhere.
Still, 6.7.3.(6) makes it clear (at least to me) that "volatile" is
intended more for describing access to memory-mapped device registers,
and wasn't really intended for use in safe signal handling or
multithreading.

There is also the huge escape clause at the end of 6.7.3.(6): "What
constitutes an access to an object that has volatile-qualified type is
implementation-defined."  Ouch!  Talk about getting run over by an
express train!

Anyway, to get back to the original module, it seems to me that the
code actually is assuming something quite a bit different from what
'volatile' provides.  The code is attempting to do use loads and
stores as barriers to prevent the usual sorts of bugs with signal
handling.  But 'volatile' is not designed to handle this problem:
volatile accesses are not guaranteed to be atomic.

There has been quite a bit of effort in the C++ community recently to
add support for atomic operations; see the cpp-threads mailing list
.  The latest
proposal is H.-J. Boehm's WG21/N2047 J16/06-0117

(2006-06-24).  It contains a C API, and indicates the sort of problems
that people run into with real hardware (albeit not limiting
themselves to signal-handler problems), but this stuff is still very
much in a state of flux.


> Perhaps all this is moot because Bruno's
> module does not actually contain any casts to volatile.

But the module contains casts to types like "struct tempdir * volatile *",
e.g.:

  struct tempdir * volatile *new_array =
(struct tempdir * volatile *)
xmalloc (new_allocated * sizeof (struct tempdir * volatile));

and this raises the issue we've been talking about (what I've been
calling "volatile objects" versus "volatile lvalues").  And the point
wouldn't be moot even if the module had no casts, because you can
convert e.g., "void *" to "int volatile *" in C without a cast.  My
example in

relies on this sort of thing: it has no casts but does have the problem.




Re: AC_HEADER_STDC

2006-07-06 Thread Ralf Wildenhues
Hello Paul,

Some nits below.

* Paul Eggert wrote on Thu, Jul 06, 2006 at 01:44:03AM CEST:
>
> Index: lib/getusershell.c
> ===
> RCS file: /cvsroot/gnulib/gnulib/lib/getusershell.c,v
> retrieving revision 1.22
> diff -p -u -r1.22 getusershell.c
> --- lib/getusershell.c23 Sep 2005 04:15:13 -  1.22
> +++ lib/getusershell.c5 Jul 2006 23:33:38 -

> @@ -152,14 +144,14 @@ readname (char **name, size_t *size, FIL
>size_t name_index = 0;
>  
>/* Skip blank space.  */
> -  while ((c = getc (stream)) != EOF && ISSPACE (c))
> +  while ((c = getc (stream)) != EOF && isspace (c))

missing cast to unsigned char (c is int).

>  /* Do nothing. */ ;
>  
>for (;;)
>  {
>if (*size <= name_index)
>   *name = x2nrealloc (*name, size, sizeof **name);
> -  if (c == EOF || ISSPACE (c))
> +  if (c == EOF || isspace (c))

Likewise.

>   break;
>(*name)[name_index++] = c;
>c = getc (stream);


> Index: lib/strtod.c
> ===
> RCS file: /cvsroot/gnulib/gnulib/lib/strtod.c,v
> retrieving revision 1.19
> diff -p -u -r1.19 strtod.c
> --- lib/strtod.c  17 Jun 2006 19:29:36 -  1.19
> +++ lib/strtod.c  5 Jul 2006 23:33:38 -

> @@ -111,7 +101,7 @@ strtod (const char *nptr, char **endptr)
>if (!got_digit)
>  goto noconv;
>  
> -  if (TOLOWER (*s) == 'e')
> +  if (tolower (*s) == 'e')

s is of type 'const char *'.  So this needs a cast to unsigned char as
well, IIRC.

>  {
>/* Get the exponent specified after the `e' or `E'.  */
>int save = errno;

Cheers,
Ralf




Re: AC_HEADER_STDC

2006-07-06 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Ralf Wildenhues on 7/6/2006 1:48 AM:
> Hello Paul,
> 
> Some nits below.
> 
> * Paul Eggert wrote on Thu, Jul 06, 2006 at 01:44:03AM CEST:
>> Index: lib/getusershell.c
>> ===
>> RCS file: /cvsroot/gnulib/gnulib/lib/getusershell.c,v
>> retrieving revision 1.22
>> diff -p -u -r1.22 getusershell.c
>> --- lib/getusershell.c   23 Sep 2005 04:15:13 -  1.22
>> +++ lib/getusershell.c   5 Jul 2006 23:33:38 -
> 
>> @@ -152,14 +144,14 @@ readname (char **name, size_t *size, FIL
>>size_t name_index = 0;
>>  
>>/* Skip blank space.  */
>> -  while ((c = getc (stream)) != EOF && ISSPACE (c))
>> +  while ((c = getc (stream)) != EOF && isspace (c))
> 
> missing cast to unsigned char (c is int).

getc is guaranteed to return an int that is in the range acceptable by
isspace.  No cast needed here, if I understand correctly.

>> +++ lib/strtod.c 5 Jul 2006 23:33:38 -
> 
>> @@ -111,7 +101,7 @@ strtod (const char *nptr, char **endptr)
>>if (!got_digit)
>>  goto noconv;
>>  
>> -  if (TOLOWER (*s) == 'e')
>> +  if (tolower (*s) == 'e')
> 
> s is of type 'const char *'.  So this needs a cast to unsigned char as
> well, IIRC.

You are right, here.  tolower of plain char is undefined if char is signed.

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFErQFC84KuGfSFAYARAgLWAJ0eBTfoWlnbZdL62IFrXMF5xvAxHgCdH6Zk
Y2WeLhFx4dtpi7VnD0pfEMc=
=y0Ei
-END PGP SIGNATURE-




Re: AC_HEADER_STDC

2006-07-06 Thread Bruno Haible
Ralf Wildenhues wrote:
> > -  while ((c = getc (stream)) != EOF && ISSPACE (c))
> > +  while ((c = getc (stream)) != EOF && isspace (c))
> 
> missing cast to unsigned char (c is int).

getc returns either EOF or a value in the range 0..UCHAR_MAX. The
assignment to 'int c' doesn't change this value. Therefore I don't
think there is a problem here.

> > Index: lib/strtod.c
> > ===
> > RCS file: /cvsroot/gnulib/gnulib/lib/strtod.c,v
> > retrieving revision 1.19
> > diff -p -u -r1.19 strtod.c
> > --- lib/strtod.c17 Jun 2006 19:29:36 -  1.19
> > +++ lib/strtod.c5 Jul 2006 23:33:38 -
> 
> > @@ -111,7 +101,7 @@ strtod (const char *nptr, char **endptr)
> >if (!got_digit)
> >  goto noconv;
> >  
> > -  if (TOLOWER (*s) == 'e')
> > +  if (tolower (*s) == 'e')
> 
> s is of type 'const char *'.  So this needs a cast to unsigned char as
> well, IIRC.

Yup, here a cast is missing. (glibc doesn't need it because its
is* and to* functions work also on values -128..-1. But gnulib needs it.)

Bruno




Re: AC_HEADER_STDC

2006-07-06 Thread Bruno Haible
Paul Eggert wrote:
> memcasecmp.c assumes UCHAR_MAX <= INT_MAX, which is not portable in
> general

Huh? On a system where 'unsigned char' and 'int' have the same number
of bits, the getc() and fgetc() result EOF would be ambiguous: it could
be EOF or it could be a casted 'unsigned char' value. It sounds very
improbable that such a system exists, now or in the future.

>   * m4/getusershell.m4 (gl_PREREQ_GETUSERSHELL): Remove; no longer needed.
>   All uses removed.
>   * m4/strtol.m4 (gl_PREREQ_STRTOL): Likewise.
>   * m4/strtoul.m4 (gl_PREREQ_STRTOUL): Likewise.

I find it more maintainable to keep these macros, even when they are
currently no-ops. Such as in m4/rename.m4. This eases things when some
changes are made later to the lib/*.c file. Not having the distinction
between the macro which tests whether a replacement function is needed
and the macro which prepares for the replacement function itself is
something that was confusing in the beginnings of gnulib, years ago.

Your mileage may vary, of course.

Bruno




Re: Windows fixes for sockpfaf

2006-07-06 Thread Simon Josefsson
Eric Blake <[EMAIL PROTECTED]> writes:

> Both patches installed, as proposed.

Thanks!

>> However, I'm not sure this is the Right Thing.  Why doesn't it work to
>> include winsock2.h under cygwin?  I.e., what's in your config.log when
>> the above happen?
>
> On cygwin, you have a choice for socket implementations.  Either you
> use POSIX sockets, in which case you should never include winsock2.h
> because POSIX doesn't specify it.  Or you use winsock (which makes
> your application unportable), and you should never use sys/socket.h
> since Windows doesn't provide it.  The cygwin headers are hard-coded
> to reject inclusion of both methods, because they are vastly
> incompatible.  However, the cygwin community tends to frown on
> including winsock, because then your application can only be used in
> cygwin, as opposed to porting to arbitrary POSIX-like platforms.

Ok, thanks, that's a good summary of things.

I don't have a patch that I believe would improve the situation, so
let's leave it as-is.

>> Maybe there should be a USE_NATIVE_WIN32 define, which could be a
>> configure-time parameter, i.e. --enable-native-win32, that toggles
>> whether it should try to include winsock2.h etc or not.
>
> Maybe, but since the cygwin community tends to frown on raw usage of
> winsock as being nonportable, it probably won't be used.  It's much
> easier if on cygwin, you pretend that winsock2.h doesn't even exist,
> and stick with the POSIX way of doing sockets.

Right.

>> I'm worried that the logic you are proposing will break if MinGW will
>> get a sys/socket.h at some time.
>
> Valid point, although as long as we filter all .m4 tests of
> sys/socket through gl_HEADER_SYS_SOCKET, we will only have one point
> to update if our current approach breaks.  I don't follow mingw
> closely enough to know if this is ever likely to happen, but I would
> argue that we don't need to worry about it unless it does happen.

Yup.

I installed the patch below, to have one canonical module for
sockpfaf.m4.

2006-07-06  Simon Josefsson  <[EMAIL PROTECTED]>

* modules/sys_socket (Files): Add m4/sockpfaf.m4 (this module is
now the canonical place for the M4 file).

* modules/getaddrinfo (Files): Remove m4/sockpfaf.m4, we get it
from the sys_socket dependency now.

* modules/inet_pton (Files): Ditto.

* modules/inet_ntop (Files): Ditto.

Index: modules/getaddrinfo
===
RCS file: /sources/gnulib/gnulib/modules/getaddrinfo,v
retrieving revision 1.8
diff -u -p -r1.8 getaddrinfo
--- modules/getaddrinfo 5 Jul 2006 18:10:56 -   1.8
+++ modules/getaddrinfo 6 Jul 2006 13:51:35 -
@@ -6,7 +6,6 @@ lib/getaddrinfo.h
 lib/getaddrinfo.c
 lib/gai_strerror.c
 m4/getaddrinfo.m4
-m4/sockpfaf.m4
 
 Depends-on:
 restrict
Index: modules/inet_pton
===
RCS file: /sources/gnulib/gnulib/modules/inet_pton,v
retrieving revision 1.1
diff -u -p -r1.1 inet_pton
--- modules/inet_pton   21 Jun 2006 09:59:49 -  1.1
+++ modules/inet_pton   6 Jul 2006 13:51:35 -
@@ -5,7 +5,6 @@ Files:
 lib/inet_pton.h
 lib/inet_pton.c
 m4/inet_pton.m4
-m4/sockpfaf.m4
 
 Depends-on:
 restrict
Index: modules/inet_ntop
===
RCS file: /sources/gnulib/gnulib/modules/inet_ntop,v
retrieving revision 1.4
diff -u -p -r1.4 inet_ntop
--- modules/inet_ntop   20 Jan 2006 12:59:10 -  1.4
+++ modules/inet_ntop   6 Jul 2006 13:51:35 -
@@ -5,7 +5,6 @@ Files:
 lib/inet_ntop.h
 lib/inet_ntop.c
 m4/inet_ntop.m4
-m4/sockpfaf.m4
 
 Depends-on:
 restrict
Index: modules/sys_socket
===
RCS file: /sources/gnulib/gnulib/modules/sys_socket,v
retrieving revision 1.3
diff -u -p -r1.3 sys_socket
--- modules/sys_socket  23 Jun 2006 19:27:17 -  1.3
+++ modules/sys_socket  6 Jul 2006 13:51:35 -
@@ -4,6 +4,7 @@ A  for systems lacking it.
 Files:
 lib/socket_.h
 m4/sys_socket_h.m4
+m4/sockpfaf.m4
 
 Depends-on:
 




Re: cycle-check.h fix imported from coreutils

2006-07-06 Thread Ralf Wildenhues
* Paul Eggert wrote on Tue, Jul 04, 2006 at 09:43:44AM CEST:
> "Mark D. Baushke" <[EMAIL PROTECTED]> writes:
> 
> > -lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h
> > +lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h same-inode.h
> 
> Thanks for catching that; I installed it.

This should not be necessary:
$ automake  # in a test tree
| lib/Makefile.am:16: automatically discovered file `same-inode.h' should not 
be explicitly mentioned

Which Automake version are you using that you need this, Mark?

Cheers,
Ralf




AH_VERBATIM missing 2nd arg (was: OS/2 and stdarg module)

2006-07-06 Thread Ralf Wildenhues
* Bruno Haible wrote on Tue, Jul 04, 2006 at 06:55:08PM CEST:
> Eric Blake wrote:
> > Meanwhile, is it worth patching autoconf/lib/autoheader.m4 to complain when
> > $2 of AH_VERBATIM is empty, so this mistake is less likely to occur in the
> > future?
> 
> This would be welcome. Something like this (untested)?

>   #
>   # Quote for Perl '' strings, which are those used by Autoheader.
>   m4_define([AH_VERBATIM],
> ! [m4_ifval([$1],
> ![AS_LITERAL_IF([$1],
> !   [AH_OUTPUT([$1], AS_ESCAPE([[$2]], [\\'']))])],
> ![AS_WARN([AH_VERBATIM invoked with only one argument])])
>   ])

Hmm.  Besides the typo (warn for empty $1 instead of $2), this warning
is for the developer, to be issued at 'autoconf' execution time, not
configure run time, so it should use m4_warning, or maybe even better
AC_WARNING.  But I wonder a bit whether some code makes use of this
"feature" that
   AH_VERBATIM([key], [some code])
   dnl ...
   AH_VERBATIM([key], []) # no code

happens to not output the code.  Thoughts?

Cheers,
Ralf

* autoconf/lib/autoheader.m4 (AH_VERBATIM): Warn about empty
second argument.  Reported by Eric Blake and Bruno Haible.

Index: lib/autoconf/autoheader.m4
===
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/autoheader.m4,v
retrieving revision 1.7
diff -u -r1.7 autoheader.m4
--- lib/autoconf/autoheader.m4  14 May 2005 07:00:39 -  1.7
+++ lib/autoconf/autoheader.m4  6 Jul 2006 16:20:08 -
@@ -67,8 +67,10 @@
 #
 # Quote for Perl '' strings, which are those used by Autoheader.
 m4_define([AH_VERBATIM],
-[AS_LITERAL_IF([$1],
-  [AH_OUTPUT([$1], AS_ESCAPE([[$2]], [\\'']))])
+[m4_ifval([$2],
+  [AS_LITERAL_IF([$1],
+[AH_OUTPUT([$1], AS_ESCAPE([[$2]], [\\'']))])],
+  [AC_WARNING([AH_VERBATIM invoked with only one argument])])
 ])
 
 




Re: AC_HEADER_STDC

2006-07-06 Thread Ralf Wildenhues
* Bruno Haible wrote on Thu, Jul 06, 2006 at 02:51:10PM CEST:
> Paul Eggert wrote:
> 
> > * m4/getusershell.m4 (gl_PREREQ_GETUSERSHELL): Remove; no longer needed.
> > All uses removed.
> > * m4/strtol.m4 (gl_PREREQ_STRTOL): Likewise.
> > * m4/strtoul.m4 (gl_PREREQ_STRTOUL): Likewise.
> 
> I find it more maintainable to keep these macros, even when they are
> currently no-ops. Such as in m4/rename.m4. This eases things when some
> changes are made later to the lib/*.c file. Not having the distinction
> between the macro which tests whether a replacement function is needed
> and the macro which prepares for the replacement function itself is
> something that was confusing in the beginnings of gnulib, years ago.

To add to this, currently, modules/getusershell also still lists
| configure.ac:
| gl_PREREQ_GETUSERSHELL

This is wrong (and it shows as bogus output when testing this module).
But wasn't it wrong before and should have been this in the first place?

Cheers,
Ralf

* modules/getusershell: Add gl_FUNC_GETUSERSHELL to
configure.ac.

Index: modules/getusershell
===
RCS file: /cvsroot/gnulib/gnulib/modules/getusershell,v
retrieving revision 1.6
diff -u -r1.6 getusershell
--- modules/getusershell2 May 2005 07:00:50 -   1.6
+++ modules/getusershell6 Jul 2006 16:53:08 -
@@ -10,7 +10,7 @@
 xalloc
 
 configure.ac:
-gl_PREREQ_GETUSERSHELL
+gl_FUNC_GETUSERSHELL
 
 Makefile.am:
 




Re: AC_HEADER_STDC

2006-07-06 Thread Ralf Wildenhues
Hello Eric, Bruno,

* Eric Blake wrote on Thu, Jul 06, 2006 at 02:25:38PM CEST:
> According to Ralf Wildenhues on 7/6/2006 1:48 AM:
> > * Paul Eggert wrote on Thu, Jul 06, 2006 at 01:44:03AM CEST:

> >> -  while ((c = getc (stream)) != EOF && ISSPACE (c))
> >> +  while ((c = getc (stream)) != EOF && isspace (c))
> > 
> > missing cast to unsigned char (c is int).
> 
> getc is guaranteed to return an int that is in the range acceptable by
> isspace.  No cast needed here, if I understand correctly.

Oh yes, right.  Thanks for correcting me on this, also to Bruno.  So the
remaining issue would be fixed by the patch below.  I've applied that.

Cheers,
Ralf

* strtod.c (strtod): cast the argument of tolower to unsigned char.

Index: lib/strtod.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/strtod.c,v
retrieving revision 1.20
diff -u -r1.20 strtod.c
--- lib/strtod.c5 Jul 2006 23:35:19 -   1.20
+++ lib/strtod.c6 Jul 2006 17:23:11 -
@@ -101,7 +101,7 @@
   if (!got_digit)
 goto noconv;
 
-  if (tolower (*s) == 'e')
+  if (tolower ((unsigned char) *s) == 'e')
 {
   /* Get the exponent specified after the `e' or `E'.  */
   int save = errno;




Re: cycle-check.h fix imported from coreutils

2006-07-06 Thread Mark D. Baushke
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ralf Wildenhues <[EMAIL PROTECTED]> writes:

> * Paul Eggert wrote on Tue, Jul 04, 2006 at 09:43:44AM CEST:
> > "Mark D. Baushke" <[EMAIL PROTECTED]> writes:
> > 
> > > -lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h
> > > +lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h same-inode.h
> > 
> > Thanks for catching that; I installed it.
> 
> This should not be necessary:
> $ automake  # in a test tree
> | lib/Makefile.am:16: automatically discovered file `same-inode.h' should not 
> be explicitly mentioned
> 
> Which Automake version are you using that you need this, Mark?

automake 1.9.6 and autoconf 2.60

My problem is that if it is not in lib_SOURCES, then my 'make dist' does
not find the same-inode.h to include it unless I add the file to
EXTRA_DIST explicitly.

It may be I have done something wrong. If so, your aid in such discovery
would be appreciated. This is with the CVS project
(https://savannah.nongnu.org/projects/cvs/)

Thanks,
-- Mark
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQFErUj/Cg7APGsDnFERAqzXAKDp1H+7u2sAq5WcalSwW8AdvnF9XgCeMDOb
TFNHjoYuj5VQJ8eMaunmvnQ=
=VwiG
-END PGP SIGNATURE-




Re: AH_VERBATIM missing 2nd arg

2006-07-06 Thread Paul Eggert
Ralf Wildenhues <[EMAIL PROTECTED]> writes:

> But I wonder a bit whether some code makes use of this
> "feature" that
>AH_VERBATIM([key], [some code])
>dnl ...
>AH_VERBATIM([key], []) # no code
>
> happens to not output the code.  Thoughts?

It might, but can't you use $# to distinguish that from a missing
argument?




Re: cycle-check.h fix imported from coreutils

2006-07-06 Thread Ralf Wildenhues
Hello Mark, everyone,

* Mark D. Baushke wrote on Thu, Jul 06, 2006 at 07:31:43PM CEST:
> Ralf Wildenhues <[EMAIL PROTECTED]> writes:
> > * Paul Eggert wrote on Tue, Jul 04, 2006 at 09:43:44AM CEST:
> > > "Mark D. Baushke" <[EMAIL PROTECTED]> writes:
> > > 
> > > > -lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h
> > > > +lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h same-inode.h
> > > 
> > > Thanks for catching that; I installed it.
> > 
> > This should not be necessary:
> > $ automake  # in a test tree
> > | lib/Makefile.am:16: automatically discovered file `same-inode.h' should 
> > not be explicitly mentioned

> My problem is that if it is not in lib_SOURCES, then my 'make dist' does
> not find the same-inode.h to include it unless I add the file to
> EXTRA_DIST explicitly.

Right.  The issue is different, and I was wrong:  same-inode.h is shared
("owned") by several modules.  Only one of them, the 'same' module, has
the file listed in AC_LIBSOURCES.  So whenever that is used in
conjunction with cycle-check (or mkdir-p, FWIW), automake will warn
(I got the warning with a test that has almost all modules listed)

> It may be I have done something wrong.

Nono.  But thanks for the pointer, the CVS source tree helped me
understand this.

Begs the question whether it is useful to split the header file out into
a module of its own, maybe named 'same-inode', and have the other two
depend on it instead of listing the header explicitly?

Completely untested rough patch below, listing Jim as maintainer of that
new module.  Thoughts?  Does this need addition to MODULES.html?

Cheers,
Ralf

* modules/same-inode: New module, comprising same-inode.h.
* modules/cycle-check: Depend on it, don't list same-inode.h.
* modules/mkdir-p, modules/same: Likewise.

Index: modules/cycle-check
===
RCS file: /cvsroot/gnulib/gnulib/modules/cycle-check,v
retrieving revision 1.5
diff -u -r1.5 cycle-check
--- modules/cycle-check 4 Jul 2006 07:43:15 -   1.5
+++ modules/cycle-check 6 Jul 2006 17:57:47 -
@@ -4,16 +4,16 @@
 Files:
 lib/cycle-check.c
 lib/cycle-check.h
-lib/same-inode.h
 lib/dev-ino.h
 
 Depends-on:
 stdbool
+same-inode
 
 configure.ac:
 
 Makefile.am:
-lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h same-inode.h
+lib_SOURCES += cycle-check.c cycle-check.h dev-ino.h
 
 Include:
 "cycle-check.h"
Index: modules/mkdir-p
===
RCS file: /cvsroot/gnulib/gnulib/modules/mkdir-p,v
retrieving revision 1.4
diff -u -r1.4 mkdir-p
--- modules/mkdir-p 3 Jul 2006 08:32:46 -   1.4
+++ modules/mkdir-p 6 Jul 2006 17:57:47 -
@@ -7,7 +7,6 @@
 lib/lchmod.h
 lib/mkdir-p.c
 lib/mkdir-p.h
-lib/same-inode.h
 m4/afs.m4
 m4/chdir-safer.m4
 m4/lchmod.m4
@@ -23,6 +22,7 @@
 quote
 stat-macros
 stdbool
+same-inode
 
 configure.ac:
 gl_MKDIR_PARENTS
Index: modules/same
===
RCS file: /cvsroot/gnulib/gnulib/modules/same,v
retrieving revision 1.7
diff -u -r1.7 same
--- modules/same3 Jul 2006 08:32:46 -   1.7
+++ modules/same6 Jul 2006 17:57:47 -
@@ -5,7 +5,6 @@
 Files:
 lib/same.h
 lib/same.c
-lib/same-inode.h
 m4/same.m4
 
 Depends-on:
@@ -13,6 +12,7 @@
 error
 dirname
 stdbool
+same-inode
 
 configure.ac:
 gl_SAME
--- /dev/null   1970-01-01 00:00:01.0 +0200
+++ modules/same-inode  2006-07-06 19:56:38.0 +0200
@@ -0,0 +1,19 @@
+Description:
+Determine whether two stat buffers refer to the same file.
+
+Files:
+lib/same-inode.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering




Re: cycle-check.h fix imported from coreutils

2006-07-06 Thread Ralf Wildenhues
* quoting myself:
>   * modules/same-inode: New module, comprising same-inode.h.
>   * modules/cycle-check: Depend on it, don't list same-inode.h.
>   * modules/mkdir-p, modules/same: Likewise.

Never mind this patch.  It needs either a bunch of m4/ updates to list
same-inode.h in AC_LIBSOURCES and dependencies or something along the
way...

Sorry,
Ralf




Re: cycle-check.h fix imported from coreutils

2006-07-06 Thread Jim Meyering
Ralf Wildenhues <[EMAIL PROTECTED]> wrote:
> * quoting myself:
>>  * modules/same-inode: New module, comprising same-inode.h.
>>  * modules/cycle-check: Depend on it, don't list same-inode.h.
>>  * modules/mkdir-p, modules/same: Likewise.
>
> Never mind this patch.  It needs either a bunch of m4/ updates to list
> same-inode.h in AC_LIBSOURCES and dependencies or something along the
> way...

I like the idea.  Do you plan to pursue it?

If you do, for starters, it'd help to include the .m4 file in the Files:
section and the m4 macro name in the configure.ac: section:

  Files:
  lib/same-inode.h
  m4/same-inode.m4

  configure.ac:
  gl_SAME_INODE




Re: AC_HEADER_STDC

2006-07-06 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes:

> On a system where 'unsigned char' and 'int' have the same number of
> bits, the getc() and fgetc() result EOF would be ambiguous: it could
> be EOF or it could be a casted 'unsigned char' value. It sounds very
> improbable that such a system exists, now or in the future.

They do exist.  Here's one example that I found with a quick Google search:

http://www.ecse.rpi.edu/courses/CStudio/Cal_lab/ADI_DSP/21K/INCLUDE/LIMITS.H

Typically they're DSPs, so they are freestanding implementations and
don't have getc.  If they did have getc, getc would probably return
something in the range -1..255 anyway, so there would be no ambiguity.

Admittedly these are unlikely platforms for coreutils, but they might
be used for something like GNU Radio.  Since it's an easy fix in this
particular case I thought I'd put it in (if only to save time for the
next guy who reads the code looking for integer-overflow issues :-).


>>  * m4/getusershell.m4 (gl_PREREQ_GETUSERSHELL): Remove; no longer needed.
>>  All uses removed.
>>  * m4/strtol.m4 (gl_PREREQ_STRTOL): Likewise.
>>  * m4/strtoul.m4 (gl_PREREQ_STRTOUL): Likewise.
>
> I find it more maintainable to keep these macros, even when they are
> currently no-ops. Such as in m4/rename.m4.

It's a close call.  I see your point, but on the other hand if they're
noops and are likely to remain noops I think it's a bit simpler to
omit them.  I do agree with you that we should try to retain the
distinction between the macro which tests whether a replacement
function is needed and the macro which prepares for the replacement
function itself.




Re: AC_HEADER_STDC

2006-07-06 Thread Paul Eggert
Ralf Wildenhues <[EMAIL PROTECTED]> writes:

>   * modules/getusershell: Add gl_FUNC_GETUSERSHELL to
>   configure.ac.

Thanks; I checked that in.




create a big test, collect the fallout

2006-07-06 Thread Ralf Wildenhues
One of the cheapest (ahem) ways to catch a number of gnulib bugs is to
create one tree with all modules and all tests in it.  If it works, that
is.  So I started doing this manually, again.  Here's some fallout on
the way to make
path/to/gnulib-tool --with-tests $l --dir=foo --megatest

work.  Apologies in advance for this being a huge blob.


0) I used Autoconf-2.60 and CVS Automake.  YMMV.  (I'll denote spots
   where things may need to be handled differently with older versions.)

1) $destdir may not contain slashes: gnulib-tool does `mkdir "$destdir"'
   to create it, and `cd "$destdir"; $cmds; cd ..' to enter/exit.

2) Outside the gnulib directory, the addition of `-tests' modules fails,
   thus limiting actual test exposure somewhat.  :-)

3) Not all instances of `build-aux' in ALL/tests/configure.ac are
   rewritten to `../build-aux'.

The following patch fixes (1)-(3).  OK to apply?
More below...

* gnulib-tool (Command-line option processing): Ensure that
$destdir contains no slash.
(func_get_tests_module): Make work outside the gnulib source
directory.
(func_create_testdir): Rewrite all occurrences of `build-aux'.

Index: gnulib-tool
===
RCS file: /cvsroot/gnulib/gnulib/gnulib-tool,v
retrieving revision 1.113
diff -u -r1.113 gnulib-tool
--- gnulib-tool 23 Jun 2006 19:27:17 -  1.113
+++ gnulib-tool 6 Jul 2006 20:39:45 -
@@ -431,6 +431,10 @@
 do_changelog=false
   fi
 
+  case $destdir in
+  */*) func_fatal_error "argument to --dir may not contain slashes" ;;
+  esac
+
   # Remove trailing slashes from the directory names. This is necessary for
   # m4base (to avoid an error in func_import) and optional for the others.
   sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
@@ -595,7 +599,7 @@
 func_get_tests_module ()
 {
   # The naming convention for tests modules is hardwired: ${module}-tests.
-  if test -f modules/"$1"-tests; then
+  if (cd "$gnulib_dir" && test -f modules/"$1"-tests); then
 echo "$1"-tests
   fi
 }
@@ -1611,17 +1616,13 @@
  else
echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
  fi
- if test "$auxdir" != "build-aux"; then
-   sed_replace_build_aux='
+ sed_replace_build_aux='
  :a
  /AC_CONFIG_FILES(.*:build-aux\/.*)/{

s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:../'"$auxdir"'/\2)|
ba
  }'
-   sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 
's/^ *//'`
- else
-   sed_replace_build_aux=
- fi
+ sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ 
*//'`
  # We don't have explicit ordering constraints between the various
  # autoconf snippets. It's cleanest to put those of the library before
  # those of the tests.



4) Documentation should not be copied into the source tree (bug in
   getdate module; I'm inferring from other modules here) or the
   gnulib-tool should 'mkdir doc' to avoid a cp failure.  OK?

* modules/getdate: Do not list doc/getdate.texi.

Index: modules/getdate
===
RCS file: /cvsroot/gnulib/gnulib/modules/getdate,v
retrieving revision 1.13
diff -u -r1.13 getdate
--- modules/getdate 12 May 2005 15:22:34 -  1.13
+++ modules/getdate 6 Jul 2006 20:18:43 -
@@ -2,7 +2,6 @@
 Convert a date/time string to linear time.
 
 Files:
-doc/getdate.texi
 lib/getdate.h
 lib/getdate.y
 m4/bison.m4



5) Autoconf's getloadavg (still) needs getloadavg.c, which it only finds
   if AC_CONFIG_LIBOBJ_DIR is set correctly.  This patch is Autoconf 2.60
   and CVS Automake only.  I'm showing it for completeness.
   (Dunno, maybe we should add
  m4_ifndef([AC_CONFIG_LIBOBJ_DIR],
[AC_DEFUN([AC_CONFIG_LIBOBJ_DIR])])
just so the configure.ac works with older Autoconf for all other
modules at least?)

Index: gnulib-tool
===
RCS file: /cvsroot/gnulib/gnulib/gnulib-tool,v
retrieving revision 1.113
diff -u -r1.113 gnulib-tool
--- gnulib-tool 23 Jun 2006 19:27:17 -  1.113
+++ gnulib-tool 6 Jul 2006 20:39:45 -
@@ -1585,6 +1589,7 @@
 (echo "# Process this file with autoconf to produce a configure script."
  echo "AC_INIT([dummy], [0])"
  echo "AC_CONFIG_AUX_DIR([../$auxdir])"
+ echo "AC_CONFIG_LIBOBJ_DIR([../lib])"
  echo "AM_INIT_AUTOMAKE"
  echo
  echo "AM_CONFIG_HEADER([config.h])"
@@ -1666,6 +1667,7 @@
if test "$auxdir" != "."; then
  echo "AC_CONFIG_AUX_DIR([$auxdir])"
fi
+   echo "AC_CONFIG_LIBOBJ_DIR([lib])"
echo "AM_INIT_AUTOMAKE"
echo
echo "AM_CONFIG_HEADER([config.h])"


6) I'd like a megatest that does not test each individual module but
   just all of them (I may be patient, but not _that_ patient ;-).
   Also I'd like failed checks to make the thingy fail, and 

Re: AC_HEADER_STDC

2006-07-06 Thread Paul Eggert
I found a few other glitches related to the AC_HEADER_STDC changes
while propagating them into coreutils, and installed the following
further patches.  Some of the problems predate the recent changes.
For example, the code wasn't portable to (theoretical?) C99
implementations that have an isblank function but not an isblank
macro.

2006-07-06  Paul Eggert  <[EMAIL PROTECTED]>

* lib/fnmatch.c (ISBLANK): Remove.  All uses changed to isblank.
(isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro.
(ISGRAPH): Remove.  All uses changed to isgraph.
(FOLD) [!defined _LIBC]: Remove special case.
* lib/getdate.y (lookup_word): Remove no-longer-needed call to islower.
* lib/regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not
HAVE_ISBLANK.
* lib/strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special 
case.

* m4/fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Don't check for getenv decl;
no longer needed.  Check for isblank decl.
* m4/mkstemp.m4 (gl_PREREQ_TEMPNAME): Don't check for getenv decl.
* m4/regex.m4 (gl_PREREQ_REGEX): Dheck for isblank decl instead
of existence.

Index: lib/backupfile.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/backupfile.c,v
retrieving revision 1.48
diff -p -u -r1.48 backupfile.c
--- lib/backupfile.c3 Jul 2006 08:32:46 -   1.48
+++ lib/backupfile.c6 Jul 2006 21:44:35 -
@@ -95,11 +95,11 @@
 #endif
 
 /* ISDIGIT differs from isdigit, as follows:
-   - Its arg may be any int or unsigned int; it need not be an unsigned char.
-   - It's guaranteed to evaluate its argument exactly once.
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+ or EOF.
- It's typically faster.
POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
-   ISDIGIT_LOCALE unless it's important to use the locale's definition
+   ISDIGIT unless it's important to use the locale's definition
of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
Index: lib/fnmatch.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch.c,v
retrieving revision 1.34
diff -p -u -r1.34 fnmatch.c
--- lib/fnmatch.c   5 Jul 2006 23:35:19 -   1.34
+++ lib/fnmatch.c   6 Jul 2006 21:44:35 -
@@ -86,15 +86,8 @@ extern int fnmatch (const char *pattern,
 #if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
 
 
-# ifdef isblank
-#  define ISBLANK(c) isblank (c)
-# else
-#  define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-# endif
-# ifdef isgraph
-#  define ISGRAPH(c) isgraph (c)
-# else
-#  define ISGRAPH(c) (isprint (c) && !isspace (c))
+# if ! (defined isblank || HAVE_DECL_ISBLANK)
+#  define isblank(c) ((c) == ' ' || (c) == '\t')
 # endif
 
 # define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
@@ -152,11 +145,7 @@ static int posixly_correct;
 # endif
 
 /* Note that this evaluates C many times.  */
-# ifdef _LIBC
-#  define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
-# else
-#  define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
-# endif
+# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
 # define CHAR  char
 # define UCHAR unsigned char
 # define INT   int
Index: lib/fnmatch_loop.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch_loop.c,v
retrieving revision 1.12
diff -p -u -r1.12 fnmatch_loop.c
--- lib/fnmatch_loop.c  5 Jul 2006 23:35:19 -   1.12
+++ lib/fnmatch_loop.c  6 Jul 2006 21:44:35 -
@@ -290,10 +290,10 @@ FCT (const CHAR *pattern, const CHAR *st
 #else
if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n))
|| (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n))
-   || (STREQ (str, L_("blank")) && ISBLANK ((UCHAR) *n))
+   || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n))
|| (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n))
|| (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n))
-   || (STREQ (str, L_("graph")) && ISGRAPH ((UCHAR) *n))
+   || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n))
|| (STREQ (str, L_("lower")) && islower ((UCHAR) *n))
|| (STREQ (str, L_("print")) && isprint ((UCHAR) *n))
|| (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n))
Index: lib/getdate.y
===
RCS file: /cvsroot/gnulib/gnulib/lib/getdate.y,v
retrieving revision 1.104
diff -p -u -r1.104 getdate.y
--- lib/getdate.y   5 Jul 2006 23:35:19 -   1.104
+++ lib/getdate.y   6 Jul 2006 21:44:35 -
@@ -70,8 +70,8 @@
 
 
 /* ISDIGIT differs fr

Re: create a big test, collect the fallout

2006-07-06 Thread Paul Eggert
Ralf Wildenhues <[EMAIL PROTECTED]> writes:

> 4) Documentation should not be copied into the source tree (bug in
>getdate module; I'm inferring from other modules here) or the
>gnulib-tool should 'mkdir doc' to avoid a cp failure.  OK?

My kneejerk reaction is I'd rather that gnulib-tool copied the
documentation correctly by default, or ignored the documentation on
user request.  I'd guess that most software that uses getdate should
document the date formats it accepts so I'd like to encourage
developers to include getdate.texi.


>   * m4/_inttypes_h.m4 (gl_INTTYPES_H): Use AC_CHECK_DECLS_ONCE
>   with only one argument.
>   * m4/fileblocks.m4 (gl_FILEBLOCKS): AC_CHECK_DECLS_ONCE may
>   expand to nothing, so add a shell command to avoid syntax error.
>   * m4/getpass.m4 (gl_FUNC_GETPASS): Likewise.

These look good, except the tradition is that the ":" should be put
into the PREREQ macros in case other callers run into the same
problem.  I installed the following.  Thanks.

2006-07-06  Ralf Wildenhues  <[EMAIL PROTECTED]>

* _inttypes_h.m4 (gl_INTTYPES_H): Use AC_CHECK_DECLS_ONCE
with only one argument, for Autoconf 2.60.
* fileblocks.m4 (gl_PREREQ_FILEBLOCKS): AC_CHECK_DECLS_ONCE may
expand to nothing, so add a shell command to avoid syntax error.
* getpass.m4 (gl_PREREQ_GETPASS): Likewise.

Index: m4/_inttypes_h.m4
===
RCS file: /cvsroot/gnulib/gnulib/m4/_inttypes_h.m4,v
retrieving revision 1.3
diff -p -u -r1.3 _inttypes_h.m4
--- m4/_inttypes_h.m4   4 Jul 2006 06:37:10 -   1.3
+++ m4/_inttypes_h.m4   6 Jul 2006 22:15:42 -
@@ -1,4 +1,4 @@
-# _inttypes_h.m4 serial 3
+# _inttypes_h.m4 serial 4
 dnl Copyright (C) 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,5 +12,6 @@ AC_LIBSOURCES([inttypes.h])
 if test $gl_cv_have_include_next = no; then
   gl_ABSOLUTE_HEADER([inttypes.h])
 fi
-AC_CHECK_DECLS_ONCE([strtoimax strtoumax])dnl
+AC_CHECK_DECLS_ONCE([strtoimax])dnl
+AC_CHECK_DECLS_ONCE([strtoumax])dnl
 ])
Index: m4/fileblocks.m4
===
RCS file: /cvsroot/gnulib/gnulib/m4/fileblocks.m4,v
retrieving revision 1.3
diff -p -u -r1.3 fileblocks.m4
--- m4/fileblocks.m423 Sep 2005 04:15:13 -  1.3
+++ m4/fileblocks.m46 Jul 2006 22:15:42 -
@@ -1,5 +1,5 @@
-# fileblocks.m4 serial 3
-dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+# fileblocks.m4 serial 4
+dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -16,4 +16,5 @@ AC_DEFUN([gl_FILEBLOCKS],
 # Prerequisites of lib/fileblocks.c.
 AC_DEFUN([gl_PREREQ_FILEBLOCKS], [
   AC_CHECK_HEADERS_ONCE(sys/param.h)
+  :
 ])
Index: m4/getpass.m4
===
RCS file: /cvsroot/gnulib/gnulib/m4/getpass.m4,v
retrieving revision 1.12
diff -p -u -r1.12 getpass.m4
--- m4/getpass.m4   20 Apr 2006 22:28:34 -  1.12
+++ m4/getpass.m4   6 Jul 2006 22:15:42 -
@@ -1,4 +1,4 @@
-# getpass.m4 serial 7
+# getpass.m4 serial 8
 dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -42,4 +42,5 @@ AC_DEFUN([gl_PREREQ_GETPASS], [
   AC_CHECK_DECLS_ONCE([fputs_unlocked])
   AC_CHECK_DECLS_ONCE([funlockfile])
   AC_CHECK_DECLS_ONCE([putc_unlocked])
+  :
 ])




Re: AC_HEADER_DIRENT

2006-07-06 Thread Paul Eggert
"Derek R. Price" <[EMAIL PROTECTED]> writes:

> Thanks, Bruno.  I've attached a patch that replaces all the references
> to AC_HEADER_DIRENT with calls to AC_CHECK_HEADERS_ONCE([dirent.h
> ndir.h]) and makes the accompanying changes in lib/*.  This patch does
> simplify, though not quite as much as I was originally hoping, since I
> had to leave in the  support for Windows.

Can the Windows guys supply a dirent.h substitute module?  That would
let you do the futher simplification.

> Is OpenVMS the only practical VMS target left?

Yes.  For now, let's remove the vmsdir.h stuff since I don't think
anybody uses it now.  If it's necessary the VMS guys can supply
a substitude dirent.h as well.

Also, we should use "__VMS" rather than "VMS" since the latter symbol
is no longer defined when compiling pedantically.

I found a few other opportunities for simplification and installed
the following.

Thanks.

2006-07-06  Paul Eggert  <[EMAIL PROTECTED]>

* lib/getloadavg.c: Use __VMS, not VMS.
* lib/getopt.c: Likewise.
* lib/getpagesize.h: Likewise.
* lib/glob.c: Remove most VMS cruft; it hasn't been tested for
a while and probably does not work.

2006-07-06  Derek R. Price  <[EMAIL PROTECTED]>
and Paul Eggert  <[EMAIL PROTECTED]>

* lib/backupfile.c [HAVE_DIRENT_H && ! HAVE_NDIR_H]:
Don't worry about this obsolete case any more.
(HAVE_DIR): Remove.  All uses removed; we now assume you can read
directories.
* lib/dirfd.h [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't
worry about this obsolete case any more.
* lib/fts.c: Likewise.
* lib/getcwd.c: Likewise.
* lib/glob.h: Likewise.
* lib/savedir.c: Likewise.

* m4/backupfile.m4 (gl_BACKUPFILE): Check for dirent.h, instead
of invoking obsolescent AC_HEADER_DIRENT macro.
* m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise.
* m4/d-type.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Likewise.
* m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise.
* m4/fts.m4 (gl_FUNC_FTS_CORE): Likewise.
* m4/getcwd.m4 (gl_PREREQ_GETCWD): Likewise.
* m4/glob.m4 (gl_PREREQ_GLOB): Likewise.
* m4/savedir.m4 (gl_SAVEDIR): Likewise.
* m4/readdir.m4: Remove; no longer needed.

Index: lib/backupfile.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/backupfile.c,v
retrieving revision 1.49
diff -p -u -r1.49 backupfile.c
--- lib/backupfile.c6 Jul 2006 21:51:29 -   1.49
+++ lib/backupfile.c6 Jul 2006 23:27:27 -
@@ -47,21 +47,7 @@
 #else
 # define dirent direct
 # define NLENGTH(direct) ((size_t) (direct)->d_namlen)
-# if HAVE_SYS_NDIR_H
-#  include 
-# endif
-# if HAVE_SYS_DIR_H
-#  include 
-# endif
-# if HAVE_NDIR_H
-#  include 
-# endif
-#endif
-
-#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H
-# define HAVE_DIR 1
-#else
-# define HAVE_DIR 0
+# include 
 #endif
 
 #if D_INO_IN_DIRENT
@@ -166,8 +152,6 @@ check_extension (char *file, size_t file
 }
 }
 
-#if HAVE_DIR
-
 /* Returned values for NUMBERED_BACKUP.  */
 
 enum numbered_backup_result
@@ -282,7 +266,6 @@ numbered_backup (char **buffer, size_t b
   *buffer = buf;
   return result;
 }
-#endif /* HAVE_DIR */
 
 /* Return the name of the new backup file for the existing file FILE,
allocated with malloc.  Report an error and fail if out of memory.
@@ -301,14 +284,13 @@ find_backup_file_name (char const *file,
   size_t simple_backup_suffix_size = strlen (simple_backup_suffix) + 1;
   size_t backup_suffix_size_guess = simple_backup_suffix_size;
   enum { GUESS = sizeof ".~12345~" };
-  if (HAVE_DIR && backup_suffix_size_guess < GUESS)
+  if (backup_suffix_size_guess < GUESS)
 backup_suffix_size_guess = GUESS;
 
   ssize = filelen + backup_suffix_size_guess + 1;
   s = xmalloc (ssize);
   memcpy (s, file, filelen + 1);
 
-#if HAVE_DIR
   if (backup_type != simple_backups)
 switch (numbered_backup (&s, ssize, filelen))
   {
@@ -323,7 +305,6 @@ find_backup_file_name (char const *file,
simple = (backup_type == numbered_existing_backups);
break;
   }
-#endif
 
   if (simple)
 memcpy (s + filelen, simple_backup_suffix, simple_backup_suffix_size);
Index: lib/dirfd.h
===
RCS file: /cvsroot/gnulib/gnulib/lib/dirfd.h,v
retrieving revision 1.6
diff -p -u -r1.6 dirfd.h
--- lib/dirfd.h 19 Sep 2005 17:28:14 -  1.6
+++ lib/dirfd.h 6 Jul 2006 23:27:27 -
@@ -1,5 +1,5 @@
 /* Declare dirfd, if necessary.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,18 +21,10 @@
 
 #if HAVE_DIRENT_H
 # include 
-#else /* not HAVE_DIRENT_H */
+#else
 

Re: create a big test, collect the fallout

2006-07-06 Thread Simon Josefsson
Paul Eggert <[EMAIL PROTECTED]> writes:

> Ralf Wildenhues <[EMAIL PROTECTED]> writes:
>
>> 4) Documentation should not be copied into the source tree (bug in
>>getdate module; I'm inferring from other modules here) or the
>>gnulib-tool should 'mkdir doc' to avoid a cp failure.  OK?
>
> My kneejerk reaction is I'd rather that gnulib-tool copied the
> documentation correctly by default, or ignored the documentation on
> user request.  I'd guess that most software that uses getdate should
> document the date formats it accepts so I'd like to encourage
> developers to include getdate.texi.

Shishi actually do @include getdate.texi in its manual, so please
don't install this part.

Otherwise, it seems to be good stuff, but I didn't look too carefully.
I'll see if I can fix the crc module, it is probably the same 64-bit
problem as in the md4 or md5 module a while ago.

/Simon




Re: create a big test, collect the fallout

2006-07-06 Thread Simon Josefsson
Simon Josefsson <[EMAIL PROTECTED]> writes:

> I'll see if I can fix the crc module, it is probably the same 64-bit
> problem as in the md4 or md5 module a while ago.

Nope, I think the self-test was created with an old buggy crc.c
implementation.  I've changed the test vector to be what the current
implementation returns.  Ralf, does it work better now?

/Simon




Re: create a big test, collect the fallout

2006-07-06 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Ralf Wildenhues on 7/6/2006 2:51 PM:
> 
> 1) $destdir may not contain slashes: gnulib-tool does `mkdir "$destdir"'
>to create it, and `cd "$destdir"; $cmds; cd ..' to enter/exit.

That also could run into problems if CDPATH is defined and does not start
with .

> +  case $destdir in
> +  */*) func_fatal_error "argument to --dir may not contain slashes" ;;
> +  esac

Should we also limit \?

> 4) Documentation should not be copied into the source tree (bug in
>getdate module; I'm inferring from other modules here) or the
>gnulib-tool should 'mkdir doc' to avoid a cp failure.  OK?

I would rather that documentation did get copied; but that sounds like we
need a --doc-base option to gnulib-tool.  Then it would be up to the
package maintainer whether they added @include getdate.texi to their
documentation.

> 
> 
> 6) I'd like a megatest that does not test each individual module but
>just all of them (I may be patient, but not _that_ patient ;-).
>Also I'd like failed checks to make the thingy fail, and configure to
>use a cache file whenever possible (due to the fact that the tests/
>directory uses a separate configure script, this is a large speedup).

I agree with the cache idea (we have had several caching bugs in the
past), as well as the quitting on failure.

> 
> 9) Autoconf-2.60's AC_CHECK_DECLS_ONCE has two semantic differences
>with the one from onceonly_2_57.m4:
>- it accepts only one argument (why BTW?  This looks like a bug;
>  I think it's been discussed here before, but don't remember the
>  details):

Actually, autoconf's version takes a comma-separated list.  I think the
intent was to allow checking for something like struct foo, which contains
space.  But the workaround compatible to both 2.59 and 2.60 was indeed
breaking the checks into multiple lines, one decl per check.

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFErbT084KuGfSFAYARAgQgAKDTD9yC6bFTrxIjnyOW2eVG6AjO+wCgsrUw
2+mjXuUx2ESLPRI6B3KOmmU=
=qQ7W
-END PGP SIGNATURE-




Re: new module for temporary files in temporary directories

2006-07-06 Thread Ben Pfaff
Paul Eggert <[EMAIL PROTECTED]> writes:

> Ben Pfaff <[EMAIL PROTECTED]> writes:
>
>> The issue at hand, as I understand it, is not even the general
>> behavior of signals.  It is the behavior of fatal signals.  That
>> is, a the program terminates without ever returning from the
>> signal handler.  This is much simpler than the general problem
>
> Yes, good point; it is simpler.  However, my impression is that the
> new module's cleanup function is intended to be callable even from
> non-fatal signal handlers, so I don't think we have the simpler case
> here.  But for now let's concentrate on the simpler case.

Is this a feature that Bruno will add later?  I don't see a way
to do it at the moment.

>> However, I believe that if the assignment in main were changed to
>> the following, then the signal handler would be guaranteed to see
>> 1 in x if the signal arrived in getchar;
>> *(sig_atomic_t volatile *) &x = 1;
>
> OK, so it sounds like your idea is that, if all accesses to an object
> are via a volatile lvalue, then the object is volatile, even if it was
> not originally defined to be a volatile object.  This idea has an
> intuitive appeal, though I submit that it does not follow from the
> standard; the standard does not explicitly specify or even suggest
> this "all accesses" rule.

I think I'm still not doing a good job of explanation.  My theory
is that any object may be accessed through a volatile lvalue and
receive volatile semantics *for that access* (rationale 6.7.3,
last paragraph).  An object *defined as* volatile must always be
accessed through a volatile lvalue (6.7.3p5).  But an object
*not* defined as volatile *may* be accessed through a volatile
lvalue (6.7.3p7).  That doesn't make the object volatile and it
doesn't mean that you always have to access the object via
volatile semantics.

> A problem I see with this idea is 6.7.3.(6), which says "An object
> that has volatile-qualified type may be modified in ways unknown to
> the implementation or have other unknown side effects."  So a volatile
> object (I assume this is the same as "an object that has
> volatile-qualified type" in your model?) can spontaneously change, for
> reasons unknown to and outside the control of the program; this point
> is underlined later in the paragraph.  But if all accesses to a
> humdrum "static int x;" object are via volatile lvalues, and if that
> means "x" is a volatile object, doesn't this also mean "x" might
> spontaneously change?

I have always "read between the lines" that this applies only to
volatile objects that actually refer to unusual things that are
not normal memory (e.g. MMIO, as you say), probably involving
linker scripting or pointer casts to assign them to magical
addresses.  It has never occurred to me that it applies to every
volatile object.  For example, consider the use of "volatile" in
conjunction with "longjmp", to guarantee that automatic variables
have unsurprising values after the jump.  It would be *very*
surprising if these values spontaneously changed!

> One way out of this mess would be to say that we are making an extra
> assumption, not present in the standard, that volatile objects do not
> spontaneously change and that they have no unknown side effects.  To
> some extent we must make this assumption anyway, or we'll get nowhere.
> Still, 6.7.3.(6) makes it clear (at least to me) that "volatile" is
> intended more for describing access to memory-mapped device registers,
> and wasn't really intended for use in safe signal handling or
> multithreading.

Yes.

> There is also the huge escape clause at the end of 6.7.3.(6): "What
> constitutes an access to an object that has volatile-qualified type is
> implementation-defined."  Ouch!  Talk about getting run over by an
> express train!

No kidding.

> Anyway, to get back to the original module, it seems to me that the
> code actually is assuming something quite a bit different from what
> 'volatile' provides.  The code is attempting to do use loads and
> stores as barriers to prevent the usual sorts of bugs with signal
> handling.  But 'volatile' is not designed to handle this problem:
> volatile accesses are not guaranteed to be atomic.

It'd be *much* better if we had a way to do atomic
accesses--please don't take my arguments as being *in favor of*
volatile.  Almost any other solution would be preferable.  It's
too bad that all the other solutions are even less portable (as
far as I know).

-- 
"Ho ho ho. I _so_ enjoy making a fool out of myself."
--Linus, on Christmas Day, 2000




getaddrinfo.c on windows

2006-07-06 Thread Derek R. Price
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jim Hyslop reported needing the attached patch to compile getaddrinfo.c
in MSVC6.

2006-07-06  Jim Hyslop  <[EMAIL PROTECTED]>

* lib/getaddrinfo.c: Changes to compile under MSVC6: changed
'#if WIN32_NATIVE' to '#ifdef' & moved WSAAPI macro inside
brackets.  Other minor changes to suppress some compiler
warnings.

Cheers,

Derek
- --
Derek R. Price
CVS Solutions Architect
Get CVS support at Ximbiot !
v: +1 248.835.1260
f: +1 248.835.1263

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFErcpYLD1OTBfyMaQRAqxOAJ9lCexMy7yOl6NjG4FZxNyXkF9ZxACfVuV3
3gIDD2Ktgw0zns+jmeEGN7w=
=wtHp
-END PGP SIGNATURE-
--- lib/.#getaddrinfo.c.1.122006-07-06 22:28:14.0 -0400
+++ lib/getaddrinfo.c   2006-07-06 22:33:29.0 -0400
@@ -47,11 +47,11 @@
 #endif
 
 #ifdef WIN32_NATIVE
-typedef int WSAAPI (*getaddrinfo_func) (const char*, const char*,
+typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
const struct addrinfo*,
struct addrinfo**);
-typedef void WSAAPI (*freeaddrinfo_func) (struct addrinfo*);
-typedef int WSAAPI (*getnameinfo_func) (const struct sockaddr*,
+typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
+typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
socklen_t, char*, DWORD,
char*, DWORD, int);
 
@@ -74,9 +74,9 @@
 
   if (h)
 {
-  getaddrinfo_ptr = GetProcAddress (h, "getaddrinfo");
-  freeaddrinfo_ptr = GetProcAddress (h, "freeaddrinfo");
-  getnameinfo_ptr = GetProcAddress (h, "getnameinfo");
+  getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
+  freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, 
"freeaddrinfo");
+  getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
 }
 
   /* If either is missing, something is odd. */
@@ -296,7 +296,10 @@
 {
 #ifdef WIN32_NATIVE
   if (use_win32_p ())
-return freeaddrinfo_ptr (ai);
+{
+  freeaddrinfo_ptr (ai);
+  return;
+}
 #endif
 
   while (ai)
@@ -316,7 +319,7 @@
char *restrict service, socklen_t servicelen,
int flags)
 {
-#if WIN32_NATIVE
+#ifdef WIN32_NATIVE
   if (use_win32_p ())
 return getnameinfo_ptr (sa, salen, node, nodelen,
service, servicelen, flags);


Re: create a big test, collect the fallout

2006-07-06 Thread Ralf Wildenhues
Hello Eric,

* Eric Blake wrote on Fri, Jul 07, 2006 at 03:12:21AM CEST:
> According to Ralf Wildenhues on 7/6/2006 2:51 PM:
> > 
> > 1) $destdir may not contain slashes: gnulib-tool does `mkdir "$destdir"'
> >to create it, and `cd "$destdir"; $cmds; cd ..' to enter/exit.
> 
> That also could run into problems if CDPATH is defined and does not start
> with .

Not in this case (except for spurious, but harmless output).  But you
have a point anyway: gnulib-tool is missing some of the portability
head...

> > +  case $destdir in
> > +  */*) func_fatal_error "argument to --dir may not contain slashes" ;;
> > +  esac
> 
> Should we also limit \?

I'd only do that in a sweep making gnulib-tool work well with
backslashes in general anyway.  See sed_trimtrailingslashes for example,
or the computation of self_abspathname.

> > 6) I'd like a megatest that does not test each individual module but
> >just all of them (I may be patient, but not _that_ patient ;-).
> >Also I'd like failed checks to make the thingy fail, and configure to
> >use a cache file whenever possible (due to the fact that the tests/
> >directory uses a separate configure script, this is a large speedup).
> 
> I agree with the cache idea (we have had several caching bugs in the
> past), as well as the quitting on failure.

This is another point: we should rerun configure with a filled cache and
check for identical output.  This would need some machinery as in the
Autoconf test suite (to grep out spurious difference etc).

> > 9) Autoconf-2.60's AC_CHECK_DECLS_ONCE has two semantic differences
> >with the one from onceonly_2_57.m4:
> >- it accepts only one argument (why BTW?  This looks like a bug;
> >  I think it's been discussed here before, but don't remember the
> >  details):
> 
> Actually, autoconf's version takes a comma-separated list.  I think the
> intent was to allow checking for something like struct foo, which contains
> space.  But the workaround compatible to both 2.59 and 2.60 was indeed
> breaking the checks into multiple lines, one decl per check.

Ah yes, thanks for the reminder.

Cheers,
Ralf




Re: create a big test, collect the fallout

2006-07-06 Thread Sergey Poznyakoff
Simon Josefsson <[EMAIL PROTECTED]> wrote:

> Shishi actually do @include getdate.texi in its manual, so please
> don't install this part.

And GNU tar does the same.

Regards,
Sergey