gnulib.git
14 years agoautoupdate
Karl Berry [Sat, 12 Dec 2009 16:46:42 +0000 (08:46 -0800)]
autoupdate

14 years agotab changes -> no sync for strtoll.c
Karl Berry [Sat, 12 Dec 2009 16:44:50 +0000 (08:44 -0800)]
tab changes -> no sync for strtoll.c

14 years agoTweak whitespace.
Bruno Haible [Sat, 12 Dec 2009 14:33:49 +0000 (15:33 +0100)]
Tweak whitespace.

14 years agoUndo incorrect untabification.
Bruno Haible [Sat, 12 Dec 2009 14:31:09 +0000 (15:31 +0100)]
Undo incorrect untabification.

14 years agoc-strtod, c-strtold: Use the multithread-safe implementation on MacOS X.
Bruno Haible [Sat, 12 Dec 2009 14:13:35 +0000 (15:13 +0100)]
c-strtod, c-strtold: Use the multithread-safe implementation on MacOS X.

14 years agolocalcharset: Add comment.
Bruno Haible [Sat, 12 Dec 2009 13:46:27 +0000 (14:46 +0100)]
localcharset: Add comment.

14 years agosetenv: relax requirement in light of POSIX ruling
Eric Blake [Thu, 10 Dec 2009 19:18:31 +0000 (12:18 -0700)]
setenv: relax requirement in light of POSIX ruling

Requiring that {un,}setenv gracefully reject NULL is just a waste
of processing power; POSIX agreed to this argument in
 http://austingroupbugs.net/view.php?id=185
so we no longer worry whether a native implementation handles NULL.

* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Test handling of "" but
not NULL.
* tests/test-setenv.c (main): Relax test.
* tests/test-unsetenv.c (main): Likewise.
* doc/posix-functions/setenv.texi (setenv): Document this.
* doc/posix-functions/unsetenv.texi (unsetenv): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoNew module 'fd-safer-flag'.
Bruno Haible [Fri, 11 Dec 2009 19:59:01 +0000 (20:59 +0100)]
New module 'fd-safer-flag'.

14 years agoTests for module 'nl_langinfo'.
Bruno Haible [Fri, 11 Dec 2009 19:11:22 +0000 (20:11 +0100)]
Tests for module 'nl_langinfo'.

14 years agoNew module 'nl_langinfo'.
Bruno Haible [Fri, 11 Dec 2009 19:09:02 +0000 (20:09 +0100)]
New module 'nl_langinfo'.

14 years agoTests for module 'langinfo'.
Bruno Haible [Fri, 11 Dec 2009 18:59:02 +0000 (19:59 +0100)]
Tests for module 'langinfo'.

14 years agoNew module 'langinfo'.
Bruno Haible [Fri, 11 Dec 2009 18:57:37 +0000 (19:57 +0100)]
New module 'langinfo'.

14 years agoUntabify.
Bruno Haible [Fri, 11 Dec 2009 16:55:51 +0000 (17:55 +0100)]
Untabify.

14 years agoChangeLog: remove spurious byte
Eric Blake [Fri, 11 Dec 2009 16:33:55 +0000 (09:33 -0700)]
ChangeLog: remove spurious byte

14 years agounistd-safer: Remove unused indicator macro.
Bruno Haible [Fri, 11 Dec 2009 16:24:22 +0000 (17:24 +0100)]
unistd-safer: Remove unused indicator macro.

14 years agoMove pipe2-safer code to its own file.
Bruno Haible [Fri, 11 Dec 2009 14:28:11 +0000 (15:28 +0100)]
Move pipe2-safer code to its own file.

14 years agorecvfrom: Allow NULL argument.
Bruno Haible [Fri, 11 Dec 2009 00:31:21 +0000 (01:31 +0100)]
recvfrom: Allow NULL argument.

14 years agoNew module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible [Fri, 11 Dec 2009 00:15:28 +0000 (01:15 +0100)]
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.

14 years agoUse spaces for indentation, not tabs.
Bruno Haible [Thu, 10 Dec 2009 19:28:30 +0000 (20:28 +0100)]
Use spaces for indentation, not tabs.

14 years agopty test: Fix link error.
Bruno Haible [Thu, 10 Dec 2009 18:15:51 +0000 (19:15 +0100)]
pty test: Fix link error.

