gnulib.git
14 years agoautoupdate
Karl Berry [Sat, 5 Dec 2009 13:36:19 +0000 (05:36 -0800)]
autoupdate

14 years agoprogname: Clarify specification.
Bruno Haible [Sat, 5 Dec 2009 11:14:04 +0000 (12:14 +0100)]
progname: Clarify specification.

14 years agomaint.mk: backslash-escape parens in default regexp
Jim Meyering [Sat, 5 Dec 2009 09:02:01 +0000 (10:02 +0100)]
maint.mk: backslash-escape parens in default regexp

* top/maint.mk (news-check-regexp): Now that we're using grep -E,
backslash-escape the literal parentheses.

14 years agomaint.mk: news-check: use grep -E
Jim Meyering [Sat, 5 Dec 2009 08:35:28 +0000 (09:35 +0100)]
maint.mk: news-check: use grep -E

* top/maint.mk (today): Define a Make variable, not a...
(news-date-check): ...shell variable.
(news-check-regexp): Use the Make variable.
Use grep's -E option.  Change the failing diagnostic to mention
the variable, $(news-check-regexp).
(news-check): Rename target from news-date-check.  Update sole use.

14 years agomaintainer-makefile: allow customization of NEWS entry format
Alfred M. Szmidt [Sat, 5 Dec 2009 04:27:40 +0000 (21:27 -0700)]
maintainer-makefile: allow customization of NEWS entry format

* top/maint.mk (news-date-regexp): New overridable variable.
(news-date-check): Use it.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomgetgroups: add xgetgroups, and avoid ENOSYS failures
Eric Blake [Fri, 4 Dec 2009 15:26:23 +0000 (08:26 -0700)]
mgetgroups: add xgetgroups, and avoid ENOSYS failures

ENOSYS implies that there are no supplemental groups, so we can
treat it the same as a return of 0 from getgroups rather than
exposing failure to the user.  This in turn fixes a crash in
coreutils' id, which freed an uninitialized pointer.

* lib/mgetgroups.h (xgetgroups): New prototype.
* lib/mgetgroups.c (xgetgroups): New wrapper.
(mgetgroups): Handle ENOSYS.
* modules/mgetgroups (Depends-on): Add realloc.
Reported by Scott Harrison <scott.gnu.2009@scottrix.co.uk>.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomgetgroups: avoid argument promotion issues with -1
Eric Blake [Fri, 4 Dec 2009 21:37:32 +0000 (14:37 -0700)]
mgetgroups: avoid argument promotion issues with -1

On platforms where gid_t is equivalent to uint16_t, argument
promotion states that -1 != (gid_t) -1.

* lib/mgetgroups.c (mgetgroups): A cast is required when checking
for invalid gid_t.
* tests/test-chown.h (getegid, test_chown): Likewise.
* tests/test-lchown.h (getegid, test_lchown): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoexclude: Fix header file problems.
Paolo Bonzini [Thu, 3 Dec 2009 17:39:47 +0000 (18:39 +0100)]
exclude: Fix header file problems.

* lib/exclude.h: Add multiple inclusion guards and include stdbool.h.

14 years agoautoupdate
Karl Berry [Tue, 1 Dec 2009 14:38:45 +0000 (06:38 -0800)]
autoupdate

14 years agofts: fts_open: do not let an empty string cause immediate failure
Jim Meyering [Tue, 1 Dec 2009 11:06:34 +0000 (12:06 +0100)]
fts: fts_open: do not let an empty string cause immediate failure

This is required in support of GNU rm, for which the command
"rm A '' B" must process and remove both A and B, in spite of
the empty string argument.
* lib/fts.c (fts_open): Do not let the presence of an empty string
cause fts_open to fail immediately.  Most fts-using tools must be
able to process all arguments, in order, and can be expected to
diagnose such arguments themselves.
Also, move declaration of local, "len", "down" to initialization.

14 years agoutimens: fix compilation error
Eric Blake [Mon, 30 Nov 2009 13:45:42 +0000 (06:45 -0700)]
utimens: fix compilation error

Fixes a regression from 2009-11-25.

* lib/utimens.c (lutimens) [!HAVE_UTIMENSAT && HAVE_LUTIMES]:
Declare variable at right scope.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agobootstrap: fix handling of various perl --version formats
Pádraig Brady [Mon, 30 Nov 2009 12:29:03 +0000 (12:29 +0000)]
bootstrap: fix handling of various perl --version formats

* build-aux/bootstrap (get_version): Don't use perl's $] special
variable, as that requires updating all bootstrap.conf files to
use perl's x.yyyzzz version format.  Instead make the regular
expression more general to support version formats from older
perl-5.005_002 (5.5.2) and perl-5.11 which has other numbers
in the version line.

14 years agobootstrap: handle perl-5.11's changed --version output
Jim Meyering [Sun, 29 Nov 2009 12:57:05 +0000 (13:57 +0100)]
bootstrap: handle perl-5.11's changed --version output

* build-aux/bootstrap (get_version): Handle perl separately,
since perl-5.11's --version output is different.

14 years agouserspec: depend on the inttostr module, too
Jim Meyering [Sat, 28 Nov 2009 08:28:40 +0000 (09:28 +0100)]
userspec: depend on the inttostr module, too

