Bruno Haible [Sat, 23 Mar 2019 20:39:37 +0000 (21:39 +0100)]
futimens: Document musl libc bug.
* doc/posix-functions/futimens.texi: Mention the bug.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Require AC_CANONICAL_HOST. When
cross-compiling, guess no on glibc and musl systems.
Akim Demaille [Mon, 18 Mar 2019 17:27:27 +0000 (18:27 +0100)]
bitset: expose bitset_resize
* lib/bitset.h (bitset_resize): Bounce on the polymorphic implementation.
* tests/test-bitset.c (check_attributes): Check bitset_resize.
(main): Use a variable bitset as reference, since fixed does not support resize.
Bruno Haible [Tue, 19 Mar 2019 23:37:52 +0000 (00:37 +0100)]
libtextstyle-optional: Add tests.
* tests/test-libtextstyle.c: New file, based on libtextstyle's
adhoc-tests/hello.c.
* tests/test-libtextstyle-default.css: New file, copied from
libtextstyle's adhoc-tests/hello-default.css.
* modules/libtextstyle-optional-tests: New file.
Bruno Haible [Tue, 19 Mar 2019 23:35:11 +0000 (00:35 +0100)]
libtextstyle-optional: New module.
* lib/textstyle.in.h: New file, based on libtextstyle's textstyle.h.
* m4/libtextstyle-optional.m4: New file, based on m4/libtextstyle.m4.
* modules/libtextstyle-optional: New file.
Bruno Haible [Tue, 19 Mar 2019 22:32:42 +0000 (23:32 +0100)]
Help making signal handlers more reliable.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Emit definition of
_GL_ASYNC_SAFE into config.h.
* lib/nanosleep.c (sighandler): Mark as _GL_ASYNC_SAFE.
* lib/fatal-signal.h (at_fatal_signal): Add _GL_ASYNC_SAFE marker to
argument.
* lib/fatal-signal.c (action_t, uninstall_handlers,
fatal_signal_handler): Mark as _GL_ASYNC_SAFE.
* lib/clean-temp.c (cleanup_action): Mark as _GL_ASYNC_SAFE.
* lib/wait-process.c (cleanup_slaves, cleanup_slaves_action): Mark as
_GL_ASYNC_SAFE.
* lib/c-stack.h (c_stack_action): Add _GL_ASYNC_SAFE marker to argument.
* lib/c-stack.c: Add _GL_ASYNC_SAFE markers.
Akim Demaille [Sat, 16 Mar 2019 16:16:48 +0000 (17:16 +0100)]
bitset: fix overflows
Reported by Bruno Haible.
https://lists.gnu.org/archive/html/bug-gnulib/2019-03/msg00017.html
* lib/bitset/table.c (tbitset_test): last_bit is the position of
the bit in the array of bitset_word, so be sure to take its modulo
number-of-bits-in-bitset-word (i.e., EBITSET_ELT_WORDS).
* lib/bitset/list.c (lbitset_unused_clear): Likewise.
Bruno Haible [Sat, 16 Mar 2019 21:56:21 +0000 (22:56 +0100)]
fatal-signal: Pass the signal number to the action.
* lib/fatal-signal.h (at_fatal_signal): Change the signature.
* lib/fatal-signal.c (action_t): Take the signal number as parameter.
(fatal_signal_handler): Pass the signal number to the action.
* lib/clean-temp.c (cleanup_action): Renamed from cleanup. Take the
signal number as parameter.
(create_temp_dir): Update.
* lib/wait-process.c (cleanup_slaves_action): New function.
(register_slave_subprocess): Update at_fatal_signal invocation.
* NEWS: Mention the change.
Bruno Haible [Thu, 14 Mar 2019 22:54:28 +0000 (23:54 +0100)]
isatty: Make it return true in Cygwin consoles on native Windows.
* lib/isatty.c: Include <string.h>.
(GetProcAddress): New macro.
(GetNamedPipeClientProcessIdFuncType): New type.
(GetNamedPipeClientProcessIdFunc): New variable.
(QueryFullProcessImageNameFuncType): New type.
(QueryFullProcessImageNameFunc): New variable.
(initialized): New variable.
(initialize): New function.
(IsCygwinConsoleHandle): New function.
(isatty): Invoke it.
* doc/posix-functions/isatty.texi: Mention the issue.
Paul Eggert [Mon, 11 Mar 2019 23:40:29 +0000 (16:40 -0700)]
strtod: fix clash with strtold
Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817).
* lib/strtod.c (compute_minus_zero, minus_zero):
Simplify by remving the macro / external variable,
and having just a function. User changed. This avoids
the need for an external variable that might clash.
Bruno Haible [Sun, 10 Mar 2019 19:39:34 +0000 (20:39 +0100)]
alloca-opt: Fix conflict mingw's new <alloca.h> file.
Reported by Eli Zaretskii <eliz@gnu.org>.
* lib/alloca.in.h: On mingw systems that have <alloca.h>, include that.
* m4/alloca.m4 (gl_FUNC_ALLOCA): Set HAVE_ALLOCA_H.
* modules/alloca-opt (Makefile.am): Substitute HAVE_ALLOCA_H.
* lib/get-rusage-as.c (get_rusage_as): When compiled by
"gcc -fsanitize=thread", don't try get_rusage_as_via_setrlimit.
* tests/test-pthread_sigmask2.c (main): Clean up the killer_thread
before exiting.
Jim Meyering [Sun, 10 Mar 2019 05:38:03 +0000 (21:38 -0800)]
test-userspec.c: don't print NULL
* tests/test-userspec.c (main): A test release of gcc,
9.0.1 20190310, warned that this test would attempt to
print a NULL pointer via a %s printf format. Fix that
and remove the unnecessary preceding "!diag" conjunct.
Also add a comment.
Bruno Haible [Sat, 9 Mar 2019 22:30:40 +0000 (23:30 +0100)]
strfmon_l: Fix -fsanitize=address finding.
* lib/strfmon_l.c: Include <errno.h>, <stdbool.h>, <stdlib.h>,
<string.h>.
(MAX_ARGS): Renamed from MAX_ARG_WORDS.
(directive_t, directives_t): New types.
(fmon_parse): New function.
(rpl_strfmon_l): Don't call va_arg more often than needed for the
format string. Consume 'long double' arguments in places where the
format string indicates so.
* modules/strfmon_l (Depends-on): Add 'stdbool'.
Bruno Haible [Sat, 9 Mar 2019 19:32:25 +0000 (20:32 +0100)]
Fix undefined behaviour.
* lib/bitrotate.h (rotl16, rotr16, rotl8, rotr8): Case x to
'unsigned int', to avoid shift operations on 'int'.
* lib/xmemdup0.c (xmemdup0): Don't invoke memcpy with a zero size.
* tests/test-count-leading-zeros.c (main): Use a random number that has
as many bits as TYPE, not only 2*15 or 2*31 bits.
* tests/test-count-trailing-zeros.c (main): Likewise.
* tests/test-count-one-bits.c (main): Likewise.
* tests/test-memmem.c: Don't include "null-ptr.h".
(main): Use zerosize_ptr() instead of null_ptr().
* modules/memmem-tests (Files): Remove tests/null-ptr.h.
Paul Eggert [Tue, 5 Mar 2019 23:05:33 +0000 (15:05 -0800)]
git-version-gen: fix --version copyright year
* build-aux/git-version-gen, build-aux/move-if-change (version):
--version output copyright year is now taken from script year,
so that it no longer needs to be updated by hand.
Bruno Haible [Mon, 4 Mar 2019 16:25:09 +0000 (17:25 +0100)]
relocatable-prog: Use wrapper-free installation on Mac OS X, take 2.
This approach supports relocatable installation of shared libraries
which depend on other shared libraries from the same package.
* m4/relocatable.m4 (gl_RELOCATABLE_BODY): Determine use_macos_tools.
If use_macos_tools is true, use reloc-ldflags and set LIBTOOL to be a
wrapper around the original LIBTOOL.
* build-aux/reloc-ldflags: Add support for Mac OS X, which uses the
token '@loader_path' instead of '$ORIGIN'.
* build-aux/libtool-reloc: New file.
* modules/relocatable-prog (Files): Add it.
* doc/relocatable-maint.texi (Supporting Relocation): Update to match
the recent changes. Document the need to set the *_LDFLAGS of libraries.
RELOCATABLE_LIBRARY_PATH and RELOCATABLE_CONFIG_H_DIR should be set in
Makefile.am, not in configure.ac.
Paul Eggert [Mon, 25 Feb 2019 07:32:07 +0000 (23:32 -0800)]
nstrftime: support the ‘+’ flag
* lib/nstrftime.c (add, __strftime_internal):
Add support for the ‘+’ flag introduced in POSIX.1-2017.
(__strftime_internal): New arg ‘width’. All uses changed.
(DO_YEARISH, DO_MAYBE_SIGNED_NUMBER): New macros.
Bruno Haible [Sun, 24 Feb 2019 10:59:48 +0000 (11:59 +0100)]
stat, lstat: Fix conflict with relocatable-prog-wrapper module.
* lib/stat.c: On platforms other than OSF/1, include <sys/stat.h>, not
"sys/stat.h".
* lib/lstat.c: Likewise.
* lib/fstat.c: Likewise.
* lib/fstatat.c: Likewise.
Bernhard Voelker [Thu, 29 Nov 2018 08:06:26 +0000 (09:06 +0100)]
long-options: add parse_gnu_standard_options_only
Discussed in https://bugs.gnu.org/33468 .
* lib/long-options.c (parse_long_options): Use EXIT_SUCCESS instead
of 0.
(parse_gnu_standard_options_only): Add function to
process the GNU default options --help and --version and fail for any other
unknown long or short option. See
https://gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html .
* lib/long-options.h (parse_gnu_standard_options_only): Declare it.
* modules/long-options (depends-on): Add stdbool, exitfail.
* top/maint.mk (sc_prohibit_long_options_without_use): Update
syntax-check rule, add new function name.
Bruno Haible [Sat, 23 Feb 2019 21:42:54 +0000 (22:42 +0100)]
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Reported by Paul Smith <psmith@gnu.org>.
* build-aux/install-reloc: Accept a 'mode' argument as first argument.
(func_relativize): New function, from gnulib-tool.
Handle mode 'macosx' through invocations of 'otool' and
'install_name_tool'.
* m4/relocatable.m4 (gl_RELOCATABLE_BODY): Determine use_macos_tools.
If use_macos_tools is true, set INSTALL_PROGRAM_ENV to an
'install-reloc' invocation with mode 'macosx'.
Paul Eggert [Fri, 22 Feb 2019 04:07:21 +0000 (20:07 -0800)]
nstrftime: merge glibc strftime changes
This incorporates:
2019-02-11 Fix a few whitespace arrangement inconsistencies
2019-01-24 strftime: Pass flags from "%EY" to "%Ey" [BZ #24096]
2019-01-24 Set the default width of "%Ey" to 2 [BZ #23758]
2019-01-11 strftime: use the "L_" macro with character literals
* lib/nstrftime.c (__strftime_internal): New arg yr_spec. All
callers changed. Default width of %Ey is now 2. This is needed
for proper handling of Japanese dates starting on 2019-05-01.
Bruno Haible [Wed, 20 Feb 2019 01:39:52 +0000 (02:39 +0100)]
relocatable-prog: Use $ORIGIN trick on more platforms.
* m4/relocatable.m4 (gl_RELOCATABLE_BODY): Use $ORIGIN trick also on
FreeBSD >= 7.3, DragonFly >= 3.0, NetBSD >= 8.0, OpenBSD >= 5.4,
Solaris >= 10, Haiku. But don't use it on Android.
* build-aux/reloc-ldflags: Allow the use of the $ORIGIN trick also on
Hurd, FreeBSD, DragonFly, NetBSD, OpenBSD, Solaris, Haiku.
Bruno Haible [Tue, 19 Feb 2019 20:42:54 +0000 (21:42 +0100)]
progreloc: Speed up executable lookup on various platforms.
* lib/progreloc.c: Include <errno.h>.
(safe_read, full_read): New functions.
(find_executable): On GNU/kFreeBSD, FreeBSD, DragonFly, NetBSD, Solaris,
prefer the information from the /proc file system to a PATH search.
Bruno Haible [Fri, 15 Feb 2019 20:27:44 +0000 (21:27 +0100)]
gnulib-tool: Support --import with just a few tests, not --with-tests.
* gnulib-tool (func_import): New variable 'gentests'. Use it instead of
'inctests' when generating files; use 'inctests' only for computing the
transitive closure.
Bruno Haible [Thu, 14 Feb 2019 19:50:57 +0000 (20:50 +0100)]
gnulib-tool: Improve handling of multiple --local-dir options.
* doc/gnulib.texi (Extending Gnulib): Explain how multiple --local-dir
options work.
* gnulib-tool (func_path_prepend): Remove function.
(func_path_foreach): Make IFS handling more robust.
(local_gnulib_path): Collect --local-dir values using func_path_append,
not func_path_prepend.
(func_determine_path_separator): Make IFS handling more robust.
(func_lookup_file_cb): New function.
(func_lookup_file): Rewritten to use func_lookup_file_cb instead of
func_lookup_local_file. Apply the patches in the reverse order of their
origin in $local_gnulib_path.
(func_count_relative_local_gnulib_path): Make IFS handling more robust.
* NEWS: Mention that the first --local-dir option is the one with
highest priority.
Paul Eggert [Sat, 2 Feb 2019 21:01:55 +0000 (13:01 -0800)]
dtoastr,ftoastr,ldtoastr: port to c-strtod changes
Decouple these modules from c-strtod. Nowadays it’s reasonable to
assume the C99 signatures for strtod and strtold. Programs that
require stricter adherence to C99 should also use the strtod and
strtold modules as needed, and we no longer need the
HAVE_C99_STRTOLD macro.
* NEWS: Mention this.
* lib/ftoastr.c (STRTOF) [LENGTH == 3]: Assume strtold.
* m4/c-strtod.m4 (gl_C_STRTOLD): Do not define HAVE_C99_STRTOLD.
* modules/dtoastr, modules/ftoastr, modules/ldtoastr:
(Files): Remove m4/c-strtod.m4.
(configure.ac): Do not require gl_C99_STRTOLD, which no longer
exists.
Bruno Haible [Fri, 1 Feb 2019 03:34:37 +0000 (04:34 +0100)]
c-strtod, c-strtold: Use the bug fixes for strtod, strtold.
* lib/stdlib.in.h (GNULIB_defined_strtod_function,
GNULIB_defined_strtold_function): New macros.
* lib/c-strtod.c (HAVE_GOOD_STRTOD_L): New macro.
(STRTOD): Ignore HAVE_C99_STRTOLD.
(c_locale): Don't define it on platforms where strtod_l/strtold_l is
deemed buggy. But do use it on platforms where uselocale exists and is
usable.
(C_STRTOD): Don't use STRTOD_L on platforms where strtod_l/strtold_l is
deemed buggy. On platforms where uselocale exists and is usable, use
uselocale and strtod/strtold.
* m4/c-strtod.m4 (gl_C99_STRTOLD): Remove macro.
(gl_C_STRTOD): Require gt_FUNC_USELOCALE.
(gl_C_STRTOLD): Likewise. Define HAVE_C99_STRTOLD unconditionally.
* modules/c-strtod (Files): Add m4/intl-thread-locale.m4.
(Depends-on): Add strtod.
* modules/c-strtold (Files): Add m4/intl-thread-locale.m4.
(Depends-on): Add strtold.
Bruno Haible [Fri, 1 Feb 2019 02:12:28 +0000 (03:12 +0100)]
strtod, strtold: Use the locale's decimal point.
* lib/strtod.c: Include <locale.h>, <stdio.h>, <langinfo.h>.
(decimal_point_char): New function, copied from lib/vasnprintf.c.
(parse_number): Add a radixchar argument. Use it instead of '.'.
(STRTOD): Invoke decimal_point_char and pass the result to parse_number.
* m4/strtod.m4 (gl_PREREQ_STRTOD): Test whether nl_langinfo exists.
* m4/strtold.m4 (gl_PREREQ_STRTOLD): Likewise.
* tests/test-strtod1.c: New file.
* tests/test-strtod1.sh: New file.
* modules/strtod-tests (Files): Add test-strtod1.{sh,c}. Add
locale-fr.m4 and its dependencies.
(configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8.
(Makefile.am): Arrange to compile test-strtod1.c and run
test-strtod1.sh.
* tests/test-strtold1.c: New file.
* tests/test-strtold1.sh: New file.
* modules/strtold-tests (Files): Add test-strtold1.{sh,c}. Add
locale-fr.m4 and its dependencies.
(configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8.
(Makefile.am): Arrange to compile test-strtold1.c and run
test-strtold1.sh.
Bruno Haible [Thu, 31 Jan 2019 23:18:57 +0000 (00:18 +0100)]
strtod, strtold: Work around HP-UX 11.31/ia64 bug.
* lib/strtod.c (STRTOD): When there is an extra character after the
exponent marker 'p', reparse the number.
* doc/posix-functions/strtod.texi: Document the HP-UX 11.31 bug.
* doc/posix-functions/strtold.texi: Likewise.
Bruno Haible [Wed, 30 Jan 2019 02:52:31 +0000 (03:52 +0100)]
strtold: New module.
* lib/stdlib.in.h (strtold): New declaration.
* lib/strtold.c: New file.
* lib/strtod.c: Consider USE_LONG_DOUBLE.
(STRTOD, LDEXP, HAVE_UNDERLYING_STRTOD, DOUBLE, MIN, MAX, L_,
USE_LDEXP): New macros.
(LDEXP, scale_radix_exp, parse_number, STRTOD): Adapt for
USE_LONG_DOUBLE.
(underlying_strtod): Remove function. Replace with some macros.
Re-add the code for a missing underlying function that was removed on
2013-02-19.
* m4/strtold.m4: New file.
* m4/stdlib_h.m4 (gl_STDLIB_H): Test whether strtold is declared.
(gl_STDLIB_H_DEFAULTS): Initialize GNULIB_STRTOLD, HAVE_STRTOLD,
REPLACE_STRTOLD.
* modules/stdlib (Makefile.am): Substitute GNULIB_STRTOLD, HAVE_STRTOLD,
REPLACE_STRTOLD.
* modules/strtold: New file.
* doc/posix-functions/strtold.texi: Document the new module.
Bruno Haible [Mon, 28 Jan 2019 20:14:08 +0000 (21:14 +0100)]
Fix build error when building a shared libunistring on Android.
* tests/uninorm/test-nfc.c (n): Don't define on Android.
(main): Add 'volatile', to defeat a GCC optimization that would
eliminate the reference.
* tests/uninorm/test-nfd.c (n): Don't define on Android.
(main): Add 'volatile', to defeat a GCC optimization that would
eliminate the reference.
* tests/uninorm/test-nfkc.c (n): Don't define on Android.
(main): Add 'volatile', to defeat a GCC optimization that would
eliminate the reference.
* tests/uninorm/test-nfkd.c (n): Don't define on Android.
(main): Add 'volatile', to defeat a GCC optimization that would
eliminate the reference.