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.
Bruno Haible [Tue, 26 Sep 2017 17:48:39 +0000 (19:48 +0200)]
vma-iter: Improvements for Linux and BSD platforms.
- Add support for DragonFly BSD.
- Make it more reliable on Linux, GNU/kFreeBSD, FreeBSD, NetBSD.
* lib/vma-iter.c (struct rofile, rof_open, rof_peekchar, rof_close):
Read the entire file into memory in a single system call.
(vma_iterate): Update. Read from /proc on DragonFly BSD like on FreeBSD.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on DragonFly BSD.
Paul Eggert [Tue, 26 Sep 2017 01:11:25 +0000 (18:11 -0700)]
parse-datetime, posixtm: avoid uninit access
* lib/parse-datetime.y (parse_datetime2):
* lib/posixtm.c (posixtime):
Do not access uninitialized storage, even though the resulting
value is never used.
Bruno Haible [Mon, 25 Sep 2017 19:31:25 +0000 (21:31 +0200)]
vma-iter: Improvements for BSD platforms.
- Add support for GNU/kFreeBSD.
- Make it work on FreeBSD and NetBSD even when /proc is not mounted.
- Speed up on OpenBSD.
* lib/vma-iter.c (struct rofile, rof*): Define also on GNU/kFreeBSD.
(vma_iterate_bsd): New function.
(vma_iterate): Use it as fallback on FreeBSD and NetBSD. Use it as
first choice on OpenBSD. Treat GNU/kFreeBSD like Linux.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on GNU/kFreeBSD.
* modules/vma-iter (configure.ac): Require AC_C_INLINE.
Bruno Haible [Sat, 23 Sep 2017 10:22:17 +0000 (12:22 +0200)]
strfmon_l: New module.
* modules/strfmon_l: New file.
* lib/strfmon_l.c: New file.
* m4/strfmon_l.m4: New file.
* doc/posix-functions/strfmon_l.texi: Mention the new module.
* modules/strfmon_l-tests: New file.
* tests/test-strfmon_l.c: New file.
Bruno Haible [Sat, 23 Sep 2017 07:26:48 +0000 (09:26 +0200)]
monetary: New module.
* modules/monetary: New file.
* lib/monetary.in.h: New file.
* m4/monetary_h.m4: New file.
* doc/posix-headers/monetary.texi: Mention the new module.
* modules/monetary-tests: New file.
* tests/test-monetary.c: New file.
* modules/monetary-c++-tests: New file.
* tests/test-monetary-c++.cc: New file.
* modules/duplocale-tests (configure.ac): Use AC_CHECK_HEADERS_ONCE.
Paul Eggert [Fri, 22 Sep 2017 04:39:59 +0000 (21:39 -0700)]
mktime: port to OpenVMS
Problem reported by John E. Malmberg in:
https://lists.gnu.org/archive/html/bug-gnulib/2017-09/msg00100.html
* m4/mktime.m4 (TIME_T_IS_SIGNED): Default to 0.
Paul Eggert [Sun, 17 Sep 2017 06:21:43 +0000 (23:21 -0700)]
manywarnings: port to GCC on 64-bit MS-Windows
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Work better if
LONG_MAX < PTRDIFF_MAX. Problem reported by Richard Copley in:
https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00392.html