* modules/userspec (Depends-on): Add inttostr.

14 years agouserspec: disallow an ID that maps to (uid_t)-1 or (gid_t)-1
Jim Meyering [Sat, 28 Nov 2009 06:33:16 +0000 (07:33 +0100)]
userspec: disallow an ID that maps to (uid_t)-1 or (gid_t)-1

* lib/userspec.c (parse_with_separator): Do not accept a user ID
number of MAXUID when it evaluates to (uid_t) -1.
Likewise for group ID.  Reported by Matt McCutchen in
<http://savannah.gnu.org/bugs/?28113>

14 years agouserspec: reformat to use spaces, not TABs
Jim Meyering [Sat, 28 Nov 2009 06:26:53 +0000 (07:26 +0100)]
userspec: reformat to use spaces, not TABs

* lib/userspec.c: Expand TABs to spaces.
Add Emacs' "indent-tabs-mode: nil" hint.

14 years agogetopt-gnu: flush out another BSD bug
Eric Blake [Sat, 28 Nov 2009 00:47:21 +0000 (17:47 -0700)]
getopt-gnu: flush out another BSD bug

POSIX requires 'echo foo > bar; m4 -Dfoo=1 bar -Dfoo=2 bar' to
output '1' then '2'.  To achieve this, m4 relies on the GNU
getopt{,_long} extension of a leading '-'.  However, BSD getopt
fails to honor this extension when POSIXLY_CORRECT.

Also, BSD getopt fails to reparse POSIXLY_CORRECT from the
environment even when a reset is requested (whether by
optreset=1 or by optind=0).

* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Test for the bug.
* tests/test-getopt.c (main): Check POSIXLY_CORRECT first, to
flush out BSD bug.
* tests/test-getopt.h (test_getopt): End lists with NULL.
* tests/test-getopt_long.h (test_getopt_long): Likewise.
(test_getopt_long_posix): Enhance test.
* modules/getopt-posix-tests (Depends-on): Add stdbool.
* doc/glibc-functions/getopt_long.texi (getopt_long): Mention
getopt-gnu.
* doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomodules/idpriv-droptemp-tests (Notice): Fix text.
Simon Josefsson [Fri, 27 Nov 2009 15:13:37 +0000 (16:13 +0100)]
modules/idpriv-droptemp-tests (Notice): Fix text.

14 years agotest-xalloc-die: avoid spurious failure due to libtool argv difference
Jim Meyering [Fri, 27 Nov 2009 09:19:32 +0000 (10:19 +0100)]
test-xalloc-die: avoid spurious failure due to libtool argv difference

In a libtool-enabled project, this test would fail due to a difference
in the emitted program name, e.g.,
-test-xalloc-die: memory exhausted
+/tmp/.../tests/.libs/lt-test-xalloc-die: memory exhausted
Use program to avoid that.
* modules/xalloc-die-tests (Depends-on): Add progname.
* tests/test-xalloc-die.c: Include progname.h".
(program_name): Remove decl.
(main): Call set_program_name.
* tests/test-xalloc-die.sh (compare): Remove unnecessary ${EXE}.

14 years agow32sock: leave win32 error in place.
Paolo Bonzini [Thu, 26 Nov 2009 19:29:16 +0000 (20:29 +0100)]
w32sock: leave win32 error in place.

* lib/w32sock.h (set_winsock_errno): Do not call WSASetLastError.

14 years agoinit.sh: suggest to use skip_ and fail_ functions in comments
Eric Blake [Thu, 26 Nov 2009 08:39:26 +0000 (09:39 +0100)]
init.sh: suggest to use skip_ and fail_ functions in comments

* tests/init.sh: Add a sentence.

14 years agoinit.sh: add documentation in comments
Bruno Haible [Thu, 26 Nov 2009 08:24:51 +0000 (09:24 +0100)]
init.sh: add documentation in comments

* tests/init.sh: Add some developer and user documentation.

14 years agoinit.sh: accommodate even those who specify bogus srcdir manually
Jim Meyering [Thu, 26 Nov 2009 08:10:04 +0000 (09:10 +0100)]
init.sh: accommodate even those who specify bogus srcdir manually

* tests/init.sh: Normally, srcdir is guaranteed by automake and
configure-time tests to be sanitized, so that there is no need to
use "$srcdir" in Makefile rules and shell scripts.  Using $srcdir
(with no double quotes) suffices.  However, since tests may be
invoked manually, and since you may explicitly set srcdir to the
name of a directory containing spaces, do quote its uses here.
* tests/test-pread.sh: Likewise.
Suggested by Bruno Haible.

14 years agotest-pread.sh: avoid diagnostics for those who ignore SIGPIPE
Jim Meyering [Thu, 26 Nov 2009 07:51:11 +0000 (08:51 +0100)]
test-pread.sh: avoid diagnostics for those who ignore SIGPIPE

* tests/test-pread.sh: Write no data into the pipe, because
test-pread actually reads none.  This avoids a diagnostic,
"bash: echo: write error: Broken pipe", that arises in the unusual
event something is ignoring SIGPIPE, and might be interpreted
as some sort of failure.  Reported by Bruno Haible.

14 years agotest-pread: cover failure with ESPIPE and EINVAL
Jim Meyering [Wed, 25 Nov 2009 17:26:35 +0000 (18:26 +0100)]
test-pread: cover failure with ESPIPE and EINVAL

