Paul Eggert [Tue, 28 Nov 2017 22:30:25 +0000 (14:30 -0800)]
Port better to CentOS 5
Problems reported by Tom G. Christensen in:
https://lists.gnu.org/r/bug-gnulib/2017-11/msg00053.html
* doc/glibc-functions/strverscmp.texi (strverscmp):
Document strverscmp bug with glibc 2.9 and earlier.
* doc/posix-functions/tzset.texi (tzset):
Document that TZ with angle brackets is POSIX-2001 and later.
* tests/test-nstrftime.c: Include unistd.h.
(TZ_ANGLE_BRACKETS_SHOULD_WORK): New macro.
(TZ): Use it to skip tests with angle brackets in TZ,
for older systems.
Jim Meyering [Tue, 28 Nov 2017 15:52:47 +0000 (07:52 -0800)]
test-faccessat.c: correct BASE definition to avoid parallel test failure
* tests/test-faccessat.c (BASE): Define using this file's name, not
that of test-lstat.c. Using the latter caused this test to fail
sometimes when run concurrently with test-lstat.
Paul Eggert [Fri, 24 Nov 2017 08:29:04 +0000 (00:29 -0800)]
posixtm: remove PDS_LEADING_YEAR
This changes the API slightly, in a hopefully-innocuous way.
Without this change the code had undefined behavior when a
caller specified neither PDS_LEADING_YEAR nor PDS_TRAILING_YEAR.
Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/bug-gnulib/2017-11/msg00048.html
* NEWS: Mention this.
* lib/posixtm.c (posix_time_parse): Treat the absence of
PDS_TRAILING_YEAR as if PDS_LEADING_YEAR were present.
* lib/posixtm.h (PDS_LEADING_YEAR): Remove (actually, leave it
present, but define it as zero, for compatibility with existing
source code). All other PDS_* values moved up.
* tests/test-posixtm.c (LY): New macro.
(T): Use it. Do not expect a particular numeric encoding
for PDS_CENTURY etc.
Paul Eggert [Sun, 12 Nov 2017 06:33:38 +0000 (22:33 -0800)]
faccessat: port to macOS (Bug#29231)
macOS faccessat has the same bug that lstat does: if the file
name ends in '/' it ignores the trailing slash.
Problem reported for Emacs by Vincent Zhang.
* doc/posix-functions/faccessat.texi (faccessat): Document this.
* lib/faccessat.c (_GL_INCLUDING_UNISTD_H): Define and undef
around the initial includes. Include errno.h, string.h, sys/stat.h.
(orig_faccessat) [HAVE_FACCESSAT]: New function.
Include "unistd.h" after defining it.
(rpl_faccessat) [HAVE_FACCESSAT]: New implementation.
* lib/unistd.in.h (faccessat) [REPLACE_FACCESSAT]:
Handle in the usual way.
* m4/faccessat.m4 (gl_FUNC_FACCESSAT): Replace faccessat if
lstat dereferences symlinks, since faccessat is likely to
have the same problem.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Default REPLACE_ACCESSAT.
* modules/faccessat (Depends-on): Add fstatat.
Depend if REPLACE_FACCESSAT is 1, too.
(configure.ac): Link if REPLACE_FACCESSAT is 1.
* modules/faccessat-tests (Depends-on): Add symlink.
* modules/unistd (unistd.h): Substitute REPLACE_FACCESSAT.
* tests/test-faccessat.c (main): Test for the bug.
Paul Eggert [Tue, 7 Nov 2017 07:20:23 +0000 (23:20 -0800)]
year2038: be more insistent about 64-bit time_t
Applications requiring access to arbitrary files should not be
built with 32-bit time_t on hosts that have 64-bit timestamps,
as this can lead to real trouble at runtime.
* m4/year2038.m4 (gl_YEAR2038): Do not require AC_CANONICAL_HOST.
Check on all systems, not just MinGW. Use a heuristic involving
TIME_T_32_BIT_OK, cross_compiling, and the touch command to
output a failure or just a warning, to make it more likely that
builders will select 64-bit time_t.
Paul Eggert [Mon, 6 Nov 2017 04:04:11 +0000 (20:04 -0800)]
Don’t use AC_EGREP_CPP if affected by CFLAGS
* m4/float_h.m4 (gl_FLOAT_H):
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI):
* m4/lib-ld.m4 (AC_LIB_PROG_LD):
* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB):
* m4/year2038.m4 (gl_YEAR2038):
Prefer AC_COMPILE_IFELSE to AC_EGREP_CPP when testing conditions
likely to be affected by the choice of CFLAGS, since CFLAGS are
not used by AC_EGREP_CPP. Without this patch, ‘./configure
CFLAGS="-m32"’ fails on gzip with GNU/Linux x86-64.
Paul Eggert [Sun, 29 Oct 2017 23:22:41 +0000 (16:22 -0700)]
timespec: prefer ‘assume’ to ‘assure’
This avoids some runtime tests. The rest of the module makes
similar assumptions and there is little point to testing here.
* lib/timespec.h: Include verify.h instead of assure.h.
(timespec_cmp): Use ‘assume’, not ‘assure’.
Also, remove an unnecessary cast to ‘int’, as lots of other
code in this module now causes -Wconversion to complain, and
this is a problem with -Wconversion not with the code.
* modules/timespec (Depends-on): Depend on ‘verify’, not ‘assure’.
Paul Eggert [Sun, 29 Oct 2017 22:46:10 +0000 (15:46 -0700)]
Port recent gnulib-tool change to Dash
* gnulib-tool (func_create_testdir): Don't assume that the shell
retokenizes after expanding "$@" inside the call to
func_execute_command. Dash 0.5.8-2.1ubuntu2 does not.
Jim Meyering [Sat, 28 Oct 2017 04:28:47 +0000 (21:28 -0700)]
timespec.h: use "assure" to avoid a spurious warning
* lib/timespec.h: Include "assure.h" and use it to help
gcc7's -Wstrict-overflow avoid a false positive warning
for a use in coreutils' ls.c. Suggested by Paul Eggert in
https://lists.gnu.org/r/bug-gnulib/2017-10/msg00007.html
* modules/timespec (Depends-on): Add assure.
Bruno Haible [Sun, 29 Oct 2017 16:33:22 +0000 (17:33 +0100)]
strerror_r-posix: Fix behaviour and test failure on Haiku.
* lib/strerror_r.c (strerror_r): Don't assume that valid error numbers
are positive. Work around return value 0 instead of ERANGE on Haiku.
For unknown error numbers, use a format string consistent with perror().
* doc/posix-functions/strerror_r.texi: Mention the Haiku problem.
* tests/test-strerror_r.c (main): Don't assume that valid error numbers
are positive.
Jia Zhang [Sun, 29 Oct 2017 03:58:20 +0000 (23:58 -0400)]
New module: crypto/gc-sm3
* lib/gc.h: Declare SM3-related stuffs.
* lib/gc-gnulib.c: Support sm3 in internal functions.
* lib/gc-libgcrypt.c: Support sm3 with libgcrypt.
* m4/gc-sm3.m4: m4 file for gc-sm3 module.
* modules/crypto/gc-sm3: Define gc-sm3 module.
* tests/test-gc-sm3.c: Implement SM3 test case with libgcrypt.
* modules/crypto/gc-sm3-tests: Define gc-sm3 test module.
* MODULES.html.sh: List gc-sm3 module.
Jia Zhang [Sat, 7 Oct 2017 08:31:27 +0000 (04:31 -0400)]
New module: crypto/sm3
This new module can be used to compute SM3 message digest of files or
memory blocks according to the specification GM/T 004-2012
Cryptographic Hash Algorithm SM3, published by State Cryptography
Administration, China.
The official SM3 cryptographic hash algorithm specification is
available at
http://www.sca.gov.cn/sca/xwdt/2010-12/17/content_1002389.shtml
* lib/sm3.h: Declare the APIs of sm3 module.
* lib/sm3.c: Implement SM3 hash algorithm.
* m4/sm3.m4: m4 file for sm3 module.
* modules/crypto/sm3: Define sm3 module.
* tests/test-sm3.c: Implement SM3 test case.
* modules/crypto/sm3-tests: Define sm3 test module.
* MODULES.html.sh: List sm3 module.
Jia Zhang [Sat, 28 Oct 2017 06:14:01 +0000 (02:14 -0400)]
gc-libgcrypt: fix undefined enum type in switch statement
Resolve the following build failure:
lib/gc-libgcrypt.c: In function 'gc_hash_open':
lib/gc-libgcrypt.c:317:5: error: case value '0' not in enumerated type
'Gc_hash_mode {aka enum Gc_hash_mode}' [-Werror=switch]
case 0:
^~~~
* lib/gc.h (enum Gc_hash_mode): Add value GC_NULL.
* lib/gc-libgcrypt.c (gc_hash_open): Use this enum value instead of 0.
Jia Zhang [Sat, 28 Oct 2017 06:16:08 +0000 (02:16 -0400)]
gc-libgcrypt: fix assignment error due to -Werror=pointer-sign
Resolve the following build failure:
lib/gc-libgcrypt.c: In function 'gc_hash_read':
lib/gc-libgcrypt.c:460:14: error: pointer targets in assignment differ
in signedness [-Werror=pointer-sign]
digest = gcry_md_read (ctx->gch, 0);
^
* lib/gc-libgcrypt.c (gc_hash_read): Cast result of gcry_md_read.
Paul Eggert [Thu, 19 Oct 2017 20:03:40 +0000 (13:03 -0700)]
quotearg: pacify compiler re unsigned
* lib/quotearg.c (quotearg_n_options):
Rewrite to avoid diagnostic from overly-picky compiler.
Problem reported by Sami Kerola in:
https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00060.html
Paul Eggert [Thu, 19 Oct 2017 19:39:45 +0000 (12:39 -0700)]
glob: fix heap buffer overflow
* lib/glob.c (glob): Fix off-by-one error introduced into
glibc in commit dd7d45e838a42b0ed470c44b55901ea98d0c2bab
dated 1997-10-29 20:33:40. Problem reported by Tim Rühsen in:
https://sourceware.org/bugzilla/show_bug.cgi?id=22320
Fix suggested by Bruno Haible.
Paul Eggert [Wed, 18 Oct 2017 17:19:35 +0000 (10:19 -0700)]
glob: pacify fuzzer for mempcpy
Problem reported by Tim Rühsen in:
https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00054.html
* lib/glob.c (glob): Do not pass NULL to mempcpy.
Bruno Haible [Thu, 12 Oct 2017 21:18:12 +0000 (23:18 +0200)]
doc: Update for Solaris 11.3.
* doc/**/*.texi: For bugs that exist in both Solaris 11.0 and 11.3,
mention Solaris 11.3.
* m4/log2.m4: Fix comments.
* m4/log2f.m4: Likewise.
* m4/printf.m4: Update comments.
* m4/rename.m4: Likewise.
* m4/strncat.m4: Likewise.
Bruno Haible [Mon, 9 Oct 2017 14:33:00 +0000 (16:33 +0200)]
getopt-posix: Fix build failure when using ac_cv_header_getopt_h=no.
Reported by Christian Ehrhardt <christian.ehrhardt@canonical.com>
and Daniel P. Berrange <berrange@redhat.com>.
* lib/unistd.in.h (getopt): Don't attempt to avoid namespace pollution
on glibc systems. The getopt-pfx-core.h file declares exactly what
unistd.h needs, nothing more.
Bruno Haible [Sat, 7 Oct 2017 12:07:41 +0000 (14:07 +0200)]
vma-iter: Fix truncated result on Linux (regression from 2017-09-26).
* lib/vma-iter.c (MIN_LEFTOVER): New macro.
(STACK_ALLOCATED_BUFFER_SIZE): Set to a minimal value if not needed.
(rof_open): On Linux, do multiple read() calls and make sure
MIN_LEFTOVER bytes are left when read() returns.
Bruno Haible [Fri, 6 Oct 2017 19:51:53 +0000 (21:51 +0200)]
getopt-posix: Clarify copyright header.
* lib/getopt.in.h: Don't state that gnulib is under LGPL.
* lib/getopt-pfx-core.h: Likewise.
* lib/getopt-pfx-ext.h: Likewise.
* lib/getopt-cdefs.in.h: Likewise.
Bruno Haible [Tue, 3 Oct 2017 20:01:42 +0000 (22:01 +0200)]
doc: warn about misuse of strncpy and wcsncpy.
* doc/posix-functions/strcpy.texi: Describe requirements on prior
memory allocation.
* doc/posix-functions/wcscpy.texi: Likewise.
* doc/posix-functions/strncpy.texi: Describe what this function is not
useful for.
* doc/posix-functions/wcsncpy.texi: Likewise.
Paul Eggert [Mon, 2 Oct 2017 03:35:53 +0000 (20:35 -0700)]
fsusage: remove SVR2 support
SVR2 was obsolete by 1986 and is no longer supported by anybody,
and its code was getting in the way of use of this module by
Emacs, which has its own ‘read’ function anyway.
* lib/fsusage.c: Do not include sys/filsys.h.
(get_fs_usage): Remove SVR2-specific code.
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE):
Do not test for sys/filsys.h or set STAT_READ_FILSYS.
* modules/fsusage (Depends-on): Do not depend on full-read.
Bruno Haible [Sat, 30 Sep 2017 16:16:03 +0000 (18:16 +0200)]
vma-iter: Make it work on 32-bit Solaris with module 'largefile'.
* modules/vma-iter: Don't test for sys/procfs.h, as this test would
fail when module 'largefile' is in use.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Don't test HAVE_SYS_PROCFS_H.
* lib/vma-iter.c: Undefine _FILE_OFFSET_BITS early.
Don't test HAVE_SYS_PROCFS_H.