Eric Blake [Wed, 6 Jan 2010 14:09:03 +0000 (07:09 -0700)]
stdio, unistd: guarantee ssize_t
Per POSIX 2008, ssize_t needs to exist whether or not we are
replacing functions that use it. For now, we only guarantee
it if we know that the user expects a function that uses
that type, while waiting for glibc to catch up to POSIX.
* lib/unistd.in.h (includes): Ensure that types required by POSIX
2008 are exposed when needed.
* lib/stdio.in.h (includes): Likewise.
Reported by Ralf Wildenhues.
Jim Meyering [Wed, 6 Jan 2010 07:38:14 +0000 (08:38 +0100)]
readtokens: this module *does* require xalloc.h
It uses only functions that were omitted by the old syntax-check rule.
* lib/readtokens.c: Include "xalloc.h" once again.
* modules/readtokens (Depends-on): Add xalloc.
This reverts part of 0e0f8f12ec241c0f1c1f21f960bb5cf908a0fa3c.
Aurelien Jarno [Wed, 6 Jan 2010 03:27:12 +0000 (20:27 -0700)]
utimens (fdutimens): ignore a negative FD, per contract
* lib/utimens.c (fdutimens) [HAVE_FUTIMENS]: Call futimens only
when we have a valid file descriptor. Otherwise, using a brand
new glibc (with just-patched futimens that now fails with EBADF)
would cause this function to fail with ENOSYS.
Reported by Guillaume Ayoub in http://bugs.debian.org/563726.
See also http://bugzilla.redhat.com/552320.
Jim Meyering [Tue, 5 Jan 2010 14:12:15 +0000 (15:12 +0100)]
maint.mk: include 4 more function names in alloca.h-checking regexp
* top/maint.mk (sc_prohibit_xalloc_without_use): Use more complete
regexp. Before, we would give a false-positive (saying alloca.h
is included unnecessarily) when the only uses involved omitted symbols.
Jim Meyering [Mon, 4 Jan 2010 13:59:04 +0000 (14:59 +0100)]
nl_langinfo: avoid configure-time syntax error
* m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): When we've already tested
for nl_langinfo.h, AC_CHECK_FUNCS_ONCE([nl_langinfo]) expands to
the empty string. Don't let that provoke a shell syntax error.
* lib/regcomp.c (build_equiv_class): From glibc:
Use only the low 24 bits of a findidx return value as an index
into the weights array. Patch by Ulrich Drepper:
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=b7d1c5fa30
* lib/regexec.c (check_node_accept_bytes): Likewise.
* lib/fnmatch_loop.c (FCT): Likewise.
Jim Meyering [Mon, 4 Jan 2010 08:07:52 +0000 (09:07 +0100)]
regcomp: sync from glibc; always use nl_langinfo
* lib/regcomp.c (init_dfa) [!LIBC]: Always use nl_langinfo (CODESET),
now that gnulib provides it. Recognize UTF8 as well as UTF-8.
* lib/regex_internal.h: Always include <langinfo.h>, now.
* modules/regex (Depends-on): Add nl_langinfo.
Eric Blake [Thu, 31 Dec 2009 23:20:15 +0000 (16:20 -0700)]
headers: make check of system header explicit
Exploiting knowledge of internal behavior of other macros can
be dangerous, especially since AC_CHECK_HEADERS_ONCE is designed
to be cheap on subsequent use.
* m4/netdb_h.m4 (gl_HEADER_NETDB): Don't exploit knowledge of
gl_CHECK_NEXT_HEADER internals, but call AC_CHECK_HEADERS_ONCE
ourselves.
* m4/search_h.m4 (gl_SEARCH_H): Likewise.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
* m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Likewise.
* m4/inttypes.m4 (gl_INTTYPES_H): Likewise, for gt_INTTYPES_PRI
internals.
* m4/wchar.m4 (gl_WCHAR_H): Skip followup test if header is
missing.
Suggested by Bruno Haible.
Eric Blake [Thu, 31 Dec 2009 19:28:35 +0000 (12:28 -0700)]
utimens: avoid shadowing warning
lutimens declared struct stat st in two scopes. Worse, on Linux
kernels between 2.6.18 and 2.6.22 (when utimensat existed, but
rejected AT_SYMLINK_NOFOLLOW) or before 2.6.18 (if the glibc
headers have utimensat, but the kernel does not), it would
result in redundant [fl]stat calls.
* lib/utimens.c (fdutimens, lutimens): Consolidate separate stat
buffers into one, to avoid shadowing, as well as avoiding a
redundant stat.
Reported by Jim Meyering.
Jim Meyering [Thu, 31 Dec 2009 15:31:11 +0000 (16:31 +0100)]
maint.mk: don't require explicit gpg_key_ID in cfg.mk
* top/maint.mk (gpg_key_ID): Derive key ID from signed release tag.
With this change, we can all remove the gpg_key_ID = ... definition
from our respective cfg.mk files.
Eric Blake [Thu, 24 Dec 2009 19:06:48 +0000 (12:06 -0700)]
link-warning: always build headers with link warnings
Replacement headers must be built unconditionally if they use
GL_LINK_WARNING, if the warning is to ever trigger on a
glibc system during CFLAGS=-DGNULIB_POSIXCHECK.
Eric Blake [Wed, 30 Dec 2009 18:52:31 +0000 (11:52 -0700)]
spawn: improve wrapper support
Avoid type conflicts if overriding system header.
* m4/spawn_h.m4 (gl_SPAWN_H): Check for type existence.
(gl_SPAWN_H_DEFAULTS): New defaults.
* modules/spawn (Makefile.am): Substitute them.
* lib/spawn.in.h: (posix_spawnattr_t, posix_spawn_file_actions_t):
Only declare if missing or broken.
Eric Blake [Wed, 30 Dec 2009 23:14:05 +0000 (16:14 -0700)]
unistd: fix typo
This typo ended up incompatibly re-defining the macro link()
during -DGNULIB_POSIXCHECK=1. However, gcc's pragma system_header
squelches that particular warning, so this typo went unnoticed.
Eric Blake [Wed, 30 Dec 2009 13:48:46 +0000 (06:48 -0700)]
futimens, utimensat: work around ntfs-3g bug
With ntfs-3g, use of a single UTIME_OMIT failed to make any change
to the remaining two timestamps. Furthermore, the previous fix
for ctime happens to be specific to xfs, rather than global to
the kernel. Therefore, to be valid, a cache would have to be
per-device, which gets too expensive, especially considering that
the cost of a preparatory stat pulls the file into kernel cache
to speed up the resulting utimensat. So, blindly massage UTIME_OMIT
on Linux, even on working filesystems like ext4.
The bugs in xfs and ntfs-3g were reported to the kernel folks,
and fixes written, but it will be several years before gnulib
can assume that file systems in use have picked up the fixes.
* lib/utimensat.c (rpl_utimensat): Drop attempts to cache whether
a ctime bug is present, and expand workaround to cover ntfs-3g.
* lib/utimens.c (fdutimens, lutimens): Likewise.
(utimensat_ctime_really, detect_ctime_bug): Drop cache mechanism.
(validate_timespec): Adjust return value.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Update comment.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise.
Reported by ctrn3e8 <ctrn3e8@gmail.com>.
Eric Blake [Tue, 29 Dec 2009 22:45:18 +0000 (15:45 -0700)]
tests: remove License section from module
Per modules/TEMPLATE-TESTS, test modules do not need a license
section. This is because all tests are implicitly GPLv3+, with
no conflict even in an LGPL or GPLv2 client, because the tests
are not linked into the client executable. Delete the existing
License sections with the following:
find modules -name '*-tests' | xargs grep -l License \
| xargs sed -i '/^$/N; /License:/,$ d'
Jim Meyering [Mon, 28 Dec 2009 09:50:36 +0000 (10:50 +0100)]
update nearly all FSF copyright year lists to include 2009
The files named by the following are exempted:
grep -v '^#' config/srclist.txt|grep -v '^$' \
| while read src dst; do
test -f "$dst" && { echo "$dst"; continue; }
test -d "$dst" || continue
echo "$dst"/$(basename "$src")
done > exempt
git ls-files tests/unictype >> exempt
In the remaining files, convert to all-interval notation if
- there is already at least one year interval like 2000-2003
- the file is maintained by me
- the file is in lib/uni*/, where that style already prevails
Otherwise, use update-copyright's default.
Eric Blake [Tue, 29 Dec 2009 13:58:18 +0000 (06:58 -0700)]
tests: don't require debug system() to pass
When running a cross-compilation to mingw on a Linux host,
but without a valid mingw rm executable, the debug-only
system() call would fail. This is not fatal to the test,
since the call is merely a debugging aid if a prior call to
the test encountered a failure and left garbage; in general,
the tests should pass and the system() call have nothing to
clean in the first place. Also, the system() call only
needs to happen once at startup, not once per iteration
into the tests performed by .h files.
Eric Blake [Mon, 28 Dec 2009 13:24:04 +0000 (06:24 -0700)]
test-dup2: reduce dependencies
dup2 is fully tested if the cloexec module is in use, but it is
also used in a number of modules where dragging in cloexec is
over the top for just using dup2 to test whether an fd is valid.
* modules/cloexec (Configure.ac): Set witness.
* modules/dup2-tests (Depends-on): Drop cloexec.
* tests/test-dup2.c (main): Skip portion of test if cloexec module
not present.
Suggested by Bruno Haible.