* tests/test-pread.c (main): Test for failure, too.
* tests/test-pread.sh: Invoke with stdin on a pipe.
Suggested by Eric Blake.

14 years agopread: improvement and fix
Jim Meyering [Wed, 25 Nov 2009 17:01:02 +0000 (18:01 +0100)]
pread: improvement and fix

* modules/pread (Depends-on): Depend on lseek, for portability to
e.g., mingw.  Suggested by Eric Blake.
* lib/pread.c (__libc_read): Define.  Reported by Richard W.M. Jones.

14 years agounistd.in.h: correct declaration of pread
Jim Meyering [Wed, 25 Nov 2009 16:06:25 +0000 (17:06 +0100)]
unistd.in.h: correct declaration of pread

* lib/unistd.in.h: Correct type of "buf" parameter: void*, not char*
Reported by Richard W.M. Jones.

14 years agotest-pread.sh: distribute the test script
Jim Meyering [Wed, 25 Nov 2009 15:59:15 +0000 (16:59 +0100)]
test-pread.sh: distribute the test script

* modules/pread-tests (Files): Include test-pread.sh.

14 years agotest-pread.sh: clean up
Jim Meyering [Wed, 25 Nov 2009 15:52:47 +0000 (16:52 +0100)]
test-pread.sh: clean up

* tests/test-pread.sh: Don't refer to $builddir. Just use equivalent ".".
* modules/pread-tests (TESTS_ENVIRONMENT): Don't export builddir.
That is unnecessary, since it's always ".".
Suggestion from Eric Blake.

14 years agotest-pread.sh: make executable
Jim Meyering [Wed, 25 Nov 2009 15:37:42 +0000 (16:37 +0100)]
test-pread.sh: make executable

* tests/test-pread.sh: Set executable bit.
Reported by Eric Blake.

14 years agocorrect typo in test-pread.sh
Jim Meyering [Wed, 25 Nov 2009 15:14:19 +0000 (16:14 +0100)]
correct typo in test-pread.sh

* tests/test-pread.sh: Add #! line.

14 years agotest pread
Jim Meyering [Wed, 25 Nov 2009 14:50:56 +0000 (15:50 +0100)]
test pread

* tests/test-pread.c: New file.
* tests/test-pread.sh: Likewise.
* modules/pread-tests: Likewise.

14 years agopread: new module
Jim Meyering [Wed, 25 Nov 2009 13:33:30 +0000 (14:33 +0100)]
pread: new module

* modules/pread: New file.
* lib/pread.c (pread): New file.
* m4/pread.m4: Likewise.
* lib/unistd.in.h (pread): Define/declare.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Define defaults.
* modules/unistd (Makefile.am): Substitute witnesses.
* doc/posix-functions/pread.texi (pread): Update.
* MODULES.html.sh: Add pread.

14 years agotests/init.sh: new file to be used via most *.sh tests
Jim Meyering [Wed, 25 Nov 2009 13:40:31 +0000 (14:40 +0100)]
tests/init.sh: new file to be used via most *.sh tests

* tests/init.sh: New file.

14 years agoutimens: work around older Linux failure with symlinks
Eric Blake [Tue, 24 Nov 2009 17:07:57 +0000 (10:07 -0700)]
utimens: work around older Linux failure with symlinks

Some Linux kernel versions support utimensat(,0) but not
utimensat(,AT_SYMLINK_NOFOLLOW), even for non-symlinks.  Had the
fallback code for regular files been reached, it would have truncated
timestamps.  But since glibc lutimes just wraps utimensat, and we
didn't expect ENOSYS from lutimes, the fallback wasn't even reached.

* lib/utimens.c (lutimensat_works_really): New variable.
(fdutimens, lutimens): Use it to manage kernels that support
nanosecond times on files, but not on symlinks.
Reported by Ondřej Vašík.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoutimes: fix configure grammar
Eric Blake [Tue, 24 Nov 2009 17:00:18 +0000 (10:00 -0700)]
utimes: fix configure grammar

'Checking determine whether...' doesn't read well.

* m4/utimes.m4 (gl_FUNC_UTIMES): Delete spurious word.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoregex: Fix fastmap for multibyte character ranges.
Paolo Bonzini [Wed, 25 Nov 2009 10:41:09 +0000 (11:41 +0100)]
regex: Fix fastmap for multibyte character ranges.

* lib/regcomp.c (re_compute_fastmap_iter): Add all multibyte lead
characters when a multibyte character range is included.

14 years agoversion-etc: work also with AM_INIT_AUTOMAKE's no-define option
Andy Wingo [Sun, 22 Nov 2009 08:47:12 +0000 (09:47 +0100)]
version-etc: work also with AM_INIT_AUTOMAKE's no-define option

* lib/version-etc.c [!defined PACKAGE]: Define to PACKAGE_TARNAME.

14 years agodoc: Most *_l functions exist in MacOS X 10.5.
Bruno Haible [Wed, 25 Nov 2009 00:53:37 +0000 (01:53 +0100)]
doc: Most *_l functions exist in MacOS X 10.5.

14 years agodoc: Most *_l functions exist in MacOS X 10.5.
Bruno Haible [Wed, 25 Nov 2009 00:49:04 +0000 (01:49 +0100)]
doc: Most *_l functions exist in MacOS X 10.5.

