lib


Log

Author Commit Date CI Message
Simon Josefsson d9c5af06 2011-08-12T00:33:43 base64: Reference latest RFC. * lib/base64.c: Fix comment to reference RFC 4648. Suggested by Bruno Haible <bruno@clisp.org> and Gijs van Tulder <gvtulder@gmail.com>.
Paul Eggert 08c11765 2011-08-10T12:36:13 base64: fix off-by-one buffer size bug Problem and (trivial) fix reported by Gijs van Tulder in <http://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00083.html>. * lib/base64.c (base64_decode_alloc_ctx): Allocate one more byte. * tests/test-base64.c (main): Catch the bug.
Eric Blake 5b9e0c3c 2011-08-10T05:28:29 closein: correct comments * lib/closein.c (close_stdin): Improve comments. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 7d7ec765 2011-08-09T15:50:12 fseeko: remove unneeded hack Now that the fixed fseeko doesn't fail, we can remove the hack that was previously making the testsuite pass. * tests/test-fflush2.c (main): Don't special-case SEEK_END. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake a769adbf 2011-08-09T15:18:31 fseeko: fix bug on glibc Commit 1074f45959f had a bug on glibc that caused the unit test to fail, but instead of figuring why the failure was happening, we instead added a partial hack to avoid the problem in the scenario covered by the testsuite. https://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00171.html But that hack doesn't cover all scenarios, and papers over the real issue: if you fopen()/ftell()/fseek(,0,SEEK_END)/ftell(), then the stream should be positioned at the same place as the underlying fd, even though no I/O occurred, and without requiring an fflush() in the middle. * lib/fseeko.c (fseeko): Set stream offset to match fd offset. Reported by John W. Eaton. Signed-off-by: Eric Blake <eblake@redhat.com>
Simon Josefsson fc1861af 2011-08-05T13:27:17 openat: Fix warnings and commens when building unlinkat.c on Hurd. * lib/unlinkat.c: Mention Hurd in comments. Include stdlib.h to get prototype for free.
Bruno Haible ff4fa73a 2011-08-05T03:04:06 canonicalize-lgpl: Support larger filenames on the Hurd. * lib/canonicalize-lgpl.c (__realpath): Bump path_max fallback to 8192. Reported by Paul Eggert.
Bruno Haible 6310fc6d 2011-08-05T03:01:01 pathmax: Leave PATH_MAX undefined on the Hurd, and a constant otherwise. * lib/pathmax.h (PATH_MAX): Leave it undefined on GNU/Hurd. * lib/chdir-long.h: Include pathmax.h. * lib/clean-temp.c (PATH_MAX): Remove code that is done by pathmax.h. * lib/getcwd.c: Include pathmax.h instead of <limits.h>. (PATH_MAX): Remove code that is done by pathmax.h. * lib/canonicalize.c (PATH_MAX): Provide a fallback value. * lib/tmpfile.c: Add a comment. * m4/pathmax.m4 (gl_PATHMAX): Don't test for pathconf. * modules/chdir-long (Depends-on): Add pathmax. * modules/getcwd (Depends-on): Add pathmax. * tests/test-getcwd.c (test_abort_bug): Avoid syntax error when PATH_MAX is not defined. * doc/posix-headers/limits.texi: Mention the pathmax module. * NEWS: Mention the change.
Bruno Haible 4bf2b800 2011-07-31T23:28:02 sys_utsname: Add support for Minix. * lib/sys_utsname.in.h [Minix]: Include <stddef.h> before <sys/utsname.h>. * m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise. * doc/posix-headers/sys_utsname.texi: Document the Minix problem.
Bruno Haible 92fc24c6 2011-07-31T23:03:25 strings: Add support for Minix. * lib/strings.in.h [Minix]: Include <sys/types.h> before <strings.h>. * m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Likewise. * doc/posix-headers/strings.texi: Document the Minix problem.
Bruno Haible 060a5ab2 2011-07-31T22:39:32 wctype-h: Add support for Minix. * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether towlower is declared. Set REPLACE_TOWLOWER. * modules/wctype-h (Makefile.am): Substitute REPLACE_TOWLOWER. * lib/wctype.in.h (towlower, towupper): Test REPLACE_TOWLOWER, not REPLACE_ISWCNTRL.
Paul Eggert 94122ae4 2011-07-31T12:50:12 * lib/xalloc.h (DEFAULT_MXFAST): Track 64-bit glibc. This is a performance improvement for 64-bit hosts: it causes the value of DEFAULT_MXFAST to track what's in glibc on such hosts.
Bruno Haible d4d84c1d 2011-07-31T21:16:15 stdioext: Add support for Minix. * lib/fbufmode.c (fbufmode) [__minix]: Add conditional code. * lib/fpurge.c (fpurge): Likewise. * lib/freadahead.c (freadahead): Likewise. * lib/freadable.c (freadable): Likewise. * lib/freading.c (freading): Likewise. * lib/freadptr.c (freadptr): Likewise. * lib/freadseek.c (freadptrinc): Likewise. * lib/fseeko.c (rpl_fseeko): Likewise. * lib/fseterr.c (fseterr): Likewise. * lib/fwritable.c (fwritable): Likewise. * lib/fwriting.c (fwriting): Likewise. * lib/fflush.c (clear_ungetc_buffer): Update comment. * m4/fpending.m4 (gl_PREREQ_FPENDING): Add a variant for Minix.
Bruno Haible 712cf13d 2011-07-31T19:00:23 errno: Port to Minix. * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Test also whether ENETRESET and ECONNABORTED are defined. * lib/errno.in.h (ENETRESET, GNULIB_defined_ENETRESET, ECONNABORTED, GNULIB_defined_ECONNABORTED): New macros. * lib/strerror-override.h (strerror_override): Test also GNULIB_defined_ENETRESET, GNULIB_defined_ECONNABORTED. * lib/strerror-override.c (strerror_override): Handle also ENETRESET, ECONNABORTED. * doc/posix-headers/errno.texi: Mention the Minix problem.
Paul Eggert f0e396a8 2011-07-25T09:21:22 * lib/ftell.c (ftell): Comment out cast.
Paul Eggert a53ff77a 2011-07-24T09:42:48 ftell: don't include <unistd.h> * lib/ftell.c: Don't include <unistd.h>. <stdio.h> is now guaranteed to define off_t, and the ftell module depends on the stdio module.
Paul Eggert a9418e02 2011-07-24T09:42:14 ftell: do not assume wraparound signed arithmetic * lib/ftell.c: Include <limits.h>. (ftell): Don't assume wraparound signed arithmetic.
Bruno Haible 38a06045 2011-07-24T12:20:41 fsusage: Enable large volume support on AIX >= 5.2. * m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): If 'struct statvfs64' has a larger f_blocks field than 'struct statvfs', define STAT_STATVFS64 instead of STAT_STATVFS. * lib/fsusage.c (get_fs_usage) [STAT_STATVFS64]: Use statvfs64.
Kamil Dudka 95f7c57f 2011-07-22T14:48:42 file-has-acl: use acl_extended_file_nofollow if available * lib/acl-internal.h (HAVE_ACL_EXTENDED_FILE): New macro. (acl_extended_file): New macro. * lib/file-has-acl.c (file_has_acl): Use acl_extended_file_nofollow. * m4/acl.m4 (gl_FUNC_ACL): Check for acl_extended_file_nofollow. This addresses http://bugzilla.redhat.com/692823.
Paul Eggert 4cf71a8c 2011-07-16T02:01:17 pthread_sigmask: ensure usleep is declared * lib/pthread_sigmask.c [PTHREAD_SIGMASK_UNBLOCK_BUG]: Include <unistd.h>, to declare usleep. Needed on Solaris 8,
Bruno Haible b0c7231f 2011-07-16T02:51:48 ffsl, ffsll: Avoid unportable behaviour. * lib/ffsl.h (FUNC): Use 'unsigned int' instead of 'int'.
Eric Blake 9c6e26ca 2011-07-15T15:08:34 ffsl, ffsll: new modules * modules/ffsl: New file. * modules/ffsll: Likewise. * m4/ffsl.m4: Likewise. * m4/ffsll.m4: Likewise. * lib/ffsl.c: Likewise. * lib/ffsl.h: Likewise. * lib/ffsll.c: Likewise. * m4/string_h.m4 (gl_HEADER_STRING_H_BODY) (gl_HEADER_STRING_H_DEFAULTS): Add defaults. * modules/string (Makefile.am): Substitute witnesses. * lib/strings.in.h (ffsl, ffsll): Declare. * modules/ffsl-tests: New test file. * modules/ffsll-tests: Likewise. * tests/test-ffsl.c: Likewise. * tests/test-ffsll.c: Likewise. * MODULES.html.sh (Integer arithmetic functions): Mention it. * doc/glibc-functions/ffsl.texi (ffsl): Likewise. * doc/glibc-functions/ffsll.texi (ffsll): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake d767af36 2011-07-15T14:26:43 ffs: avoid undefined behavior * lib/ffs.c (ffs): Provide fallback for non-32-bit int. * tests/test-ffs.c (naive, main): Avoid signed shifts. Reported by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 4b69a607 2011-07-12T01:16:08 stdnoreturn, stdnoreturn-tests: remove modules They're not needed here and a bit premature for use elsewhere. See <http://lists.gnu.org/archive/html/bug-gnulib/2011-07/msg00209.html>. * m4/stdnoreturn.m4, modules/stdnoreturn, modules/stdnoreturn-tests: * tests/test-stdnoreturn.c: Remove files. * MODULES.html.sh (_Noreturn <stdnoreturn.h>): Remove section. * lib/openat.h, lib/sigpipe-die.h, lib/xalloc.h, lib/xmemdup0.h: * lib/xstrtol.h: Use _Noreturn rather than including <stdnoreturn.h> and using noreturn. * modules/openat, modules/sigpipe-die, modules/xalloc: * modules/xmemdup0, modules/xstrtol: Remove dependency on stdnoreturn.
Paul Eggert a046525c 2011-07-12T01:11:41 xalloc: use stdnoreturn.h * lib/xalloc.h: Include <stdnoreturn.h>. (_GL_ATTRIBUTE_NORETURN): Remove; all uses replaced with noreturn. * modules/xalloc (Depends-on): Add stdnoreturn.
Paul Eggert b067a2ba 2011-07-12T01:11:07 xstrtol: use stdnoreturn.h * lib/xstrtol.h: Include <stdnoreturn.h>. (_GL_ATTRIBUTE_NORETURN): Remove; all uses replaced with noreturn. * modules/xstrtol (Depends-on): Add stdnoreturn.
Paul Eggert 2c2ff7ee 2011-07-12T01:10:31 xmemdup0: use stdnoreturn.h * lib/xmemdup0.h: Include <stdnoreturn.h>. (_GL_ATTRIBUTE_NORETURN): Remove; all uses replaced with noreturn. * modules/xmemdup0 (Depends-on): Add stdnoreturn.
Paul Eggert 96924181 2011-07-12T01:10:04 sigpipe-die: use stdnoreturn.h * lib/sigpipe-die.h: Include <stdnoreturn.h>. (_GL_ATTRIBUTE_NORETURN): Remove; all uses replaced with noreturn. * modules/sigpipe-die (Depends-on): Add stdnoreturn.
Paul Eggert 6bddfff3 2011-07-12T01:09:30 openat: use stdnoreturn.h * lib/openat.h: Include <stdnoreturn.h>. (_GL_ATTRIBUTE_NORETURN): Remove; all uses replaced with noreturn. * modules/openat (Depends-on): Add stdnoreturn.
Paul Eggert 5e2a6b1f 2011-07-12T01:08:59 * lib/openat-die.c (openat_save_fail): Modernize comment.
Paul Eggert d4dd1df2 2011-07-12T01:08:27 * lib/xalloc-die.c (xalloc_die): Modernize comment.
Paul Eggert f2607506 2011-07-12T01:07:21 * lib/glthread/thread.h: Modernize comment.
Paul Eggert e55e4a83 2011-07-12T01:06:42 obstack: use _Noreturn * lib/obstack.c (__attribute__): Remove macro. (print_and_abort): Use _Noreturn.
Paul Eggert 64558173 2011-07-12T01:06:07 c-stack: use _Noreturn * lib/c-stack.c (die, overflow_handler, segv_handler): Use _Noreturn rather than __attribute__((noreturn)).
Paul Eggert f67969b0 2011-07-12T01:02:54 stdlib: use _Noreturn * lib/stdlib.in.h (_GL_ATTRIBUTE_NORETURN): Remove. (_Exit): Use _Noreturn rather than _GL_ATTRIBUTE_NORETURN. * modules/stdlib (Depends-on): Add _Noreturn. (stdlib.h): Depend on $(_NORETURN_H), and copy it in.
Eric Blake a918da4d 2011-07-11T17:05:34 ffs: new module Libvirt wants to use ffs() to avoid dragging in -lm for log2(). * modules/ffs: New file. * m4/ffs.m4: Likewise. * lib/ffs.c: Likewise. * m4/strings_h.m4 (gl_HEADER_STRINGS_H_DEFAULTS): Add default. * modules/strings (Makefile.am): Substitute witness. (Depends-on): Add c++defs. * lib/strings.in.h (ffs): Declare. * modules/ffs-tests: New test file. * tests/test-ffs.c: Test new module. * MODULES.html.sh (Integer arithmetic functions): Mention it. * doc/posix-functions/ffs.texi (ffs): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 77e4a0d2 2011-07-11T07:32:39 regex: avoid compiler warning Although glibc leaks strcasecmp through <string.h>, this behavior is not required by POSIX, and HP NonStop needs <strings.h> * lib/regex.c (includes): Include <strings.h>, for use of strcasecmp in regcomp.c. Reported by Jachim Schmitz. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 5ee50521 2011-07-09T14:56:56 stdint: respect system's intmax_t if INTMAX_MAX * lib/stdint.in.h (intmax_t, uintmax_t): If the system defines INTMAX_MAX, assume its intmax_t is OK. Similarly for and uintmax_t. This is for some Mac OS X builds, where intmax_t is long but int64_t is long long, and where we will clash with the system intmax_t if we override it. See <http://lists.gnu.org/archive/html/bug-gnulib/2011-07/msg00160.html>. (INTMAX_C, UINTMAX_C): For consistency, respect the system's INTMAX_C if INTMAX_MAX and INTMAX_C are both defined, and similarly for UINTMAX_C.
Bruno Haible 29090434 2011-07-09T01:37:58 pthread_sigmask: Work around IRIX bug. * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Test for the IRIX bug. * lib/pthread_sigmask.c (pthread_sigmask): usleep for some time when there may be unblocked pending signals. * doc/posix-functions/pthread_sigmask.texi: Mention the IRIX bug.
Bruno Haible 43243b5f 2011-07-09T01:01:36 pthread_sigmask: Work around Cygwin bug. * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Test for the Cygwin bug. * lib/pthread_sigmask.c (pthread_sigmask): Fix the return value from the system's pthread_sigmask function. * doc/posix-functions/pthread_sigmask.texi: Mention the Cygwin bug.
Bruno Haible 2616a658 2011-07-09T00:27:00 pthread_sigmask: Work around bug in single-threaded implementation. * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Test for the FreeBSD, HP-UX, Solaris bug. (gl_PREREQ_PTHREAD_SIGMASK): New macro. * lib/pthread_sigmask.c: Include <stddef.h>. (pthread_sigmask): If HAVE_PTHREAD_SIGMASK, define as a wrapper around the system's pthread_sigmask function. * modules/pthread_sigmask (configure.ac): Invoke gl_PREREQ_PTHREAD_SIGMASK. * doc/posix-functions/pthread_sigmask.texi: Mention bug on FreeBSD, HP-UX, Solaris.
Eric Blake da4d6974 2011-07-07T11:37:37 fts: introduce FTS_NOATIME This gives clients the option to try a non-invasive traversal, where merely visiting a directory does not update its timestamp, where such is supported by the kernel. Note that this is best-effort. FTS_NOATIME is silently ignored on systems that lack O_NOATIME support - it is up to the caller to decide whether to issue an error when the gnulib replacement <fcntl.h> defined O_NOATIME to 0, and/or detect older Linux kernels where O_NOATIME is defined to non-zero but has no effect. Note that whiteout support and O_NOATIME support are currently orthogonal: there is no way to get O_NOATIME behavior when using __opendir2 to visit whiteouts on BSD systems. So far, I don't know of any system with both __opendir2 and O_NOATIME; if such a system exists, then fts_build() needs a tweak (then again, such a system would probably add DTF_NOATIME for __opendir2). * lib/fts_.h (FTS_NOATIME): New bit flag. (FTS_OPTIONMASK): Adjust. * lib/fts.c (diropen, fts_open, fts_build): Honor it. (fd_ring_check): Debug code unconditionally uses O_NOATIME. Needed for findutils bug http://savannah.gnu.org/bugs/?33724 Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible 65fb20d6 2011-07-08T13:25:16 thread: Avoid gcc warnings when using gl_thread_self(). * lib/glthread/thread.h (gl_thread_self): Return a pthread_t, not a 'void *'. (gl_thread_self_pointer): Update.
Bruno Haible fb3f7540 2011-07-08T04:05:45 pthread_sigmask: Fix link requirements on OSF/1 5.1 and with pth. * lib/signal.in.h (pthread_sigmask): Override if REPLACE_PTHREAD_SIGMASK is 1. * m4/signal_h.m4 (gl_SIGNAL_H_DEFAULTS): Initialize REPLACE_PTHREAD_SIGMASK. * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Set also REPLACE_PTHREAD_SIGMASK. Set and substitute LIB_PTHREAD_SIGMASK. * modules/signal (Makefile.am): Substitute REPLACE_PTHREAD_SIGMASK. * modules/pthread_sigmask (Depends-on, configure.ac): Update condition. (Link): Set to $(LIB_PTHREAD_SIGMASK), not $(LIBMULTITHREAD).
Bruno Haible a9042e00 2011-07-08T03:38:33 pthread_sigmask: Ensure declaration in <signal.h> also on Solaris 2.6.
Bruno Haible b8b7afdc 2011-07-08T02:24:27 pthread_sigmask: Ensure declaration in <signal.h>. * lib/signal.in.h: On MacOS X, FreeBSD, OpenBSD, OSF/1, include <pthread.h>. * doc/posix-functions/pthread_sigmask.texi: Mention the header file problem.
Bruno Haible bfb5ec49 2011-07-08T02:08:15 pthread_sigmask: Make declaration C++ safe. * lib/signal.in.h: In two special conditions, just do an #include_next. (pthread_sigmask): Test HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. Invoke _GL_CXXALIAS_SYS and _GL_CXXALIASWARN. * m4/signal_h.m4 (gl_SIGNAL_H_DEFAULTS): Initialize HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. * m4/pthread_sigmask.m4 (gl_PTHREAD_SIGMASK): Set HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. * modules/signal (Makefile.am): Substitute HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. * modules/pthread_sigmask (Depends-on, configure.ac): Update condition.
Bruno Haible 34f19098 2011-07-08T01:51:49 pthread_sigmask: Fix return value. * lib/signal.in.h (pthread_sigmask): Declare. Don't define as a macro. * lib/pthread_sigmask.c: New file. * modules/pthread_sigmask (Files): Add it. (configure.ac): Invoke AC_LIBOBJ.
Eric Blake c4bf665b 2011-07-07T08:54:11 getopt: handle W; without long options in getopt This reverts commit cbf381169705782b144b2733798a62c11aa473a5, in favor of the upstream glibc fix (commit 01636b214) plus a C89 fix. [BZ #12922] * lib/getopt.c (_getopt_internal_r): When "W;" is in short options but no long options are defined, just return 'W'. Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible 844191ea 2011-07-07T03:34:18 sys_select: Fix compilation error on mingw, introduced on 2011-06-30. * lib/sys_select.in.h: Don't include <sys/socket.h>. Instead, include <winsock2.h>. (rpl_fd_isset, FD_ISSET): New definitions, copied from lib/sys_socket.in.h. (close, gethostname): Hide declarations from <winsock2.h>. (socket, connect, accept, bind, getpeername, getsockname, getsockopt, listen, recv, send, recvfrom, sendto, setsockopt, shutdown): Likewise. * lib/sys_socket.in.h (close, gethostname): Tweak indentation. (select): Don't override if gnulib's <sys/select.h> was already included. * lib/unistd.in.h (socket, connect, accept, bind, getpeername, getsockname, getsockopt, listen, recv, send, recvfrom, sendto, setsockopt, shutdown, select): Tweak indentation.
Erik Faye-Lund adc3a5b0 2011-07-06T12:10:51 poll: do not return 0 on timeout=-1 * lib/poll.c: Loop with yield if no events occured
Paul Eggert 8db49630 2011-07-06T00:42:24 sys_select: define sigset_t more portably * lib/sys_select.in.h: Always include <sys/types.h>, since we now need sigset_t and mingw defines it there. Include <signal.h> before split inclusion guard, to avoid mishaps on Solaris, whose <signal.h> eventually includes us. * m4/signal_h.m4 (gl_SIGNAL_H): Require gl_CHECK_TYPE_SIGSET_T. (gl_CHECK_TYPE_SIGSET_T): New macro, most of the contents of which come from ... * m4/signalblocking.m4 (gl_SIGNALBLOCKING): Require gl_CHECK_TYPE_SIGSET_T. (gl_PREREQ_SIGPROCMASK): Now a no-op, since gl_CHECK_TYPE_SIGSET_T does the real work. * modules/sys_select (Depends-on): Add 'signal'.
Paul Eggert 1700ce39 2011-07-06T00:05:40 pselect: Use pthread_sigmask, not sigprocmask. * lib/pselect.c (pselect): Use pthread_sigmask, as it supports multithreaded apps better than sigprocmask does. * modules/pselect (Depends-on): Depend on pthread_sigmask, not sigprocmask directly.
Paul Eggert c1dcfef8 2011-07-05T23:58:08 * lib/pselect.c (pselect): Use plain name, without "rpl_". Don't #undef, since we don't need any underlying pselect. * modules/pselect (Depends-on): Use our pselect.o if !HAVE_PSELECT. Both changes suggested by Bruno Haible.
Paul Eggert cf74a395 2011-07-05T23:44:24 pthread_sigmask: new module * MODULES.html.sh (Support for systems lacking POSIX:2008): Add it. * doc/posix-functions/pthread_sigmask.texi: Document new module. * lib/signal.in.h (pthread_sigmask): Arrange for replacement. This is done only as a macro; I don't know how well that'll work for C++. Move <sys/types.h> include before the include_next, to avoid mishap on Solaris. * m4/signal_h.m4 (gl_SIGNAL_H, gl_SIGNAL_H_DEFAULTS): Check for it. * modules/signal (Makefile.am): Substitute the check's results. * modules/pthread_sigmask, m4/pthread_sigmask.m4: New files.
Bruno Haible 6b147027 2011-07-03T13:36:43 Comments about EINTR. * lib/safe-read.h: Explain the purpose of this module. * lib/safe-write.h: Likewise. * doc/posix-functions/read.texi: Mention EINTR and the 'safe-read' module. * doc/posix-functions/write.texi: Mention EINTR and the 'safe-write' module. Reported by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
Paul Eggert 1f079339 2011-06-30T15:23:29 xnanosleep: Rewrite to use new dtotimespec module. It has the conversion code that used to be in xnanosleep. * lib/xnanosleep.c: Do not include limits.h, stdbool.h, stdio.h, assert.h, sys/types.h, or intprops.h. Include timespec.h instead. (TIME_T_MAX): Remove. (xnanosleep): Rewrite in terms of dtotimespec. * modules/xnanosleep (Depends-on): Add dtotimespec. Remove intprops, stdbool.
Paul Eggert 81979bc8 2011-06-30T15:17:31 timespec-add, timespec-sub: new modules * lib/timespec.h (timespec_add, timespec_sub): New decls. * lib/timespec-add.c, lib/timespec-sub.c: * modules/timespec-add, modules/timespec-sub: New files.
Paul Eggert 2deeabad 2011-06-30T15:14:25 dtotimespec: new module * lib/timespec.h (dtotimespec): New decl. * lib/dtotimespec.c, modules/dtotimespec: New files.
Paul Eggert 1a37ff9e 2011-06-30T15:06:54 * lib/timespec.h (timespectod): New inline function.
Paul Eggert e115de06 2011-06-30T15:04:56 * lib/timespec.h (timespec_sign): New inline function.
Paul Eggert 1b1ea5a5 2011-06-30T14:57:39 pselect: new module * lib/sys_select.in.h: Include <signal.h>, for 'sigset_t'. (pselect): New decls. * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Require AC_C_RESTRICT, since the standard pselect decl uses 'restrict'. (gl_SYS_SELECT_H_DEFAULTS): Add defaults for GNULIB_PSELECT, HAVE_PSELECT, REPLACE_PSELECT. * modules/sys_select (sys/select.h): Substitute GNULIB_PSELECT, HAVE_PSELECT, REPLACE_PSELECT. * lib/pselect.c, m4/pselect.m4, modules/pselect: New files.
Paul Eggert 18c7880d 2011-06-30T10:58:24 sys_select: don't depend on sys_socket This is so that Emacs doesn't have to drag in m4/sockpfaf.m4 etc; see <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00358.html>. This fix works on GNU and GNU-like platforms, but has not been tested on native Windows. * lib/sys_select.in.h: Include <sys/socket.h> only if native Windows. * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Do not require gl_HEADER_SYS_SOCKET. * modules/sys_select (Files): Add m4/sys_socket_h.m4, for gl_PREREQ_SYS_H_WINSOCK2.
Eric Blake 7269b35c 2011-06-29T17:05:08 pipe2: fix C89 compile problem IRIX cc didn't like the initialization. * lib/pipe2.c (pipe2): Avoid C99 array initialization. Reported by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 3dbe75e4 2011-06-29T15:46:50 pipe, pipe2: don't corrupt fd on error I noticed a potential subtle double-close bug in libvirt. There, a common idiom is to initialize an int fd[2]={-1,-1}, then have multiple error paths goto common cleanup code. In the cleanup code, the fds are closed if they are not already -1; this works if the error label is reached before the pipe call, or after pipe succeeds, but if it was the pipe call itself that jumped to the error label, then it is relying on failed pipe() not altering the values already in fd array prior to the failure. Our pipe2 replacement violated this assumption, and could leave a non-negative value in the array, which in turn would let libvirt close an already-closed fd, possibly nuking an unrelated fd opened by another thread that happened to get the same value. As a result, I raised a POSIX issue regarding the behavior of pipe on failure: http://austingroupbugs.net/view.php?id=467 Using that test program, I learned that most systems leave fd unchanged on error, but that mingw always assigns -1 into the array. This fixes the mingw pipe() replacement, as well as the gnulib pipe2() replacement. I don't know of any race-free way to work around a cygwin crash: http://cygwin.com/ml/cygwin/2011-06/msg00328.html - we could always open() and then close() two fds to guess whether two spare fd still remain before calling pipe(), but that is racy. * lib/pipe.c (pipe): Leave fd unchanged on error. * lib/pipe2.c (pipe2): Likewise. * doc/posix-functions/pipe.texi (pipe): Document cygwin issue. * doc/glibc-functions/pipe2.texi (pipe2): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 4aa81927 2011-06-25T14:23:56 nanosleep: fix integer overflow problem * lib/nanosleep.c (my_usleep): Don't assume signed integer arithmetic wraps around on overflow.
Paul Eggert c4c53bb2 2011-06-25T11:55:20 nanosleep: simplify carrying * lib/nanosleep.c (nanosleep): Use the requested tv_nsec for the first call to the underyling nanosleep, not for the last one. This doesn't fix any bugs, but it simplifies the computation of the remaining delay. Found while auditing integer overflow issues.
Bruno Haible 9652bc68 2011-06-24T11:23:26 strerror-override: No-op tweak. * lib/strerror-override.h (strerror_override): Reorder conditions, for consistency with lib/strerror-override.c.
Eric Blake dffc41f9 2011-06-20T16:55:24 stat: be robust to PATH_MAX definition Make this stack-allocation of PATH_MAX bytes more robust. * lib/stat.c (rpl_stat): Require reasonable PATH_MAX. * modules/stat (Depends-on): Add verify. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake df1c2344 2011-06-22T12:15:02 link: work around IRIX bug On IRIX 6.5, link(file, "dangling") creates the target of dangling as a link to file, rather than failing with EEXIST. * m4/link.m4 (gl_FUNC_LINK): Expose the bug. * lib/link.c (rpl_link): Work around it. * tests/test-link.h (test_link): Enhance test. * doc/posix-functions/link.texi (link): Document the bug. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake cbf38116 2011-06-22T11:17:40 getopt: silence clang warning http://sourceware.org/bugzilla/show_bug.cgi?id=12922 Only triggered by a program that uses "W;" in the short opt string without providing a longopts array; that can be argued to be a programmer error, so gnulib won't bother replacing glibc getopt if it has that bug. * lib/getopt.c (_getopt_internal_r): Avoid unlikely NULL dereference. Reported by Gustavo Martin Domato. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 23d3c1a2 2011-06-21T10:00:55 strerror_r: fix OpenBSD behavior on out-of-range On OpenBSD, strerror_r(1000,buf,19) gives "Unknown error: " rather than "Unknown error: 100" while failing with ERANGE. Admittedly, this behavior is nice, since a truncated integer is misleading, but all other platforms use maximal strings on ERANGE and we are already replacing strerror_r for other reasons, so it is easier to work around this behavior than to adjust the testsuite (how do you quickly decide if the only reason that the ERANGE string was shorter than maximal was because the implementation avoided truncating an integer?). This patch intentionally avoids dragging in the strnlen module. * lib/strerror_r.c (strerror_r): Always use maximal string. * doc/posix-functions/strerror_r.texi (strerror_r): Document it. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake c7487319 2011-06-21T08:50:51 strerror_r: fix OpenBSD behavior on 0 OpenBSD treats strerror_r(0,,) as a success, but with a message "Undefined error: 0"; while this is distinct from strerror_r(-1,,) returning "Unknown error: -1", it does not imply success. Meanwhile, if buf is short enough for ERANGE, then we can't use strstr to look for "Unknown" or "Undefined" in the resulting message, like we had been doing for strerror(). Fix this by shifting the burden - now the strerror-override code guarantees that 0 will have an override when needed. * lib/strerror-override.c (strerror_override): Also override 0 when needed. * lib/strerror-override.h (strerror_override): Likewise. * lib/strerror.c (strerror): Simplify, now that 0 override is done earlier. * lib/strerror_r.c (strerror_r): Likewise. * m4/strerror.m4 (gl_FUNC_STRERROR): Split detection of 0 behavior... (gl_FUNC_STRERROR_0): ...into new macro. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Replace strerror_r if 0 is overridden. (gl_FUNC_STRERROR_R_WORKS): Avoid extra tests if 0 is broken. * modules/strerror-override (Files): Add strerror.m4. (configure.ac): Also provide override for 0 when needed. * doc/posix-functions/strerror.texi (strerror): Document this. * doc/posix-functions/perror.texi (perror): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 8681e553 2011-06-21T10:10:06 perror: adjust array size If we ever adjust strerror-override.h to have a larger size for STACKBUF_LEN, then perror should also pick up the adjustment. * modules/perror (Depends-on): Add strerror-override. * lib/perror.c (perror): Use it to avoid magic number. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake c7b1d210 2011-06-21T09:40:46 strerror-override: reduce size * lib/strerror-override.c (strerror_override): Use fewer lines. Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible 2dbdfc4b 2011-06-21T00:18:27 pathmax: Ensure correct value for PATH_MAX on HP-UX. * lib/pathmax.h (PATH_MAX) [HP-UX]: Define to 1024.
Paul Eggert c3dbfe95 2011-06-20T15:03:03 alloca: port to compilers that can optimize like GCC 4.6.0 * lib/alloca.c (find_stack_direction): New signature, taken from Autoconf git. This works with GCC 4.6.0. This code should never be used with GCC 4.6.0 itself, as GCC has alloca, but it might be used with other compilers that optimize as well as GCC 4.6.0 does. (alloca): Adjust to new signature. * m4/alloca.m4 (__AC_LIBOBJ_ALLOCA) [Autoconf version < 2.69]: New macro, which patches Autoconf in a similar way.
Paul Eggert 3c4ad612 2011-06-20T14:59:13 c-stack: stop worrying about stack direction * lib/c-stack.c (find_stack_direction): Remove. (segv_handler): Don't worry about stack direction growth, as it's too much of a pain to configure this correctly, given how compilers are optimizing-away our stack-growth detection code. Instead, assume that any access to just before or just after the stack is OK. * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Don't require AC_FUNC_ALLOCA; no longer needed.
Bruno Haible 6187bd67 2011-06-20T12:38:05 float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX. * lib/float.in.h: Add workarounds for FreeBSD/x86, AIX with GCC, IRIX. * lib/float.c: New file. * m4/float_h.m4 (gl_FLOAT_H): Also handle FreeBSD, AIX, IRIX. Set REPLACE_FLOAT_LDBL. * modules/float (Files): Add lib/float.c. (configure.ac): Invoke AC_LIBOBJ. * doc/posix-headers/float.texi: Mention problems on FreeBSD, AIX, IRIX.
Bruno Haible 414111a8 2011-06-19T21:19:27 isinf: Coding style. * lib/isinf.c: Use GNU coding style.
Bruno Haible 8d31711c 2011-06-18T11:25:17 clean-temp: Improve documentation. * lib/clean-temp.h: Explain better how to use this module. Reported by John Darrington <john@darrington.wattle.id.au>.
Bruno Haible b6d3498b 2011-06-18T00:29:40 pread, pwrite: Avoid cc warning on AIX. * lib/unistd.in.h (pread): Undefine before defining as a macro. (pwrite): Likewise.
Paul Eggert 0e24c598 2011-06-15T11:15:37 verify: new macro verify_expr; verify_true deprecated * NEWS: Mention this. * doc/verify.texi (Compile-time Assertions): Document this. * lib/verify.h (verify_true): Deprecate. (verify_expr): New macro. * tests/test-verify.c (function): Test verify_expr.
Paul Eggert 41ffc767 2011-06-13T09:40:58 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 68fa0854 2011-06-13T17:36:39 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 28b78430 2011-06-13T17:33:59 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 258036d8 2011-06-13T11:19:42 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 227b08bb 2011-06-13T02:11:03 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 9cbf59b7 2011-06-13T01:17:20 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 9fc77bc5 2011-06-11T01:15:39 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 f462d861 2011-06-09T12:40:44 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.
Bruno Haible 5f0441a0 2011-06-09T12:55:09 thread: Fix confusion between NULL and 0. * lib/glthread/thread.h (gl_thread_self): Use NULL and 0 appropriately. Reported by Paul Eggert.
Eric Blake 79d4e75d 2011-06-07T20:49:04 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. * m4/strerror.m4 (gl_FUNC_STRERROR): Flush out MacOS bug. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R_WORKS): Likewise, and fix logic bug. * lib/strerror_r.c (strerror_r): Fix the bug. * lib/strerror.c (strerror): Likewise. * doc/posix-functions/strerror_r.texi (strerror_r): Document the problem. * doc/posix-functions/strerror.texi (strerror): Likewise. * doc/posix-functions/perror.texi (perror): Likewise. * tests/test-strerror.c (main): Enhance test. * tests/test-strerror_r.c (main): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert e42a3db8 2011-06-07T16:01:33 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 4c91b77e 2011-06-06T15:16:26 strerror: work around FreeBSD bug Breaking strerror away from strerror_r re-exposed the FreeBSD strerror(0) bug. * lib/strerror.c (strerror): Special case 0. Reported by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible 3f9fff25 2011-06-06T11:01:52 careadlinkat: Avoid mismatch between ssize_t and int. * lib/careadlinkat.h (careadlinkatcwd): Declare as a function always. * lib/careadlinkat.c (careadlinkatcwd): Define always.
Bruno Haible bf7690a6 2011-06-05T19:15:25 pipe-filter-ii: Fix test failure on AIX and IRIX. * lib/pipe-filter-ii.c (pipe_filter_ii_execute): When write() fails with EAGAIN, retry with a smaller buffer size.
Bruno Haible 89214de3 2011-06-05T14:57:16 error: Avoid gcc warning. * lib/error.c (strerror_r): Declare also when its return type is 'int'.
Bruno Haible 6f88ff35 2011-06-05T14:32:56 unsetenv: Avoid gcc warning. * lib/unsetenv.c (unsetenv): Provide declaration if system lacks it.
Bruno Haible c00787b6 2011-06-05T14:31:51 setenv: Avoid gcc warning. * lib/setenv.c (setenv): Provide declaration if system lacks it.