Bruno Haible [Sat, 4 Feb 2012 18:13:34 +0000 (19:13 +0100)]
isatty: Fix test failure of ptsname_r on native Windows.
* lib/isatty.c (_isatty_nothrow): Upon exception, return 0, not -1,
and don't set errno.
(isatty): Test first whether fd is valid. Set errno when returning 0.
Eric Blake [Sat, 4 Feb 2012 16:46:32 +0000 (09:46 -0700)]
canonicalize: fix // handling
On Cygwin, and other platforms where // is detected as distinct
from / at configure time, the canonicalize routines were incorrectly
treating all instances of multiple leading slashes as //.
See also coreutils bug http://debbugs.gnu.org/10472
* lib/canonicalize.c (canonicalize_filename_mode): Don't convert
/// to //, since only // is special.
Bruno Haible [Sat, 4 Feb 2012 11:59:00 +0000 (12:59 +0100)]
get-rusage-as, get-rusage-data tests: Avoid test failure with gcc-4.7.
* tests/test-get-rusage-as.c (main): Assign the malloc() results to
global variables.
* tests/test-get-rusage-data.c (main): Likewise.
Reported by Jim Meyering.
Jim Meyering [Thu, 2 Feb 2012 08:12:13 +0000 (09:12 +0100)]
file-has-acl: suppress a warning from gcc -Wsuggest-attribute=const
* lib/file-has-acl.c (file_has_acl): This function (for some #ifdefs)
would evoke a new gcc warning. Given all of the #ifdefs, it is better
not even to try to add the attribute. Instead, add a pragma to suppress
the suggestion/warning.
Bruno Haible [Tue, 31 Jan 2012 11:15:46 +0000 (12:15 +0100)]
popen: Make more robust on Windows.
* lib/popen.c: On native Windows, use the _popen based code even if
HAVE_POPEN is set.
* doc/posix-functions/popen.texi: Mention necessity of COMSPEC
environment variable on native Windows.
Bruno Haible [Mon, 30 Jan 2012 21:47:22 +0000 (22:47 +0100)]
doc about getlogin_r, setstate.
* doc/posix-functions/getlogin_r.texi: List the incompatible
declaration problem under "not fixed by gnulib".
* doc/posix-functions/setstate.texi: Mention incompatible declaration
problem on Solaris 11 and other platforms.
Chuanchang Jia [Mon, 30 Jan 2012 21:39:01 +0000 (22:39 +0100)]
poll tests: Make test more robust.
* tests/test-poll.c: Include macros.h.
(test_accept_first, test_pair, test_socket_pair, test_pipe): Verify
return value of various I/O operations.
* modules/poll-tests (Files): Add tests/macros.h.
Bruno Haible [Mon, 30 Jan 2012 20:43:40 +0000 (21:43 +0100)]
sys_stat: Fix support for mingw64 and MSVC.
* lib/sys_stat.in.h (stat) [AIX]: Don't redefine 'stat' if the system
header files already do it.
(stat) [mingw, msvc]: Redefine the symbol to which stat is defined, not
stat itself.
Reported by Marc-André Lureau <marcandre.lureau@redhat.com>.
Bruno Haible [Mon, 30 Jan 2012 19:32:33 +0000 (20:32 +0100)]
quotearg: Fix test failure on MacOS X 10.5.
* tests/test-quotearg-simple.c: Include localcharset.h.
(main): If the locale encoding is not ASCII, bypass the tests of
locale_quoting_style and clocale_quoting_style.
* modules/quotearg-tests (Depends-on): Add 'localcharset'.
Bruno Haible [Sat, 28 Jan 2012 22:29:16 +0000 (23:29 +0100)]
test-framework-sh: Fix test failure with AIX 7.1 diff.
* tests/init.sh (compare_): Don't use 'diff -u' if it inserts a space
in column 1, like 'diff -c' does.
* tests/test-init.sh (test_compare): Don't repeat the test from init.sh
whether 'diff -u' is used. Instead, test whether the output contains
some '@' character.
Paul Eggert [Sat, 28 Jan 2012 21:31:06 +0000 (13:31 -0800)]
strtoimax: eliminate need for stdint.h, inttypes.h checks
* m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Don't use
gl_AC_HEADER_STDINT_H or gl_AC_HEADER_INTTYPES_H. This reduces
the prerequisites for a recently-introduced strtoimax test.
I guess this might cause strtoimax to be replaced when not
strictly necessary on older hosts, but this shouldn't introduce
any bugs and it should make Emacs 'configure' faster on typical
modern hosts. Problem discovered when importing the latest gnulib
to an Emacs test version.
* modules/strtoimax (Files): Remove m4/stdint_h.m4, m4/inttypes_h.m4.
Bruno Haible [Sat, 28 Jan 2012 17:12:10 +0000 (18:12 +0100)]
sys_time: Override 'struct timeval' on some native Windows platforms.
* m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Test whether tv_sec
has the right type. Set REPLACE_STRUCT_TIMEVAL if not.
(gl_HEADER_SYS_TIME_H_DEFAULTS): Initialize REPLACE_STRUCT_TIMEVAL.
* lib/sys_time.in.h: Include <winsock2.h> also when 'struct timeval'
needs to be overridden.
(timeval): Override if REPLACE_STRUCT_TIMEVAL is set.
* modules/sys_time (Makefile.am): Substitute REPLACE_STRUCT_TIMEVAL.
* tests/test-sys_select.c: Check that the tv_sec member has the same
size as a 'time_t'.
* tests/test-sys_time.c: Likewise.
* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): If REPLACE_STRUCT_TIMEVAL
is set, set also REPLACE_GETTIMEOFDAY.
* lib/gettimeofday.c (gettimeofday): If 'struct timeval' is overridden,
convert the resulting 'struct timeval' before returning.
* lib/select.c: Include <sys/time.h>.
(select, timeval): Undefine at the right place.
* modules/select (Depends-on): Add sys_time.
* doc/posix-headers/sys_time.texi: Mention the problem with tv_sec on
some Windows platforms.
Reported by Marc-André Lureau <marcandre.lureau@redhat.com>.
accept4, fcntl, socket modules: Avoid warnings on x86_64 mingw64.
* lib/accept4.c (accept4): Use intptr_t to convert handle pointer to
an integer.
* lib/fcntl.c (dupfd): Likewise.
* lib/w32sock.h (SOCKET_TO_FD): Likewise.
select, poll, isatty: Avoid warnings on x86_64 mingw64.
* lib/select.c (IsConsoleHandle): Use intptr_t to convert handle
pointer to an integer.
* lib/poll.c (IsConsoleHandle): Likewise.
* lib/isatty.c (IsConsoleHandle): Likewise.
Jim Meyering [Sat, 28 Jan 2012 09:49:35 +0000 (10:49 +0100)]
doc: clarify README-release
* top/README-release: Clarify: you should make a point to have
the latest stable versions of build tools in your PATH, and the
reference to buildreq is solely for its list of tool names, not
for its minimal-functional version numbers.
Prompted by discussion with Reuben Thomas and Gary V. Vaughan.
Jim Meyering [Sat, 28 Jan 2012 09:16:25 +0000 (10:16 +0100)]
maint.mk: use more readable (yet functionally equivalent) quoting
It is common to quote a single quote in a single quoted string like
this: '...'\''...'. Unless you know the idiom, that looks like
gibberish, so prefer to double-quote the string when possible.
Then you can use a more readable, lone single quote: "...'..."
* top/maint.mk (sc_cast_of_argument_to_free): Quoting like this
"don't" is more readable than the equivalent 'don'\''t'.
(sc_cast_of_x_alloc_return_value): Likewise.
(sc_cast_of_alloca_return_value): Likewise.
(sc_makefile_path_separator_check): Similar: use ":" in '...',
rather than '\'':'\''.
Paul Eggert [Sat, 28 Jan 2012 06:17:42 +0000 (22:17 -0800)]
stdalign: relax _Alignof and tighten _Alignas test
* m4/stdalign.m4 (gl_STDALIGN_H): Relax the _Alignof test,
as it was too strict: alignof must divide offsetof, but it need
not equal offsetof. Inspired by Joseph S. Myers's comment
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023#c10>.
Conversely, tighten the _Alignas test a bit, as the resulting
alignment must be exactly 8.
Paul Eggert [Fri, 27 Jan 2012 18:17:18 +0000 (10:17 -0800)]
stdalign: check that alignof and offsetof are consistent
* m4/stdalign.m4 (gl_STDALIGN_H): Check for GCC bug 52023.
Problem reported for gnulib by Richard W.M. Jones in
<http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00340.html>.
Jim Meyering [Fri, 27 Jan 2012 09:19:26 +0000 (10:19 +0100)]
update-copyright: accept new option: UPDATE_COPYRIGHT_USE_INTERVALS=2
* build-aux/update-copyright: When UPDATE_COPYRIGHT_USE_INTERVALS=2,
convert a sequence with gaps to the minimal containing range.
For example, convert 2000, 2004-2007, 2009 to 2000-2009.
* tests/test-update-copyright.sh: Test for this.
The FSF confirmed it is ok to do this, assuming there is at
least one significant change per year in the affected range:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/29554/focus=29860
Eric Blake [Thu, 26 Jan 2012 15:31:48 +0000 (08:31 -0700)]
pipe2, assign4: document lack of thread-safety in replacement
* doc/glibc-functions/pipe2.texi (pipe2): Mention thread safety
issue in replacement.
* doc/glibc-functions/accept4.texi (accept4): Likewise.
Based on a report by Eric Wong.
Paul Eggert [Wed, 25 Jan 2012 19:08:01 +0000 (11:08 -0800)]
obstack: remove __STDC__ conditionals
* lib/obstack.h: Remove __STDC__ conditionals, as suggested by Joseph
S. Myers in <http://cygwin.com/ml/libc-alpha/2012-01/msg00104.html>.
This leaves lib/localcharset.c, m4/iconv.m4, and a confusing comment in
m4/include_next.m4 as the only gnulib-maintained places that still
refer to __STDC__.
Paul Eggert [Tue, 17 Jan 2012 23:48:12 +0000 (15:48 -0800)]
doc: omit trailing empty lines from INSTALL etc.
* doc/Makefile (INSTALL): Omit trailing empty lines.
(INSTALL.ISO, INSTALL.UTF-8): Build from INSTALL, so that these also
omit trailing empty lines. This simplifies the build procedure.
Jim Meyering [Sat, 21 Jan 2012 17:12:30 +0000 (18:12 +0100)]
bootstrap: fail when bootstrap_post_import_hook fails
Otherwise, it's far too easy to miss diagnostics emitted
between gnulib-tool's output and that of running configure.
* build-aux/bootstrap: Fail when bootstrap_post_import_hook fails.
Jim Meyering [Tue, 17 Jan 2012 17:10:01 +0000 (18:10 +0100)]
maint: enable sc_prohibit_hash_pjw_without_use
* cfg.mk: Enable sc_prohibit_hash_pjw_without_use.
* top/maint.mk (sc_prohibit_hash_pjw_without_use): Adjust regexp
to match any use of \<hash_pjw\>, i.e., not necessarily with a
following " (".
Jim Meyering [Thu, 19 Jan 2012 05:14:31 +0000 (06:14 +0100)]
bootstrap: add bootstrap_post_import_hook
Bison does still need something like the gnulib_mk_hook whose
invocation I had to remove along with slurp in commit 767ccd40.
Technically, we could get along without it, but doing so would
have required living with a warning and a mandatory post-bootstrap
automake rerun.
* build-aux/bootstrap (gnulib_mk_hook): Remove definition, too.
(bootstrap_post_import_hook): New function.
Invoke it after gnulib-tool --import and before autoreconf.
Jim Meyering [Wed, 18 Jan 2012 07:53:23 +0000 (08:53 +0100)]
gitlog-to-changelog: don't use "no_"-prefixed variable name
* build-aux/gitlog-to-changelog (main): Use getopt's "!" attribute
to enable both --cluster and --no-cluster. Change variable name,
s/\$no_cluster/$cluster/, and reverse usage to match.
Eric Blake [Mon, 16 Jan 2012 17:16:01 +0000 (10:16 -0700)]
bootstrap: properly check for libtool
Commit 767ccd40 changed things to invoke libtoolize before
gnulib-tool, but only for projects that use LT_INIT, even
though we had already probed for libtool via older spellings.
* build-aux/bootstrap (libtoolize): Also run libtool when older
usage is detected.
gnupload: we hold the master copy of this script now
For motivation and more information, see:
<http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00222.html>
* build-aux/gnupload: Make it clear in the heading comments that the
master copy of this file is maintained by gnulib. Since we are at
it, bump its copyright year and ...
($scriptversion): ... the date in its version.
($usage): Patches and bug reports should be sent to the gnulib list,
not the automake one.
* config/srclist.txt: Don't try to sync 'gnupload' from automake
anymore.
Eric Blake [Thu, 12 Jan 2012 15:44:08 +0000 (08:44 -0700)]
inet_ntop: guard extra work by IF_LINT
No need to penalize the code just to silence a gcc warning, so
follow the conventions used elsewhere in gnulib. Clients that
want to use extra warnings should also be using -Dlint.
* lib/inet_ntop.c (inet_ntop6): Mark spurious initialization, for
better code generation when not checking for warnings.
Suggested by Paul Eggert and Jim Meyering.
Eric Blake [Thu, 12 Jan 2012 15:39:07 +0000 (08:39 -0700)]
strptime: fix regression on mingw
The previous change lost the side effect of skipping past a
time-zone offset sign. Instead, fix things to rely on the
fact that _GL_UNUSED can be applied to any variable, even if
some compilation paths use it, to silence gcc on the paths
where it is not used.
* lib/strptime.c (__strptime_internal) [!_LIBC && !HAVE_TM_GMTOFF]:
Fix regression. Reported by Bruno Haible.
Reuben Thomas [Thu, 12 Jan 2012 02:04:49 +0000 (03:04 +0100)]
copy-file: add error-code-returning variant.
* lib/copy-file.h (GL_COPY_ERR_*): New enumeration items.
(qcopy_file_preserving): New declaration.
* lib/copy-file.c (qcopy_file_preserving): Renamed from
copy_file_preserving. Change return type to 'int'. Don't emit an error
message here.
(copy_file_preserving): New function.
* tests/test-copy-file.c: Include <stdlib.h>.
(main): Test qcopy_file_preserving if the environment variable
NO_STDERR_OUTPUT is set.
* tests/test-copy-file-1.sh: Invoke test-copy-file.sh a second time,
with NO_STDERR_OUTPUT
* tests/test-copy-file-2.sh: Likewise.
Dmitry V. Levin [Wed, 11 Jan 2012 20:49:06 +0000 (00:49 +0400)]
getloadavg test: skip the test on GNU/Linux without /proc mounted
GNU libc implements getloadavg(3) on Linux by parsing /proc/loadavg
file. When /proc is not mounted, it always fails with ENOENT.
* tests/test-getloadavg.c (main): Treat ENOENT return code from
getloadavg(3) the same way as ENOSYS and ENOTSUP.
Bruno Haible [Tue, 10 Jan 2012 19:53:57 +0000 (20:53 +0100)]
doc: Mention --with-tests option.
* gnulib-tool (func_usage): Suggest --with-tests for --test etc.
* doc/gnulib.texi (Extra tests modules): Mention the need to pass
--with-tests.
Reported by Reuben Thomas.
Jim Meyering [Mon, 9 Jan 2012 09:12:18 +0000 (10:12 +0100)]
test-init.sh: avoid a subshell
* tests/test-init.sh: Remove protective subshell.
Suggested by Bernhard Voelker. While a subshell is normally
required to protect against older shells (Solaris, FreeBSD) that
warn about a missing program before performing redirection, the
shell-selection tests performed by init.sh probably exclude any
offending shell.