14 years agoduplocale: Fix logic bug.
Bruno Haible [Tue, 24 Nov 2009 09:44:40 +0000 (10:44 +0100)]
duplocale: Fix logic bug.

14 years agotest-update-copyright: don't hard-code /usr/bin/perl
Jim Meyering [Mon, 23 Nov 2009 10:28:00 +0000 (11:28 +0100)]
test-update-copyright: don't hard-code /usr/bin/perl

* tests/test-update-copyright.sh (YEAR): Use date +%Y, rather than
perl to print the current year.  Gilles Espinasse reported that
the replaced use of perl was hard-coded as /usr/bin/perl.

14 years agoduplocale: Add support for glibc 2.3.x.
Bruno Haible [Mon, 23 Nov 2009 10:05:42 +0000 (11:05 +0100)]
duplocale: Add support for glibc 2.3.x.

14 years agovasnprintf: Tiny optimization.
Bruno Haible [Mon, 23 Nov 2009 01:43:23 +0000 (02:43 +0100)]
vasnprintf: Tiny optimization.

14 years agoTests for module 'duplocale'.
Bruno Haible [Mon, 23 Nov 2009 00:47:07 +0000 (01:47 +0100)]
Tests for module 'duplocale'.

14 years agoNew module 'duplocale'.
Bruno Haible [Mon, 23 Nov 2009 00:46:00 +0000 (01:46 +0100)]
New module 'duplocale'.

14 years agoCheck that <locale.h> defines locale_t and LC_GLOBAL_LOCALE.
Bruno Haible [Sun, 22 Nov 2009 22:32:54 +0000 (23:32 +0100)]
Check that <locale.h> defines locale_t and LC_GLOBAL_LOCALE.

14 years agolocale: Make locale_t available when possible.
Bruno Haible [Sun, 22 Nov 2009 22:31:11 +0000 (23:31 +0100)]
locale: Make locale_t available when possible.

14 years agoAdd comments.
Bruno Haible [Mon, 23 Nov 2009 00:03:24 +0000 (01:03 +0100)]
Add comments.

14 years agoOops, move the include of unistd.h in the last commit.
Bruno Haible [Sun, 22 Nov 2009 18:33:24 +0000 (19:33 +0100)]
Oops, move the include of unistd.h in the last commit.

14 years agoerror: account for the possibility of freopen (stdout).
Bruno Haible [Sun, 22 Nov 2009 18:30:39 +0000 (19:30 +0100)]
error: account for the possibility of freopen (stdout).

14 years agoAdd comment.
Bruno Haible [Sun, 22 Nov 2009 18:07:34 +0000 (19:07 +0100)]
Add comment.

14 years agoc-stack: avoid defining an unused static function
Jim Meyering [Sun, 22 Nov 2009 16:11:14 +0000 (17:11 +0100)]
c-stack: avoid defining an unused static function

* lib/c-stack.c (find_stack_direction): Do not define this function
when it will not be used.

14 years agodiffseq: avoid spurious gcc warnings
Jim Meyering [Sun, 22 Nov 2009 08:01:07 +0000 (09:01 +0100)]
diffseq: avoid spurious gcc warnings

* lib/diffseq.h (IF_LINT2): Define.
(compareseq): Use it to initialize two members of "part".
This avoids two used-uninitialized warnings.

14 years agoc-stack: avoid "ignoring return value of `write'" warning
Jim Meyering [Sat, 21 Nov 2009 16:52:54 +0000 (17:52 +0100)]
c-stack: avoid "ignoring return value of `write'" warning

* lib/c-stack.c: Include "ignore-value.h".
(die): Explicitly ignore each write return value.
* modules/c-stack (Depends-on): Add ignore-value.

14 years agoautoupdate
Karl Berry [Sat, 21 Nov 2009 15:12:27 +0000 (07:12 -0800)]
autoupdate

14 years agodiffseq: reduce scope of variable 'best'.
Bruno Haible [Sat, 21 Nov 2009 13:37:46 +0000 (14:37 +0100)]
diffseq: reduce scope of variable 'best'.

14 years agodiffseq: remove useless assignment to "best"
Jim Meyering [Sat, 21 Nov 2009 12:49:54 +0000 (13:49 +0100)]
diffseq: remove useless assignment to "best"

* lib/diffseq.h (diag) [USE_HEURISTIC]: Remove useless "best = 0"
assignment.  At that point "best" is already guaranteed to be zero.

14 years agobuild: mention ftp redirector in release announcements
Eric Blake [Fri, 20 Nov 2009 13:23:42 +0000 (06:23 -0700)]
build: mention ftp redirector in release announcements

Now that http://ftpmirror.gnu.org/PACKAGE/ redirects to a nearby
mirror, we should promote its use in release announcements.
Meanwhile, mention the mirror list.

* top/maint.mk (gnu_rel_host, url_dir_list): Provide defaults for
values that used to come from cfg.mk; mention FTP redirect URL.
* build-aux/announce-gen: Mention the mirror list.
Suggested by Karl Berry.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agonanosleep: improve port to mingw
Eric Blake [Thu, 19 Nov 2009 05:14:39 +0000 (22:14 -0700)]
nanosleep: improve port to mingw

