Paul Eggert [Mon, 16 Nov 2020 03:54:33 +0000 (19:54 -0800)]
getumask-tests: port to Solaris 10 etc.
Problem reported by Tom Christensen in:
https://lists.gnu.org/r/bug-gnulib/2020-11/msg00062.html
* modules/getumask-tests (test_getumask_LDADD):
Add $(LIB_CLOCK_GETTIME).
Paul Eggert [Sat, 14 Nov 2020 18:27:50 +0000 (10:27 -0800)]
careadlinkat: warn better about GCC bug 93644
* lib/careadlinkat.c (readlink_stk): When --enable-gcc-warnings is
not in effect, use "#warning" to let builders know more clearly
about GCC bug 93644, because the bug triggers even if no -W option
is given to GCC.
Jim Meyering [Fri, 13 Nov 2020 15:34:28 +0000 (07:34 -0800)]
hard-locale-tests: avoid a -Wstrict-prototypes warning
* tests/locale.c (main): Placate gcc's -Wstrict-prototypes by
changing "main ()" to "main (void)". This was the only case that
triggered a warning when building grep with --enable-gcc-warnings.
Paul Eggert [Thu, 12 Nov 2020 03:20:42 +0000 (19:20 -0800)]
time_rz: simplify CVE-2017-7476 fix
* lib/time_rz.c: Do not include limits.h; I think it was included
under the mistaken impression that limits.h defines SIZE_MAX.
(SIZE_MAX): Remove.
(save_abbr): Put string length into a ptrdiff_t variable,
so that the size comparison works naturally. This
fixes CVE-2017-7476 in a cleaner way.
Paul Eggert [Thu, 12 Nov 2020 03:16:23 +0000 (19:16 -0800)]
parse-datetime: streamline overflow checking
When parse-datetime.y’s overflow code was written, INT_ADD_WRAPV
did not work for unsigned destinations, and since time_t might
be unsigned that meant it did not work for time_t destinations.
This limitation of INT_ADD_WRAPV has been fixed, so we can
now streamline parse-datetime.y a bit.
* lib/parse-datetime.y: Do not include limits.h, as LONG_MAX
has not been used for a while.
(yylex, parse_datetime2): Assume C99 declarations after statements.
(yyles): Use INT_SUBTRACT_WRAPV instead of an explicit comparison
to TYPE_MINIMUM.
(parse_datetime2): No need for time_overflow now that
INT_ADD_WRAPV works for unsigned results.
Paul Eggert [Thu, 12 Nov 2020 03:08:27 +0000 (19:08 -0800)]
parse-datetime-tests: port to Alpine Linux 3.12.1
* tests/test-parse-datetime.c: Include errno.h for errno,
and unistd.h for _SC_TZNAME_MAX and sysconf.
(main): In the outlandishly-long time zone abbreviation test,
do not exceed TZNAME_MAX as this has undefined behavior,
and on Alpine Linux 3.12.1 it makes the test fail.
Bruno Haible [Sat, 7 Nov 2020 20:07:04 +0000 (21:07 +0100)]
gnulib-tool: Fix link error with 'version-etc' (regression 2020-05-29).
Reported by Simon Josefsson in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-11/msg00032.html>.
* gnulib-tool (func_emit_tests_Makefile_am): Add libtests.a to
LDADD a third time, after the second occurrence of ../lib/libgnu.a.
* pygnulib/GLEmiter.py (tests_Makefile_am): Likewise.
Paul Eggert [Wed, 4 Nov 2020 22:51:38 +0000 (14:51 -0800)]
tests: port better to XLC 12.01
* tests/test-argmatch.c (CHECK): Do not use -1 as a subscript,
even in code that is not executed, as IBM XLC 12.01 complains "The
subscript -1 is less than zero."
* tests/test-stdint.c (verify_width): Pass an (unused) 3rd
argument to _GL_VERIFY, as ISO C requires. Otherwise, IBM XLC
12.01 complains "The invocation of macro _GL_VERIFY contains fewer
arguments than are required by the macro definition."
Pádraig Brady [Tue, 27 Oct 2020 21:04:14 +0000 (21:04 +0000)]
mountlist: recognize more file system types as remote
Sync "remote" file systems from stat.c in coreutils.
Note we only consider file systems that do not use host:resource
mount source. I.e. those that don't generally use a colon when
mounting, as that case is already considered. Searching for
"<fstype> /etc/fstab" was informative for identifying these.
The full list of "remote" file systems in coreutils is currently:
acfs afs ceph cifs coda fhgfs fuseblk fusectl
gfs gfs2 gpfs ibrix k-afs lustre novell nfs nfsd
ocfs2 panfs prl_fs smb smb2 snfs vboxsf vmhgfs vxfs
Note also we do not include virtual machine file systems,
as even though they're remote to the current kernel,
they are generally not distributed to separate hosts.
* lib/mountlist.c (ME_REMOTE): Sync previously unconsidered
"remote" file systems from stat.c in coreutils.
* tests/test-verify.c (test_assume_expressions): Add declaration.
(test_assume_optimization): Likewise.
(test_assume_noreturn): Likewise.
(main): Move down after all other definitions. While at it, also
call test_assume_expressions and test_assume_optimization as a
runtime check.
Paul Eggert [Mon, 26 Oct 2020 23:52:23 +0000 (16:52 -0700)]
sys_stat: update comments for S_IRWXUGO, S_IXUGO
* lib/sys_stat.in.h (S_IXUGO, S_IRWXUGO): Update comments.
Perhaps these macros should be removed, as they’re not in either
POSIX or GNU. They could be moved to stat-macros.h, which would
be cleaner in some sense.
Bruno Haible [Sun, 25 Oct 2020 17:18:06 +0000 (18:18 +0100)]
ssfmalloc tests: Small tweaks.
* tests/test-ssfmalloc.c: Add comments.
(alloc_pages): Don't require PROT_EXEC bits.
(block_sizes): Add more small sizes, for better coverage of
ssfmalloc-bitmap.h.
Bruno Haible [Sun, 11 Oct 2020 14:20:30 +0000 (16:20 +0200)]
stdioext: Treat OpenServer 6 and UnixWare 7 like OpenServer 5.
Reported Tim Rice <tim@multitalents.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00005.html>.
Uses the info from
<https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00028.html>.
* lib/stdio-impl.h: Test also __SCO_VERSION__ and __sysv5__.
Bruno Haible [Sat, 10 Oct 2020 20:52:22 +0000 (22:52 +0200)]
*-list, *-oset, *-omap: Avoid possible compiler warnings.
Reported by Marc Nieper-Wißkirchen in
<https://lists.gnu.org/r/bug-gnulib/2020-10/msg00025.html>.
* lib/gl_anylinked_list2.h (gl_linked_iterator,
gl_linked_iterator_from_to): Mark as 'pure'.
(gl_linked_iterator_free): Mark as 'const'.
* lib/gl_anytree_list2.h (gl_tree_size, gl_tree_node_value,
gl_tree_search_from_to, gl_tree_indexof_from_to, gl_tree_iterator,
gl_tree_iterator_from_to, gl_tree_sortedlist_search,
gl_tree_sortedlist_search_from_to, gl_tree_sortedlist_indexof,
gl_tree_sortedlist_indexof_from_to): Mark as 'pure'.
(gl_tree_iterator_free): Mark as 'const'.
* lib/gl_anytree_omap.h (gl_tree_size, gl_tree_iterator): Mark as
'pure'.
(gl_tree_iterator_free): Mark as 'const'.
* lib/gl_anytree_oset.h (gl_tree_size, gl_tree_next_node,
gl_tree_prev_node, gl_tree_iterator): Mark as 'pure'.
(gl_tree_iterator_free): Mark as 'const'.
* lib/gl_anytreehash_list1.h (node_position, compare_by_position,
compare_position_threshold): Mark as 'pure'.
* lib/gl_array_list.c (gl_array_size, gl_array_indexof_from_to,
gl_array_search_from_to, gl_array_iterator, gl_array_iterator_from_to,
gl_array_sortedlist_indexof_from_to, gl_array_sortedlist_indexof,
gl_array_sortedlist_search_from_to, gl_array_sortedlist_search): Mark as
'pure'.
(gl_array_iterator_free): Mark as 'const'.
* lib/gl_array_omap.c (gl_array_size, gl_array_indexof, gl_array_search,
gl_array_search_atleast, gl_array_iterator): Mark as 'pure'.
(gl_array_iterator_free): Mark as 'const'.
* lib/gl_array_oset.c (gl_array_size, gl_array_indexof, gl_array_search,
gl_array_indexof_atleast, gl_array_search_atleast, gl_array_iterator,
gl_array_iterator_atleast): Mark as 'pure'.
(gl_array_iterator_free): Mark as 'const'.
* lib/gl_carray_list.c (gl_carray_size, gl_carray_node_value,
gl_carray_next_node, gl_carray_previous_node, gl_carray_get_at,
gl_carray_indexof_from_to, gl_carray_search_from_to, gl_carray_iterator,
gl_carray_iterator_from_to, gl_carray_sortedlist_indexof_from_to,
gl_carray_sortedlist_indexof, gl_carray_sortedlist_search_from_to,
gl_carray_sortedlist_search): Mark as 'pure'.
(gl_carray_iterator_free): Mark as 'const'.
* MODULES.html.sh: Add entry for the stack module.
* modules/stack: New file.
* modules/stack-tests: New file.
* lib/stack.h: New file.
* tests/test-stack.c: New file.
Paul Eggert [Sat, 10 Oct 2020 18:48:16 +0000 (11:48 -0700)]
attribute: improve const, pure doc
Problem reported by Marc Nieper-Wißkirchen in:
https://lists.gnu.org/r/bug-gnulib/2020-10/msg00035.html
* lib/attribute.h (ATTRIBUTE_CONST, ATTRIBUTE_PURE): Improv doc. See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51971#c1
Paul Eggert [Mon, 5 Oct 2020 18:04:33 +0000 (11:04 -0700)]
thread: pacify GCC on Solaris 10
Problem reported by Kiyoshi KANAZAWA for grep (Bug#43666#29).
* lib/glthread/thread.h (gl_thread_self): Use ‘(pthread_t) 0’
instead of ‘(pthread_t) NULL’, to pacify GCC on Solaris 10
where pthread_t is unsigned int.
Paul Eggert [Sat, 3 Oct 2020 19:51:08 +0000 (12:51 -0700)]
c-stack: streamline Solaris configuration
* lib/c-stack.c: Omit mention of HAVE_SIGALTSTACK, since
the code is used only if a test for sigaltstack worked
in some other way.
* m4/c-stack.m4 (gl_PREREQ_C_STACK): Do not require gl_LIBSIGSEGV;
instead, execute gl_LIBSIGSEGV only if needed (because the XSI
heuristic does not work).
* modules/c-stack (Files): Add m4/libsigsegv.m4, since
we no longer require the libsigsegv module.
(Depends-on): Depend on havelib, not libsigsegv.
Paul Eggert [Wed, 30 Sep 2020 20:50:36 +0000 (13:50 -0700)]
c-stack: stop using SIGSTKSZ
It’s been proposed to stop making SIGSTKSZ an integer constant:
https://sourceware.org/pipermail/libc-alpha/2020-September/118028.html
Also, using SIGSTKSZ in #if did not conform to current POSIX.
Also, avoiding SIGSTKSZ makes the code simpler and easier to grok.
* lib/c-stack.c (SIGSTKSZ): Remove.
(alternate_signal_stack): Now a 64 KiB array, for simplicity.
All uses changed.
Paul Eggert [Tue, 29 Sep 2020 21:11:22 +0000 (14:11 -0700)]
c-stack: fix libsigsegv typo
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-09/msg00175.html
* lib/c-stack.c (USE_LIBSIGSEGV): Fix typo that caused libsigsegv
to be used only on Solaris (exactly where it is not needed!).
Paul Eggert [Mon, 28 Sep 2020 08:18:49 +0000 (01:18 -0700)]
version-etc: pacify Oracle Studio 12.6
Without this patch, it complains: "version-etc.h", line 64:
warning: token-less macro argument (E_TOKENLESS_MACRO)" when in
pedantic mode.
* lib/version-etc.h (version_etc): Port to C89 macro rules.
Bruno Haible [Sun, 27 Sep 2020 19:03:24 +0000 (21:03 +0200)]
Avoid "warning: $as_echo_n is obsolete" from autoconf 2.69c.
Reported by Gavin Smith <gavinsmith0123@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00151.html>.
* m4/gnulib-common.m4 (gl_CACHE_VAL_SILENT): Use gl_SILENT.
Paul Eggert [Sun, 27 Sep 2020 02:18:08 +0000 (19:18 -0700)]
extensions: require AC_GNU_SOURCE only for <=2.63
Problem reported by Gavin Smith in:
https://lists.gnu.org/r/autoconf/2020-09/msg00012.html
* m4/extensions.m4 ([gl_USE_SYSTEM_EXTENSIONS]):
Require AC_GNU_SOURCE only for Autoconf 2.63 and earlier, since it
shouldn’t be needed after that, and Autoconf 2.70 complains about
it being obsolete.
Paul Eggert [Sat, 26 Sep 2020 02:00:53 +0000 (19:00 -0700)]
regex-tests: fix possible Turkish false-alarm
* modules/regex-tests (Depends-on): Add wctype-h.
* tests/test-regex.c: Include wctype.h.
(main): Check that ‘i’ uppercases to ‘İ’ in Turkish,
as the Turkish regex test assumes this.
Paul Eggert [Fri, 25 Sep 2020 23:02:36 +0000 (16:02 -0700)]
regex-tests: fix test and add debug output
Perhaps this will fix the recent grep test failure reported at:
https://buildfarm.opencsw.org/buildbot/builders/ggrep-solaris10-sparc/builds/199
At least, the debug output should help narrow down the failure.
* tests/test-regex.c: Include stdarg.h, stdio.h.
(exit_status): New var.
(report_error): New function.
(main): Use it to report failures to stdout instead of merely
exiting with some nonzero status. The status info alone isn’t
enough to do remote debugging. In the new tr_TR.UTF-8 test, clear
regex before calling re_compile_pattern, fixing a portability bug.