Jim Meyering [Fri, 15 Oct 2010 18:12:52 +0000 (20:12 +0200)]
GNUmakefile: handle "stable" target, not "major"
* top/GNUmakefile (_is-dist-target): s/major/stable/ to match the
lists in maint.mk and announce-gen. Without this, "make stable"
would fail to ensure that $(VERSION) is up to date.
Jim Meyering [Wed, 13 Oct 2010 20:11:31 +0000 (22:11 +0200)]
git-version-gen: do require git-VC'd files in cwd
* build-aux/git-version-gen: Reject a git version string
if there are no commits associated with the current directory.
This avoids an unlikely false-positive (unrelated dir whose parent
repository also contains a tag matching v*), as pointed out
by Giuseppe Scrivano in
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/21843/focus=23664
Eric Blake [Wed, 13 Oct 2010 20:54:00 +0000 (14:54 -0600)]
termios: fix compilation on mingw
* m4/termios_h.m4 (gl_TERMIOS_H_DEFAULTS): Set default.
(gl_TERMIOS_H): Adjust it on mingw.
* modules/termios (Makefile.am): Substitute new key.
* lib/termios.in.h (includes): Make include_next conditional.
* doc/posix-headers/termios.texi (termios.h): Update
documentation.
Reported by Daniel P. Berrange.
Jim Meyering [Wed, 13 Oct 2010 14:08:36 +0000 (16:08 +0200)]
git-version-gen: don't require that .git/ be in the current dir
* build-aux/git-version-gen: Adjust this script so that it works
when run from any working directory beneath the top-level .git/-
containing directory. Inspired by a patch from Giusseppe Scrivano,
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/21843/focus=21847
Jim Meyering [Wed, 13 Oct 2010 08:15:38 +0000 (10:15 +0200)]
test-select: avoid warn_unused_result warnings
* tests/test-select.c: Include "macros.h".
ASSERT that each call to read, write, and pipe succeeds.
While not technically required, also check each "close".
* modules/select-tests (Files): Add tests/macros.h.
Jim Meyering [Wed, 13 Oct 2010 08:02:17 +0000 (10:02 +0200)]
test-inttostr: avoid shadowing warnings
* tests/test-inttostr.c (main): Rename local, "buf" to "b",
and use malloc rather than the stack for the same reason as
mentioned in the comment justifying the other allocation.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Detect the bug.
* tests/test-futimens.h (test_futimens): Enhance, rather than
weaken test.
* doc/posix-functions/futimens.texi (futimens): Document the bug.
Jim Meyering [Mon, 11 Oct 2010 10:44:56 +0000 (12:44 +0200)]
test-futimens: avoid unwarranted test failure on Solaris 5.11
* tests/test-futimens.h (test_futimens): When provoking EBADF, use an
invalid file descriptor, so we don't provoke EFAULT from Solaris 5.11,
because it tries to dereference the NULL name argument.
Paul Eggert [Sun, 10 Oct 2010 20:36:34 +0000 (13:36 -0700)]
prefer (X ? 1 : -1) when converting from boolean (1,0) to int (1,-1)
Formerly the style was sometimes 2*X - 1, because the C standard
was wrongly thought to disallow ?: in integral constant expressions.
* lib/inet_ntop.c (verify_int_size): Rewrite 2*X-7 (!) to 4<=X?1:-1.
* lib/signal.in.h (verify_NSIG_constraint): Rewrite 2*X-1 to X?1:-1.
* lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise.
* lib/stdint.in.h (_verify_intmax_size): Likewise.
* lib/time.in.h (struct __time_t_must_be_integral): Rewrite
2 * ((time_t) 1 / 2 == 0) - 1 to (time_t) 1; this suffices to
verify that time_t cannot be floating.
Jim Meyering [Fri, 8 Oct 2010 16:42:59 +0000 (18:42 +0200)]
fdopendir: fix a bug on systems lacking openat and /proc support
OpenBSD 4.7 is one such system. The most noticeable effect was
failure of any application making nontrivial use of fts: rm, du,
chown, chmod etc. E.g., "mkdir -p a/b; ./rm -rf a" would fail with
./rm: traversal failed: `a': Bad file descriptor
Debugging that, you see that even though FD 6 was closed just
prior to the opendir call in fd_clone_opendir, its resulting
dir->dd_fd was 8, rather than the expected value of 6:
Breakpoint 3, fdopendir_with_dup (fd=6, older_dupfd=-1) at fdopendir.c:93
93 close (fd);
(gdb) n
94 dir = fd_clone_opendir (dupfd);
(gdb) n
95 saved_errno = errno;
(gdb) p dir->dd_fd
$11 = 8
Notice how it closes FD 6, then gets a DIR* pointer using FD 8.
The problem is that on OpenBSD, fd_clone_opendir has to resort
to using the old-style save/restore CWD mechanism, due to its
lack of openat/proc support, and *that* would steal the FD (6)
that opendir was supposed to use.
The fix is to squirrel away the desired FD so that save_cwd uses a
different one, and then free the dest FD right before calling opendir.
That guarantees opendir will use the required file descriptor.
* lib/fdopendir.c (fd_clone_opendir): Handle the above.
Paul Eggert [Fri, 8 Oct 2010 17:08:12 +0000 (10:08 -0700)]
bootstrap: add hook for altering gnulib.mk, for Bison
* build-aux/bootstrap (gnulib_mk_hook): New function, so that
the Bison bootstrapping process can rewrite file names and variables
in this file before later parts of 'bootstrap' use the file.
Bison wants to include lib/gnulib.mk from the top-level makefile,
so it needs the file names in this file to be relative to the top
level, not relative to lib; plus it needs variable names to be
rewritten.
(slurp): Use the new function.
Jim Meyering [Thu, 7 Oct 2010 21:15:00 +0000 (23:15 +0200)]
parse-datetime: avoid compilation failure on OpenBSD 4.7
* lib/parse-datetime.y (_STDLIB_H) [_STDLIB_H_]: Define.
This works around a compilation failure on OpenBSD 4.7:
http://thread.gmane.org/gmane.comp.parsers.bison.bugs/3418
Bruno Haible [Wed, 6 Oct 2010 22:52:15 +0000 (00:52 +0200)]
string, sys_select: Avoid #including large headers unless necessary.
* lib/string.in.h: Don't include <unistd.h> except on NetBSD.
* lib/sys_select.in.h: Don't include <string.h> except on Solaris,
OSF/1, BeOS, Haiku.
Reported by Jim Meyering.
Paul Eggert [Tue, 5 Oct 2010 20:51:12 +0000 (13:51 -0700)]
parse-datetime: do some more renaming
* doc/parse-datetime.texi (Authors of parse_datetime): Call it
parse_datetime, not get_date. Mention the renaming.
* lib/parse-datetime.y: Call it parse_datetime, not getdate,
in comments.
* m4/bison.m4: Likewise.
Eric Blake [Tue, 5 Oct 2010 12:35:44 +0000 (06:35 -0600)]
bootstrap: work with pkg-config
* build-aux/bootstrap (found_aux_dir): Also transliterate - in
prerequisite name.
(print_versions): Be robust to any \ in $buildreq. Avoid listing
prerequisites that were already found, to avoid confusion.
Eric Blake [Tue, 5 Oct 2010 14:06:50 +0000 (08:06 -0600)]
faccessat: remove unused wrappers
* lib/openat.h (accessat, euidaccesat): Delete, since the mere
presence of these wrappers dragged in -lgen on Solaris.
Reported by Clemens Brogi; fix suggested by Paul Eggert.
Bruno Haible [Tue, 5 Oct 2010 00:30:24 +0000 (02:30 +0200)]
gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
* gnulib-tool (func_emit_lib_Makefile_am): When preparing for a libtool
library, put '-no-undefined' and the link dependencies into _LDFLAGS.
Reported by Bruce Korb and Eric Blake.
Bruno Haible [Mon, 4 Oct 2010 00:23:23 +0000 (02:23 +0200)]
gnulib-tool: Fixes for --create-testdir with --libtool.
* gnulib-tool (func_get_automake_snippet): Don't augment
EXTRA_lib_SOURCES for the pt_chown module, since pt_chown.o goes into
an executable.
(func_create_testdir): Handle module 'alloca' like func_import.
Reported by Bruce Korb <bruce.korb@gmail.com>.
Bruno Haible [Sun, 3 Oct 2010 16:03:48 +0000 (18:03 +0200)]
acl: Add support for ACLs on NonStop Kernel.
* m4/acl.m4 (gl_FUNC_ACL): For Solaris, test for facl(), not for acl().
Check whether the function aclsort() exists.
* lib/acl-internal.h: For Solaris, test HAVE_FACL, not HAVE_ACL.
(acl_nontrivial) [HAVE_ACLSORT]: New declaration.
* lib/file-has-acl.c: For Solaris, test HAVE_FACL, not HAVE_ACL.
(acl_nontrivial [HAVE_ACLSORT]: New function.
(file_has_acl): Implement for NonStop Kernel.
* lib/set-mode-acl.c: For Solaris, test HAVE_FACL, not HAVE_ACL.
(qset_acl): Implement for NonStop Kernel.
* lib/copy-acl.c (qcopy_acl): Implement for NonStop Kernel.
* tests/test-sameacls.c: For Solaris, test HAVE_FACL, not HAVE_ACL.
(main): Implement for NonStop Kernel.
* tests/test-file-has-acl.sh (acl_flavor): Set to 'nsk' on NonStop
Kernel. Handle this flavor.
* tests/test-set-mode-acl.sh: Likewise.
* tests/test-copy-acl.sh: Likewise.
* tests/test-copy-file.sh: Likewise.
Bruno Haible [Sat, 2 Oct 2010 16:54:05 +0000 (18:54 +0200)]
Define missing EDQUOT on NonStop Kernel.
* lib/errno.in.h (EDQUOT): Assign a value if missing.
* lib/strerror.c (rpl_strerror): Handle missing EDQUOT.
* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Also test whether EDQUOT is
missing.
* doc/posix-headers/errno.texi: Mention the NSK bug.
* doc/posix-functions/strerror.texi: Mention the workaround on NSK.
Reported by Joachim Schmitz <schmitz@hp.com>.
Bruno Haible [Sat, 2 Oct 2010 09:44:20 +0000 (11:44 +0200)]
New module 'system-posix'.
* modules/system-posix: New file.
* lib/stdlib.in.h: Include <sys/wait.h> only when the 'system-posix'
module is present.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize
GNULIB_SYSTEM_POSIX.
* modules/stdlib (Depends-on): Remove sys_wait.
(Makefile.am): Substitute GNULIB_SYSTEM_POSIX.
* doc/posix-functions/system.texi: Mention the new module.
* doc/posix-headers/stdlib.texi: Likewise.
* tests/test-stdlib.c: If GNULIB_TEST_SYSTEM_POSIX is not defined,
define test_sys_wait_macros to a no-op.
Reported by Sam Steingold <sds@gnu.org>.
Eric Blake [Thu, 30 Sep 2010 17:14:11 +0000 (11:14 -0600)]
bootstrap: use glibtoolize on MacOS
* build-aux/bootstrap (check_versions): Convert libtool into
libtoolize.
(tool search): Move libtool check earlier, and look for
glibtoolize for MacOS.
(gnulib_tool_options): Auto-add --libtool when appropriate.
Reported by Justin Clift.
Eric Blake [Thu, 30 Sep 2010 15:23:12 +0000 (09:23 -0600)]
getdate: rename to get_date
Note: getdate.h is not renamed, to minimize client impact.
Besides, whenever we eventually add getdate-posix, we'll
want to use getdate.m4 and getdate.c for the implementation,
but don't need to worry about getdate.h since getdate() uses
<time.h> for its header.
* modules/getdate: Mark obsolete. Move old contents...
* modules/get_date: ...to new module name.
* modules/getdate-tests: Move...
* modules/get_date-tests: ...here.
* m4/getdate.m4: Move...
* m4/get_date.m4: ...here, and rename gl_GETDATE to gl_GET_DATE.
* lib/getdate.y: Move...
* lib/get_date.y: ...here.
* tests/test-getdate.c: Move...
* tests/test-get_date.c: ...here.
* doc/posix-functions/getdate.texi (getdate): Update name.
* NEWS: Mention the change.
Bruno Haible [Tue, 28 Sep 2010 23:00:17 +0000 (01:00 +0200)]
New module 'poll-h'.
* lib/poll.in.h: Include c++defs.h and warn-on-use.h.
(poll): Use modern idiom.
* modules/poll-h: New file.
* modules/poll (Files): Remove lib/poll.in.h.
(Depends-on): Add poll-h.
(configure.ac): Invoke gl_POLL_MODULE_INDICATOR.
(Makefile.am): Move code for generation of poll.h to modules/poll-h.
* m4/poll_h.m4: New file.
* m4/poll.m4 (gl_FUNC_POLL): Require gl_POLL_H. Don't check for poll.h
here. Don't set POLL_H here. Instead, set HAVE_POLL and REPLACE_POLL
and invoke gl_REPLACE_POLL_H.
* lib/poll.c: Use common idiom.
* tests/test-poll.c: Likewise.
* doc/posix-headers/poll.texi: Mention the poll-h module.
Suggested by Eric Blake.
Paul Eggert [Wed, 22 Sep 2010 08:32:19 +0000 (01:32 -0700)]
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
* lib/pthread.in.h: Add split double-inclusion guard, and include
system <pthread.h> if there is one. Use @@-style as in other
.in.h files. Define PTHREAD_COND_INITIALIZER etc. only if system
pthread.h doesn't.
(pthread_mutexattr_destroy, pthread_mutexattr_init):
(pthread_mutexattr_settype, pthread_mutex_trylock):
New static inline functions, if there's no system <pthread.h>.
(pthread_spinlock_t, pthread_spin_init, pthread_spin_destroy):
(pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock):
Approximate with mutexes if the system lacks spinlocks, as in
MacOS.
* m4/pthread.m4 (gl_PTHREAD_CHECK): Require gl_PTHREAD_DEFAULTS.
Add gl_CHECK_NEXT_HEADERS for pthread.h, and support the usual
@@-style. Check for spinlocks separately.
(gl_PTHREAD_DEFAULTS): New macro.
* modules/pthread: Redo to use a more typical style for in.h files.
Eric Blake [Tue, 21 Sep 2010 21:27:59 +0000 (15:27 -0600)]
net_if: enhance tests
* tests/test-net_if.c (main): Move signature checks earlier.
Print failures to stderr.
* doc/posix-functions/if_freenameindex.texi (if_freenameindex):
Document the bug that we do not yet fix.