test-nanosleep failed to link, and exposed a need for argument
validation when nanosleep is missing.

* lib/nanosleep.c (rpl_nanosleep): Reject invalid arguments.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Incorporate LIBSOCKET into
LIB_NANOSLEEP, but only when needed.
* modules/select (Link): Document LIBSOCKET.
* m4/select.m4 (gl_FUNC_SELECT): Ensure LIBSOCKET is defined early
enough.

14 years agonanosleep: work around cygwin bug
Eric Blake [Thu, 19 Nov 2009 03:10:42 +0000 (20:10 -0700)]
nanosleep: work around cygwin bug

Cygwin 1.5.x mistakenly failed with EINVAL for a duration longer
than 49.7 days (2**32 milliseconds).  Meanwhile, the existing
code for HAVE_BUG_BIG_NANOSLEEP would infloop, instead of return
failure, for invalid arguments.

* lib/nanosleep.c (rpl_nanosleep) [HAVE_BUG_BIG_NANOSLEEP]:
Fix logic bug when nanosleep fails.  Work around cygwin 1.5.x
bug.
(getnow): Delete, not needed.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): No longer require
LIB_CLOCK_GETTIME.
* modules/nanosleep (Depends-on): Add intprops and verify.  Drop
clock-time, gettime.
* doc/posix-functions/nanosleep.texi (nanosleep): Document the
bug.
* modules/nanosleep-tests: New test.
* tests/test-nanosleep.c: New file.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agosleep: work around cygwin bug
Eric Blake [Thu, 19 Nov 2009 03:07:44 +0000 (20:07 -0700)]
sleep: work around cygwin bug

On cygwin 1.5.x, sleep amounts larger than 49.7 days (2**32
milliseconds) failed instantly, but with a garbage return
value from uninitialized memory.

* lib/sleep.c (rpl_sleep): Work around the bug.
* m4/sleep.m4 (gl_FUNC_SLEEP): Detect the bug.
(gl_PREREQ_SLEEP): Delete unused macro.
* modules/sleep (Depends-on): Add verify.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add default.
* modules/unistd (Makefile.am): Substitute witness.
* lib/unistd.in.h (sleep): Update prototype.
* doc/posix-functions/sleep.texi (sleep): Document the bug.
* tests/test-sleep.c (main) [HAVE_DECL_ALARM]: Test it.
* modules/sleep-tests (Depends-on): Check for alarm.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint.mk: improve sc_prohibit_magic_number_exit
Jim Meyering [Fri, 20 Nov 2009 12:24:24 +0000 (13:24 +0100)]
maint.mk: improve sc_prohibit_magic_number_exit

* top/maint.mk (sc_prohibit_magic_number_exit): Tighten regexp
so it does not match uses like System.exit(1).
Add comments showing how to correct all offenders.

14 years agoxalloc-die-tests: add missing library
Eric Blake [Thu, 19 Nov 2009 16:12:34 +0000 (09:12 -0700)]
xalloc-die-tests: add missing library

* modules/xalloc-die-tests (Makefile.am): Add LDADD line.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-xvasprintf: silence compiler warnings
Eric Blake [Thu, 19 Nov 2009 15:51:13 +0000 (08:51 -0700)]
test-xvasprintf: silence compiler warnings

* tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Mask
empty string from gcc.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoautoupdate
Karl Berry [Thu, 19 Nov 2009 17:17:24 +0000 (09:17 -0800)]
autoupdate

14 years agoxfreopen: new module, from coreutils
Jim Meyering [Thu, 19 Nov 2009 14:55:58 +0000 (15:55 +0100)]
xfreopen: new module, from coreutils