14 years agoAdd pty module for forkpty and openpty.
Simon Josefsson [Thu, 10 Dec 2009 13:14:13 +0000 (14:14 +0100)]
Add pty module for forkpty and openpty.

14 years agostdio: Avoid syntax error in C++ mode.
Bruno Haible [Thu, 10 Dec 2009 13:08:47 +0000 (14:08 +0100)]
stdio: Avoid syntax error in C++ mode.

14 years agoUse sed with option -e.
Bruno Haible [Thu, 10 Dec 2009 11:22:41 +0000 (12:22 +0100)]
Use sed with option -e.

14 years agomgetgroups: do not write bytes beyond end of malloc'd buffer
Jim Meyering [Thu, 10 Dec 2009 11:17:19 +0000 (12:17 +0100)]
mgetgroups: do not write bytes beyond end of malloc'd buffer

* lib/mgetgroups.c: Fix an off-by-one error.  When we have no
username, we call getgroups with a one-element-shorter buffer,
but still told it the length was original, max_n_groups.

14 years agocloexec: relax license
Eric Blake [Thu, 10 Dec 2009 00:14:12 +0000 (17:14 -0700)]
cloexec: relax license

cloexec is a thin wrapper around fcntl, which is a glibc function
and therefore reasonable for LGPL.  Jim Meyering and Bruno Haible
agreed to the change.

* modules/cloexec (Maintainer): Add myself.
(License): Use LGPL, not GPL.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agolink-warning: optimize generation
Eric Blake [Wed, 9 Dec 2009 23:11:27 +0000 (16:11 -0700)]
link-warning: optimize generation

Avoid a useless use of cat.

* modules/link-warning (Makefile.am): Reduce process usage.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agounsetenv: Document last workaround.
Bruno Haible [Wed, 9 Dec 2009 21:04:36 +0000 (22:04 +0100)]
unsetenv: Document last workaround.

14 years agolink-warning: Allow extra lines at the top of build-aux/link-warning.h.
Jim Meyering [Wed, 9 Dec 2009 16:34:02 +0000 (17:34 +0100)]
link-warning: Allow extra lines at the top of build-aux/link-warning.h.

14 years agomgetgroups: Avoid undefined behaviour when ng == 0.
Bruno Haible [Wed, 9 Dec 2009 13:13:08 +0000 (14:13 +0100)]
mgetgroups: Avoid undefined behaviour when ng == 0.

14 years agolink-warning: Add copyright notice.
Bruno Haible [Wed, 9 Dec 2009 11:41:19 +0000 (12:41 +0100)]
link-warning: Add copyright notice.

14 years agofchdir: Optimize away rpl_fstat when possible.
Bruno Haible [Wed, 9 Dec 2009 11:11:36 +0000 (12:11 +0100)]
fchdir: Optimize away rpl_fstat when possible.

14 years agofchdir: Update comment.
Bruno Haible [Wed, 9 Dec 2009 10:49:30 +0000 (11:49 +0100)]
fchdir: Update comment.

14 years agoFix a recent ChangeLog entry.
Bruno Haible [Wed, 9 Dec 2009 10:37:17 +0000 (11:37 +0100)]
Fix a recent ChangeLog entry.

14 years agocloexec: Clarify code.
Bruno Haible [Wed, 9 Dec 2009 10:21:35 +0000 (11:21 +0100)]
cloexec: Clarify code.

14 years agofchdir: avoid memory leak on re-registration.
Eric Blake [Tue, 8 Dec 2009 17:23:27 +0000 (10:23 -0700)]
fchdir: avoid memory leak on re-registration.

Some code paths (such as dup3) could overwrite one registered
directory fd with another, and must not leak the old name.

* lib/fchdir.c (ensure_dirs_slot): Avoid memory leak.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoinit.sh: avoid Solaris 10 /bin/sh portability problem
Jim Meyering [Tue, 8 Dec 2009 19:37:50 +0000 (20:37 +0100)]
init.sh: avoid Solaris 10 /bin/sh portability problem

Solaris 10's /bin/sh does not pass '.' arguments 2..N to the
sourced script:
  $ printf 'echo "$@"\n' > f; /bin/sh -c '. ./f bar'
  $ printf 'echo "$@"\n' > f;    bash -c '. ./f bar'
  bar
