Bruno Haible [Sun, 8 May 2011 19:03:04 +0000 (21:03 +0200)]
iconv_open, iconv_open-utf: Respect rules for use of AC_LIBOBJ.
If module 'iconv_open' is among the main modules and module
'iconv_open-utf' is among the tests dependencies, then
REPLACE_ICONV_UTF will be defined to 1, hence iconv_open() in lib may
return the special iconv_t values. Therefore iconv() and iconv_close()
must support these special iconv_t values, already in lib, not only in
tests.
* m4/iconv_open-utf.m4: New file, extracted from m4/iconv_open.m4.
* m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN): Invoke
gl_FUNC_ICONV_OPEN_UTF_SUPPORT if present.
(gl_FUNC_ICONV_OPEN_UTF): Remove macro.
* modules/iconv_open (Files): Add lib/iconv.c, lib/iconv_close.c.
(Depends-on): Add the dependencies of iconv_open-utf.
* modules/iconv_open-utf (Files): Add m4/iconv_open-utf.m4. Remove
m4/iconv_open.m4, lib/iconv.c, lib/iconv_close.c.
(Depends-on): Remove modules needed by lib/iconv.c, lib/iconv_close.c.
Bruno Haible [Sun, 8 May 2011 18:42:41 +0000 (20:42 +0200)]
group-member: Move AC_LIBOBJ invocations to module description.
* m4/group-member.m4 (gl_FUNC_GROUP_MEMBER): Set HAVE_GROUP_MEMBER.
Move AC_LIBOBJ and gl_PREREQ_GROUP_MEMBER invocations from here...
* modules/group-member (configure.ac): ... to here.
Bruno Haible [Sun, 8 May 2011 11:21:50 +0000 (13:21 +0200)]
getpass-gnu: Move AC_LIBOBJ invocations to module description.
* m4/getpass.m4 (gl_FUNC_GETPASS_GNU): Set REPLACE_GETPASS. Move
AC_LIBOBJ and gl_PREREQ_GETPASS invocations from here...
* modules/getpass-gnu (configure.ac): ... to here.
Bruno Haible [Sun, 8 May 2011 11:18:21 +0000 (13:18 +0200)]
getpass: Move AC_LIBOBJ invocations to module description.
* m4/getpass.m4 (gl_FUNC_GETPASS): Set HAVE_GETPASS. Move AC_LIBOBJ and
gl_PREREQ_GETPASS invocations from here...
* modules/getpass (configure.ac): ... to here.
Bruno Haible [Sun, 8 May 2011 11:00:10 +0000 (13:00 +0200)]
getopt, argp: Respect rules for use of AC_LIBOBJ.
* m4/argp.m4 (gl_ARGP): Don't invoke gl_REPLACE_GETOPT.
(gl_REPLACE_GETOPT_ALWAYS): New macro.
* m4/getopt.m4 (gl_FUNC_GETOPT_POSIX): Test whether
gl_REPLACE_GETOPT_ALWAYS is defined. Set REPLACE_GETOPT.
Bruno Haible [Sun, 8 May 2011 10:14:03 +0000 (12:14 +0200)]
getloadavg: Move AC_LIBOBJ invocations to module description.
* m4/getloadavg.m4 (gl_FUNC_GETDELIM): Set HAVE_GETLOADAVG. Move
AC_LIBOBJ and gl_PREREQ_GETLOADAVG invocations from here...
* modules/getloadavg (configure.ac): ... to here.
Bruno Haible [Sun, 8 May 2011 10:06:27 +0000 (12:06 +0200)]
gethrxtime: Move AC_LIBOBJ invocations to module description.
* m4/gethrxtime.m4 (gl_PREREQ_GETHRXTIME): Move code that determines
LIB_GETHRXTIME from here...
(gl_GETHRXTIME): ... to here. Move AC_LIBOBJ and gl_PREREQ_GETHRXTIME
invocations from here...
* modules/gethrxtime (configure.ac): ... to here.
Bruno Haible [Sat, 7 May 2011 10:23:53 +0000 (12:23 +0200)]
fpending: Move AC_LIBOBJ invocations to module description.
* m4/fpending.m4 (gl_PREREQ_FPENDING): New macro, extracted from
gl_FUNC_FPENDING.
(gl_FUNC_FPENDING): Move AC_LIBOBJ and gl_PREREQ_FPENDING
invocations from here...
* modules/fpending (configure.ac): ... to here.
Bruno Haible [Sat, 7 May 2011 10:13:04 +0000 (12:13 +0200)]
fnmatch, fnmatch-gnu: Move AC_LIBOBJ invocations to module description.
* m4/fnmatch.m4 (gl_PREREQ_FNMATCH): New macro, extracted from
gl_FUNC_FNMATCH_POSIX.
(gl_FUNC_FNMATCH_POSIX): Move AC_LIBOBJ and gl_PREREQ_FNMATCH
invocations from here...
* modules/fnmatch (configure.ac): ... to here.
* modules/fnmatch-gnu (configure.ac): ... and here.
Bruno Haible [Fri, 6 May 2011 01:46:57 +0000 (03:46 +0200)]
dirfd: Move AC_LIBOBJ invocations to module description.
* m4/dirfd.m4 (gl_PREREQ_DIRFD): New macro, extracted from
gl_FUNC_DIRFD.
(gl_FUNC_DIRFD): Move AC_LIBOBJ and gl_PREREQ_DIRFD invocations from
here...
* modules/dirfd (configure.ac): ... to here.
(Depends-on): Fix condition.
Jim Meyering [Tue, 14 Jun 2011 13:33:23 +0000 (15:33 +0200)]
init.sh: give more portable redirection-related advice in a comment
* tests/init.sh (stderr_fileno_): Update the advice in comments.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488
for lots of discussion. Stefano Lattarini suggested the solution
of putting "9>&2" after the command. Reported by Bruno Haible.
Paul Eggert [Mon, 13 Jun 2011 16:40:58 +0000 (09:40 -0700)]
ftoastr: use strtof only if HAVE_STRTOF
This is needed on HP-UX 11.11 with GCC 4.24; see Bruno Haible's report
<http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00154.html>.
* lib/ftoastr.c (STRTOF) [LENGTH == 1]: Use strtof only if HAVE_STRTOF.
* modules/ftoastr (configure.ac): Check for strtof.
Bruno Haible [Mon, 13 Jun 2011 15:36:39 +0000 (17:36 +0200)]
fseeko: Provide a non-inline replacement of fseek().
* lib/stdio.in.h (fseek): Don't provide if module 'fseek' is not used.
* modules/fseeko (Depends-on): Add fseek.
* modules/fseek (License): Change to LGPLv2+.
Bruno Haible [Mon, 13 Jun 2011 15:33:59 +0000 (17:33 +0200)]
ftello: Provide a non-inline replacement of ftell().
* lib/stdio.in.h (ftell): Don't provide if module 'ftell' is not used.
* m4/ftell.m4 (gl_FUNC_FTELL): Replace ftell also if the system does
not have ftello() (such as on mingw).
* modules/ftello (Depends-on): Add ftell.
* modules/ftell (License): Change to LGPLv2+.
Bruno Haible [Mon, 13 Jun 2011 09:19:42 +0000 (11:19 +0200)]
file-set.h: guard __attibute__ use, now that it's not always defined
* lib/file-set.h (record_file): Use __attribute__ only with compiler
versions that support it. This fixes a coreutils build failure with
/bin/cc on HP-UX 11.31.
Bruno Haible [Mon, 13 Jun 2011 00:11:03 +0000 (02:11 +0200)]
acl: Add support for HP-UX >= 11.11 JFS ACLs.
* doc/acl-resources.txt: Add info about the ACL APIs on HP-UX.
* m4/acl.m4 (gl_FUNC_ACL): Also test for HP-UX 11.11 API.
* lib/acl-internal.h [HP-UX 11.11]: Include <aclv.h>.
(acl, aclsort): New declarations.
(aclv_nontrivial): New declaration.
* lib/file-has-acl.c (aclv_nontrivial) [HP-UX 11.11]: New function.
(file_has_acl): Read also the second kind of HP-UX ACLs.
* lib/set-mode-acl.c (qset_acl) [HP-UX 11.11]: Try to set the second
kind of HP-UX ACLs if the first kind fails.
* lib/copy-acl.c (qcopy_acl) [HP-UX 11.11]: Read and set also the
second kind of HP-UX ACLs.
* tests/test-sameacls.c [HP-UX 11.11]: Include <aclv.h>.
(main) [HP-UX 11.11]: Test also whether the second kind of HP-UX ACLs
agree.
* tests/test-file-has-acl.sh (acl_flavor) [HP-UX 11.11]: Set to
hpuxjfs.
Handle hpuxjfs.
* tests/test-set-mode-acl.sh (acl_flavor) [HP-UX 11.11]: Set to
hpuxjfs.
Handle hpuxjfs.
* tests/test-copy-acl.sh (acl_flavor) [HP-UX 11.11]: Set to hpuxjfs.
(func_test_same_acls): Use both lsacl and getacl.
Handle hpuxjfs.
* tests/test-copy-file.sh (acl_flavor) [HP-UX 11.11]: Set to hpuxjfs.
(func_test_same_acls): Use both lsacl and getacl.
Handle hpuxjfs.
Bruno Haible [Sun, 12 Jun 2011 23:17:20 +0000 (01:17 +0200)]
acl: Complete the 2010-08-10 fix.
* lib/file-has-acl.c (file_has_acl) [HP-UX]: Also test against ENOTSUP.
* lib/set-mode-acl.c (qset_acl) [HP-UX]: Likewise.
* lib/copy-acl.c (qcopy_acl) [HP-UX]: Test for the errno values
explicitly.
* tests/test-sameacls.c (main) [HP-UX]: Also test against ENOTSUP.
Reported in <http://debbugs.gnu.org/db/60/6053.html>.
James Youngman [Sat, 11 Jun 2011 00:15:39 +0000 (01:15 +0100)]
New module 'stat-size'.
* modules/stat-size: New module. Provides macros for accessing
file size information in instances of struct stat. Depends on the
fileblocks module because it calls st_blocks.
* lib/stat-size.h: New file, adapted from coreutils' system.h.
* doc/gnulib.texi: Include stat-size.texi.
* doc/stat-size.texi: Documentation for this module.
* m4/stat-size.m4: New file; defines gl_STAT_SIZE.
* m4/fileblocks.m4: Mention that stat-size depends on the call to
AC_STRUCT_ST_BLOCKS.
Bruno Haible [Thu, 9 Jun 2011 10:40:44 +0000 (12:40 +0200)]
thread: Support pthreads-win32.
* lib/glthread/thread.h (gl_thread_self): Define differently on
pthreads-win32.
(gl_null_thread): New declaration.
(gl_thread_self_pointer): New macro.
* lib/glthread/thread.c (gl_null_thread): New constant.
* tests/test-lock.c: Use gl_thread_self_pointer instead of
gl_thread_self.
* tests/test-tls.c: Likewise.
Suggested by Paul Eggert. Reported by Eric Blake.
Eric Blake [Wed, 8 Jun 2011 02:49:04 +0000 (20:49 -0600)]
strerror_r-posix: fix on MacOS
MacOS X 10.5 strerror(0) is "Unknown error: 0", which is not distinguished
from "Unknown error: -1" for out-of-range. Worse, strerror_r(0,,)
is "Undefined error: 0", although strerror_r for all other out-of-range
values matches strerror.
Eric Blake [Wed, 8 Jun 2011 11:12:15 +0000 (05:12 -0600)]
strerror: simplify replacement
Only strerror-override depends on winsock2.h; our strerror.c file
does not. This also fixes mingw strerror_r-posix use of winsock2.h
via strerror-override.
Since we assume C89 which guarantees a declaration for sterror, we
don't need to repeat that check.
* m4/strerror.m4 (gl_PREREQ_STRERROR): Delete.
* modules/strerror (configure.ac): No prereqs needed here...
* modules/strerror-override (configure.ac): ...but this needs it.
(Files): Add file for needed prereq macro.
Bruno Haible [Wed, 8 Jun 2011 10:27:31 +0000 (12:27 +0200)]
strerror_r-posix: Tweaks.
* m4/strerror.m4 (gl_FUNC_STRERROR): Omit the code that tests
gl_cv_func_strerror_r_works if gl_FUNC_STRERROR_R_WORKS is not present.
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R_WORKS): Fix AC_CACHE_CHECK
message. Move gl_HEADER_STRING_H_DEFAULTS invocation from here...
(gl_FUNC_STRERROR_R): ... to here.
(gl_PREREQ_STRERROR_R): Test for __xpg_strerror_r.
Paul Eggert [Tue, 7 Jun 2011 23:01:33 +0000 (16:01 -0700)]
stat-time: get_stat_birthtime failure is better-defined
* lib/stat-time.h (get_stat_birthtime): If the time is not available,
return a timestamp whose tv_sec and tv_nsec values are both -1.
Previously, the spec said only that the tv_nsec value was negative.
This upward-compatible change simplifies GNU tar a bit.
Eric Blake [Mon, 6 Jun 2011 23:59:01 +0000 (17:59 -0600)]
strerror_r-posix: work around cygwin 1.7.9
Cygwin __xpg_strerror_r clobbers strerror, until cygwin 1.7.10; in
this case, we must replace strerror, but there was nothing in
strerror.m4 finding fault with cygwin's native strerror. Solve
this by splitting strerror_r.m4 into two parts, one for probing
for the strerror_r bug, and one for replacing strerror_r based
on the presence of bugs unrelated to signature issues; that way,
the 'strerror' module in isolation will not replace strerror, but
if strerror_r is in use for any other reason, then the two use
separate buffers.
Note that cygwin's strerror is thread-safe while the gnulib
replacement is not; but this is no worse than any other
platform where strerror is not thread-safe; in a single-threaded
program, the difference is not observable, and in a multi-threaded
program, you really shouldn't be using strerror in the first place.
Also note that this ends up replacing glibc 2.13 strerror as it
deems __xpg_strerror_r broken on that platform, which isn't
technically necessary for strerror, but doesn't hurt too much.
Meanwhile, glibc 2.14 fixed __xpg_strerror_r, and strerror is not
replaced in that scenario.
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Split...
(gl_FUNC_STRERROR_R_WORKS): ...into new macro, to detect Cygwin
bug without replacing strerror_r.
* m4/strerror.m4 (gl_FUNC_STRERROR): Replace strerror if
strerror_r is buggy, but without requiring strerror_r compilation.
* doc/posix-functions/strerror_r.texi (strerror_r): Fix docs.
Eric Blake [Tue, 7 Jun 2011 21:41:20 +0000 (15:41 -0600)]
test-perror: relax test to ignore cygwin bug
glibc was not the only platform where fprintf(fopen(,"r"))
fails to detect errors; cygwin 1.7.9 is another culprit
(although it will be fixed for 1.7.10), and I suspect that
several other platforms were failing perror2 for the same
reason.
At this point, there are so many functions affected, and
the way to avoid the bug is easy enough (don't pass bogus
streams to output-producing functions), that I'm not worried
about fixing things other than to document them.
tests init: new function 'fatal_', for hard errors
Before this patch, the only way offered by tests/init.sh to
properly signal a hard error was the `framework_failure_'
function. But the error message issued by that function,
as its name would suggest, refers to a set-up failure in the
testsuite, while hard errors can obviously also be due to
other reasons. The best way to fix this inconsistency is to
introduce a new function with a more general error message.