* modules/xfreopen: New module.
* lib/xfreopen.c: New file.
* lib/xfreopen.h: New file.
* MODULES.html.sh (File stream based Input/Output"): Add it.

14 years agomanywarnings: depend on warnings
Eric Blake [Thu, 19 Nov 2009 13:42:21 +0000 (06:42 -0700)]
manywarnings: depend on warnings

* modules/manywarnings (Depends-on): Add warnings.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agobuild: avoid compiler warnings
Eric Blake [Thu, 19 Nov 2009 04:46:35 +0000 (21:46 -0700)]
build: avoid compiler warnings

Silence some warnings found on mingw.

* lib/select.c (rpl_select): Delete unused variable.
* lib/setsockopt.c (rpl_setsockopt): Avoid incompatible pointer.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotests: avoid false negative with --with-packager
Eric Blake [Thu, 19 Nov 2009 03:36:01 +0000 (20:36 -0700)]
tests: avoid false negative with --with-packager

Ignore extra line produced by version-etc.

* tests/test-version-etc.sh: Discard packager information.
* tests/test-argp-version-etc-1.sh: Likewise.
Reported by Mike Frysinger.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoutimens: fix regression on Solaris
Eric Blake [Wed, 18 Nov 2009 13:59:44 +0000 (06:59 -0700)]
utimens: fix regression on Solaris

Revert commit 26c5fd742f.  Solaris lacks futimens and futimes, so
futimesat is the only way to change fd timestamps.  But since
FreeBSD futimesat can't change fd timestamps, we need a configure
check to avoid the crash there.

* m4/utimens.m4 (gl_UTIMENS): Check for BSD bug.
* lib/utimens.c (fdutimens): Revert 2009-11-08 change; Solaris 10
can only change fd timestamps via futimesat.  Instead, use an
additional witness macro to avoid BSD bug.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agousleep: use it to simplify tests
Eric Blake [Tue, 17 Nov 2009 16:58:18 +0000 (09:58 -0700)]
usleep: use it to simplify tests

Blindly using usleep makes it easier to write tests.

* modules/stat-time-tests (Depends-on): Add usleep.
(configure.ac): Drop usleep check.
* modules/chown-tests (Depends-on, configure.ac): Likewise.
* modules/lchown-tests (Depends-on, configure.ac): Likewise.
* modules/fdutimensat-tests (Depends-on, configure.ac): Likewise.
* modules/futimens-tests (Depends-on, configure.ac): Likewise.
* modules/openat-tests (Depends-on, configure.ac): Likewise.
* modules/utimens-tests (Depends-on, configure.ac): Likewise.
* modules/utimensat-tests (Depends-on, configure.ac): Likewise.
* modules/pipe-filter-gi-tests (Depends-on, configure.ac):
Likewise.
* tests/test-chown.h (nap): Rely on nicer usleep semantics.
* tests/test-lchown.h (nap): Likewise.
* tests/test-pipe-filter-gi2-main.c (small_nap): Likewise.
* tests/test-stat-time.c (nap): Likewise.
* tests/test-utimens-common.h (nap): Update comments.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agousleep: new module
Eric Blake [Tue, 17 Nov 2009 16:24:56 +0000 (09:24 -0700)]
usleep: new module

mingw usleep(1000000) failed with EINVAL, as allowed by POSIX,
but contrary to GNU usage.  Rather than implement an accurate
usleep based on select or nanosleep, both of which drag in
dependencies on external libraries, this version intentionally
takes the ceiling in seconds if usleep() is missing.

* modules/usleep: New file.
* m4/usleep.m4 (gl_FUNC_USLEEP): Likewise.
* lib/usleep.c (usleep): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add defaults.
* modules/unistd (Makefile.am): Substitute witnesses.
* lib/unistd.in.h (usleep): Add declaration.
* doc/pastposix-functions/usleep.texi (usleep): Document this.
* MODULES.html.sh (Date and time): Likewise.
* modules/usleep-tests (Depends-on): New test.
* tests/test-usleep.c: New file.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agochown: work around OpenBSD bug
Eric Blake [Mon, 16 Nov 2009 21:35:41 +0000 (14:35 -0700)]
chown: work around OpenBSD bug

chown(name,geteuid(),-1) failed to update the change time if
name was already owned by the current effective user.  Work
around it by using chmod, which does not have this bug.

Unfortunately, lchown has the same bug, but OpenBSD 4.0 lacks
lchmod and lutimes, so there is no way to affect ctime without
unlinking and recreating the symlink, which is too dangerous.

* lib/chown.c (rpl_chown): Work around the bug.
* lib/lchown.c (rpl_lchown): Attempt to do likewise.
* m4/chown.m4 (gl_FUNC_CHOWN): Test for ctime bug.
* m4/lchown.m4 (gl_FUNC_LCHOWN): Check for lchmod.
* modules/chown (Depends-on): Add stdbool.
* modules/lchown (Depends-on): Likewise.
* doc/posix-functions/chown.texi (chown): Document the bug.
* doc/posix-functions/lchown.texi (lchown): Likewise.
* tests/test-lchown.h (test_chown): Relax test.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomkstemp: avoid conflict with C++ keyword template
Eric Blake [Tue, 17 Nov 2009 18:53:14 +0000 (11:53 -0700)]
mkstemp: avoid conflict with C++ keyword template

Just because glibc uses K&R, and uses template as an identifier,
doesn't mean we have to.

* lib/mkdtemp.c (mkdtemp): Change spelling of template.
* lib/mkostemp.c (mkostemp): Likewise.
* lib/mkostemps.c (mkostemps): Likewise.
* lib/mkstemp.c (mkstemp): Likewise.
* lib/mkstemps.c (mkstemps): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoxalloc-die-tests: optimize
Eric Blake [Tue, 17 Nov 2009 18:38:42 +0000 (11:38 -0700)]
xalloc-die-tests: optimize

* tests/test-xalloc-die.sh: Reduce number of processes.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoAdd.
Simon Josefsson [Tue, 17 Nov 2009 21:23:17 +0000 (22:23 +0100)]
Add.

14 years agoAdd `gnulib-tool --import' support for LGPLv3+.
Ludovic Courtès [Tue, 17 Nov 2009 20:38:51 +0000 (21:38 +0100)]
Add `gnulib-tool --import' support for LGPLv3+.

* gnulib-tool (func_import): Add support for LGPLv3+.

14 years agoversion-etc: use proper license string
Jim Meyering [Tue, 17 Nov 2009 21:19:54 +0000 (22:19 +0100)]
version-etc: use proper license string

* modules/version-etc (License): Use LGPL, not LGPLv3+.
* modules/version-etc-fsf: Likewise.

14 years agotests/test-xalloc-die.sh: Deal with EOL differences, and more.
Simon Josefsson [Tue, 17 Nov 2009 18:58:12 +0000 (19:58 +0100)]
tests/test-xalloc-die.sh: Deal with EOL differences, and more.

14 years agounsetenv: work around Solaris bug
Eric Blake [Tue, 17 Nov 2009 13:31:34 +0000 (06:31 -0700)]
unsetenv: work around Solaris bug

unsetenv(name) only cleared the first instance, even if (ab)use of
putenv, or assignment to environ, included duplicates of name.

* m4/setenv.m4 (gl_FUNC_UNSETENV): Check for bug.
* lib/unsetenv.c (rpl_unsetenv): Work around it.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agovasnprintf: avoid compiler warnings
Eric Blake [Fri, 30 Oct 2009 16:24:45 +0000 (10:24 -0600)]
vasnprintf: avoid compiler warnings

* lib/vasnprintf.c (VASNPRINTF): Avoid shadowing our own local
variables.
* lib/printf-args.c (PRINTF_FETCHARGS): Avoid type mismatch.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomodules/xalloc-die-tests (Makefile.am): Drop XFAIL_TESTS.
Simon Josefsson [Tue, 17 Nov 2009 09:04:43 +0000 (10:04 +0100)]
modules/xalloc-die-tests (Makefile.am): Drop XFAIL_TESTS.

14 years agotest-xalloc-die.sh: make the code agree with the commit log
Jim Meyering [Tue, 17 Nov 2009 07:46:29 +0000 (08:46 +0100)]
test-xalloc-die.sh: make the code agree with the commit log

* tests/test-xalloc-die.sh: Put "." at the front of $PATH, not
at the end, just in case you happen to have a test-xalloc-die
program in some other PATH directory.

14 years agotest-xalloc-die.sh: fix a portability bug
Jim Meyering [Tue, 17 Nov 2009 07:42:58 +0000 (08:42 +0100)]
test-xalloc-die.sh: fix a portability bug

* tests/test-xalloc-die.sh: Do not invoke via ./test-xalloc-die.
Instead, set PATH to start with "." and invoke via "test-xalloc-die".
Otherwise, argv[0] (as often seen in diagnostics) would be too
system-dependent, sometimes with, and sometimes without the leading "./".

14 years agoversion-etc-fsf: relax license to LGPLv3+
Jim Meyering [Tue, 17 Nov 2009 06:20:41 +0000 (07:20 +0100)]
version-etc-fsf: relax license to LGPLv3+

* modules/version-etc-fsf (License): Relax license.

14 years agoxalloc-die-tests: avoid printing null pointer
Eric Blake [Tue, 17 Nov 2009 04:21:10 +0000 (21:21 -0700)]
xalloc-die-tests: avoid printing null pointer

The test leaked "(null): memory exhausted" to stderr, or crashed
for less capable printf.

* modules/xalloc-die-tests (Files, Makefile.am): Wrap execution in
shell script.
* tests/test-xalloc-die.c (program_name): Declare.
* tests/test-xalloc-die.sh (tmpfiles): New file.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agosetenv, unsetenv: work around various bugs
Eric Blake [Sun, 15 Nov 2009 05:13:10 +0000 (22:13 -0700)]
setenv, unsetenv: work around various bugs

POSIX requires setenv(NULL,"",0), setenv("a=b","",0),
unsetenv(NULL), and unsetenv("a=b") to fail with EINVAL, but
many BSD implementations lack validation.  The gnulib
replacement for void unsetenv did not do validation, and the
replacement for setenv was out of sync with glibc.  Also, some
BSD implementations of setenv("a","==",1) eat the leading '='.

See also some recent Austin Group interpretations on environ:
http://austingroupbugs.net/view.php?id=167
http://austingroupbugs.net/view.php?id=185

* lib/setenv.c (setenv) [!HAVE_SETENV]: Resync from glibc.
(setenv) [HAVE_SETENV]: Work around bugs.
* lib/unsetenv.c (unsetenv) [HAVE_UNSETENV]: Work around bugs.
* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE, gl_FUNC_UNSETENV): Check
for bugs.
(gl_FUNC_SETENV): Write in terms of gl_FUNC_SETENV_SEPARATE.
* m4/environ.m4 (gl_ENVIRON): Avoid expand-before-require.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Update defaults.
* modules/stdlib (Makefile.am): Update substitutions.
* lib/stdlib.in.h (setenv, unsetenv): Update prototypes.
* doc/posix-functions/setenv.texi (setenv): Document the bugs.
* doc/posix-functions/unsetenv.texi (unsetenv): Likewise.
* modules/setenv-tests: New test.
* modules/unsetenv-tests: Likewise.
* tests/test-setenv.c: New file.
* tests/test-unsetenv.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoversion-etc: relax license to LGPLv3+
Jim Meyering [Mon, 16 Nov 2009 21:08:52 +0000 (22:08 +0100)]
version-etc: relax license to LGPLv3+