tests/init.sh relied on that, accepting a --set-path=DIR argument,
and two tests used that idiom.
* tests/init.sh: Update suggested usage comments.
(path_prepend_): New function, to be used in place of
the --src-path=DIR option.
Disallow empty strings and strings containing ":".
(setup_): Move PATH-prepending code into path_prepend_.
* tests/test-pread.sh: Adapt to new usage.
* tests/test-xalloc-die.sh: Likewise.

14 years agoDocument pty.h functions.
Simon Josefsson [Tue, 8 Dec 2009 16:44:19 +0000 (17:44 +0100)]
Document pty.h functions.

14 years agofchdir: fix logic bugs
Eric Blake [Tue, 8 Dec 2009 13:13:05 +0000 (06:13 -0700)]
fchdir: fix logic bugs

Configuring with ac_cv_func_fchdir=no on a system that has fchdir
and where open handles directories, just to test out the replacement
capabilities, uncovered an m4 test bug and a link failure on rpl_fstat.

* m4/fchdir.m4 (gl_FUNC_FCHDIR): Fix logic bug.
* tests/test-fchdir.c (main): Enhance test.
* lib/fchdir.c (rpl_fstat): Always provide if fchdir replacement
is in use.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agodup2: fix logic bugs
Eric Blake [Tue, 8 Dec 2009 04:08:17 +0000 (21:08 -0700)]
dup2: fix logic bugs

If the platform has dup2, don't register with fchdir if the
destination was -1.

If the platform lacks dup2 (are there any these days?), then don't
close the destination unless the source is valid, make sure errno
is correct, and only register with fchdir on fcntl (since dup is
already overridden to do a registration).

* lib/dup2.c (dup2): Fix logic bugs.  Use HAVE_DUP2 rather than
REPLACE_DUP2 to decide when rpl_dup2 is needed.
* m4/dup2.m4 (gl_REPLACE_DUP2): Only define REPLACE_DUP2 when dup2
exists.
(gl_FUNC_DUP2): Drop unneeded AC_SUBST.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agounlink: fix m4 detection
Eric Blake [Tue, 8 Dec 2009 00:15:07 +0000 (17:15 -0700)]
unlink: fix m4 detection

The m4 test failed under -Werror due to implicit declaration.

* m4/unlink.m4 (gl_FUNC_UNLINK): Include correct header.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agounistd-safer: add unit test
Eric Blake [Mon, 7 Dec 2009 17:17:07 +0000 (10:17 -0700)]
unistd-safer: add unit test

Add more unit tests.  Meanwhile, fix compilation error on mingw when
testing unistd-safer and fchdir together; and avoid gcc warning on
platforms without setmode.

* modules/unistd-safer-tests: New file.
* tests/test-dup-safer.c: Likewise.
* tests/test-cloexec.c (setmode): Avoid compiler warning.
* tests/test-dup2.c (setmode): Likewise.
* lib/cloexec.c (dup_cloexec): Fix mingw compile error.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocloexec: preserve text vs. binary across dup_cloexec
Eric Blake [Mon, 7 Dec 2009 13:53:59 +0000 (06:53 -0700)]
cloexec: preserve text vs. binary across dup_cloexec

On mingw, dup_cloexec mistakenly converted a text fd into a
binary fd.  Cygwin copied the source mode.  Most other platforms
don't distinguish between modes.

* lib/cloexec.c (dup_cloexec) [W32]: Query and use translation
mode.
* modules/dup2-tests (Depends-on): Add binary-io.
* modules/cloexec-tests (Depends-on): Likewise.
* tests/test-dup2.c (setmode, is_mode): New helpers.
(main): Add tests that translation mode is preserved.
* tests/test-cloexec.c (setmode, is_mode, main): Likewise.
Reported by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomgetgroups: reduce duplicate listings
Eric Blake [Fri, 4 Dec 2009 21:07:58 +0000 (14:07 -0700)]
mgetgroups: reduce duplicate listings

POSIX doesn't guarantee whether the effective gid is included in
the list of supplementary groups returned by getgroups.  On the
other hand, some platforms include the effective gid twice in
the list.  Meanwhile, mgetgroups can independently add a duplicate.
Rather than spend a full-blown O(n log n) cleanup, we just remove
the most common forms of duplicate groups with an O(n) pass.

* lib/mgetgroups.c (mgetgroups): Reduce duplicates from the
resulting array.
* tests/test-chown.h (test_chown): Simplify client.
* tests/test-lchown.h (test_lchown): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocloexec: Fix possible compilation error.
Bruno Haible [Mon, 7 Dec 2009 00:02:50 +0000 (01:02 +0100)]
cloexec: Fix possible compilation error.

14 years agoprognam: Add diagnostic.
Bruno Haible [Sun, 6 Dec 2009 22:19:49 +0000 (23:19 +0100)]
prognam: Add diagnostic.

14 years agopipe2-safer: new module
Eric Blake [Sat, 5 Dec 2009 13:39:09 +0000 (06:39 -0700)]
pipe2-safer: new module

pipe2 deserves a *_safer variant.  It also makes the code in
pipe.c look simpler.

* modules/pipe2-safer: New file.
* lib/unistd-safer.h (pipe2_safer): New prototype.
* lib/unistd--.h (pipe2): New wrapper.
* lib/pipe-safer.c (pipe2_safer): New function.
* modules/pipe (Depends-on): Add pipe2-safer.
* lib/pipe.c (create_pipe) [WIN32]: Let pipe2_safer do the work.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostdlib-safer: preserve cloexec flag for mkostemp[s]
Eric Blake [Mon, 16 Nov 2009 23:09:42 +0000 (16:09 -0700)]
stdlib-safer: preserve cloexec flag for mkostemp[s]

mkostemp_safer(templ,O_CLOEXEC) did not always guarantee cloexec.

* lib/mkstemp-safer.c (mkostemp_safer, mkostemps_safer): Use new
fd_safer_flag.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agounistd-safer: allow preservation of cloexec status via flag
Eric Blake [Sat, 5 Dec 2009 13:36:33 +0000 (06:36 -0700)]
unistd-safer: allow preservation of cloexec status via flag

If cloexec is in use, allow the ability to preserve cloexec
flag across *_safer functions.

* lib/unistd-safer.h (dup_safer_flag, fd_safer_flag): New
prototypes.
* lib/dup-safer.c (dup_safer_flag): New function.
* lib/fd-safer.c (fd_safer_flag): Likewise.
* modules/cloexec (configure.ac): Set witness.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-dup2: enhance test
Eric Blake [Sat, 5 Dec 2009 13:19:01 +0000 (06:19 -0700)]
test-dup2: enhance test

Ensure that dup2(cloexec_fd, target) returns an inheritable fd.

* modules/dup2-tests (Depends-on): Add cloexec.
* tests/test-dup2.c (main): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocloexec: add dup_cloexec
Eric Blake [Sat, 5 Dec 2009 05:10:44 +0000 (22:10 -0700)]
cloexec: add dup_cloexec

This is needed to enforce correct semantics of mkostemp_safer.
Meanwhile, it is one step closer to providing O_CLOEXEC support
to open, as well as implementing portions of fcntl for mingw.

* lib/cloexec.h (dup_cloexec): New prototype.  Add copyright
header and comments.
* lib/cloexec.c (set_cloexec_flag): Add comments.
(dup_cloexec): New function, with mingw implementation borrowed
from...
* lib/w32spawn.h (dup_noinherit): ...here.
* modules/execute (Depends-on): Add cloexec.
* modules/pipe (Depends-on): Likewise.
* modules/cloexec (Depends-on): Add dup2.
* modules/cloexec-tests (Files): New file.
* tests/test-cloexec.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-xalloc-die: fix test for mingw
Eric Blake [Sat, 5 Dec 2009 16:24:54 +0000 (09:24 -0700)]
test-xalloc-die: fix test for mingw

When cross-compiling on mingw to target mingw, argv[0] still includes
a .exe suffix.  Rather than worry about ${EXEEXT}, just add a sed
post-process.  Also, simplify the script by using tests/init.sh.

* modules/xalloc-die-tests (Files): Add tests/init.sh.
* tests/test-xalloc-die.sh: Rewrite to use init.sh.  Strip
directory and .exe suffix off argv[0] output.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-fseeko: fix test for mingw
Eric Blake [Sat, 5 Dec 2009 16:07:28 +0000 (09:07 -0700)]
test-fseeko: fix test for mingw

Undefining fseek made test-fseeko.sh fail when testing on pipes.

* tests/test-fseeko.c (fseek): Redefine GL_LINK_WARNING, rather
than undefining fseek, so test will pass on mingw.

Signed-off-by: Eric Blake <ebb9@byu.net>
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.