* modules/version-etc (License): Relax license.

14 years agobetter AC_REQUIRE expanded-before-required-warning avoidance
Jim Meyering [Mon, 16 Nov 2009 18:26:35 +0000 (19:26 +0100)]
better AC_REQUIRE expanded-before-required-warning avoidance

* m4/chown.m4 (gl_FUNC_CHOWN, gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Define
with AC_DEFUN_ONCE, rather than AC_DEFUN, to avoid AC_REQUIRE warnings.
Suggested by Eric Blake.  This change also reverts commit 1b712ba8,
which is no longer needed.

14 years agotest-freading: clean up temporary file
Eric Blake [Mon, 16 Nov 2009 13:27:10 +0000 (06:27 -0700)]
test-freading: clean up temporary file

* tests/test-freading.c (main): Remove file on success, and use
ASSERT more liberally.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoavoid new AC_REQUIRE expanded-before-required warnings
Jim Meyering [Mon, 16 Nov 2009 09:22:53 +0000 (10:22 +0100)]
avoid new AC_REQUIRE expanded-before-required warnings

* modules/chown (configure.ac): Require gl_FUNC_CHOWN, rather than
merely using it.
* modules/euidaccess (configure.ac): Likewise for gl_FUNC_EUIDACCESS.
* modules/faccessat (configure.ac): Likewise for gl_FUNC_FACCESSAT.

14 years agoAdd xalloc-die self-test.
Simon Josefsson [Sun, 15 Nov 2009 16:20:06 +0000 (17:20 +0100)]
Add xalloc-die self-test.

14 years agolib/gc-pbkdf2-sha1.c: Remove comments from RFC 2898.
Simon Josefsson [Sun, 15 Nov 2009 12:52:55 +0000 (13:52 +0100)]
lib/gc-pbkdf2-sha1.c: Remove comments from RFC 2898.

14 years agofnmatch: avoid compiler warning
Eric Blake [Sat, 14 Nov 2009 22:25:49 +0000 (15:25 -0700)]
fnmatch: avoid compiler warning

cond ? (size_t) : (char* - char* + 1) varies in signedness, but
using 1LU coerces the latter half to unsigned math.

* lib/fnmatch_loop.c (NEW_PATTERN): Coerce addition to unsigned,
to silence compiler warning about mismatch signedness in ?:.
Reported by Robert Millan.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agointprops: add double-inclusion guard
Eric Blake [Sat, 14 Nov 2009 22:09:08 +0000 (15:09 -0700)]
intprops: add double-inclusion guard

* lib/intprops.h: Allow idempotent includes.
Suggested by Bruce Korb.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: detect Solaris fchownat bug
Eric Blake [Sat, 14 Nov 2009 15:17:44 +0000 (08:17 -0700)]
openat: detect Solaris fchownat bug

Solaris 9 fchownat(dir,"name/",uid,gid,flag) has same bugs as
chown and lchown.

* lib/fchownat.c (rpl_fchownat): Work around Solaris bug.  Avoid
penalizing glibc chownat when only lchownat is broken.
* m4/openat.m4 (gl_FUNC_FCHOWNAT): Replace fchownat if there are
trailing slash bugs.
* doc/posix-functions/fchownat.texi (fchownat): Document the bug.
* modules/openat-tests (Files): Include more files.
(Depends-on): Add mgetgroups, sleep, stat-time.
(configure.ac): Add additional checks.
(Makefile.am): Build new test.
* tests/test-fchownat.c: New file.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agolchown: detect Solaris and FreeBSD bug
Eric Blake [Fri, 13 Nov 2009 04:45:20 +0000 (21:45 -0700)]
lchown: detect Solaris and FreeBSD bug

Solaris 9 and FreeBSD 7.2 lchown("link-to-file/",uid,gid)
mistakenly changes ownership of "file".

* lib/lchown.c (rpl_lchown): Work around bug.
* m4/lchown.m4 (gl_FUNC_LCHOWN): Check for trailing slash bugs.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Populate it.
* lib/unistd.in.h (lchown): Update declaration.
* doc/posix-functions/lchown.texi (lchown): Document the bug.
* modules/lchown-tests: New file.
* tests/test-lchown.h (test_lchown): Likewise.
* tests/test-lchown.c (main): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agochown: detect Solaris and FreeBSD bug
Eric Blake [Fri, 13 Nov 2009 04:45:20 +0000 (21:45 -0700)]
chown: detect Solaris and FreeBSD bug

Solaris 9 and FreeBSD 7.2 chown("link-to-file/",uid,gid)
mistakenly changes ownership of "file".

* lib/chown.c (rpl_chown): Work around bug.
* m4/chown.m4 (gl_FUNC_CHOWN): Check for trailing slash bugs.
(gl_PREREQ_CHOWN): Delete.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Populate it.
* lib/unistd.in.h (chown): Update declaration.
* lib/lchown.c (chown): Update client.
* modules/lchown (Depends-on): Add lstat.
* doc/posix-functions/chown.texi (chown): Document the bug.
* doc/posix-functions/getgroups.texi (getgroups): Document
getgroups pitfall.
* modules/chown-tests: New file.
* tests/test-chown.h (test_chown): Likewise.
* tests/test-chown.c (main): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agognulib-tool: correctly detect absence of m4 directories
Robert Millan [Sat, 14 Nov 2009 13:45:02 +0000 (06:45 -0700)]
gnulib-tool: correctly detect absence of m4 directories

$m4dirs is incorrectly counting.  In my particular case
(correct value: 0, detected value: 1), this resulted in gnulib-tool
silently exitting with no visible error (and no job done).

* gnulib-tool: Avoid extra newline on data passed to wc -l.

Signed-off-by: Eric Blake <ebb9@byu.net>