Bruno Haible [Tue, 17 Jan 2023 13:09:41 +0000 (14:09 +0100)]
hard-locale: Port to Android ≥ 5.0.
* lib/hard-locale.c: Include <stdlib.h>.
(hard_locale): On Android, consider also MB_CUR_MAX, even if the
locale's name is "C".
* tests/test-hard-locale.c (test_one, main): Assume that on Android,
even the "C" locale is hard.
Bruno Haible [Mon, 16 Jan 2023 13:34:56 +0000 (14:34 +0100)]
mbrtowc, mbrtoc32 tests: Avoid test failure on Android ≥ 5.0.
* tests/test-mbrtowc.c (main): On Android 5.0 or newer, when testing
the "C" locale, verify that the encoding is UTF-8.
* tests/test-mbrtoc32.c (main): Likewise.
* doc/posix-functions/setlocale.texi: Mention the Android problems.
Paul Eggert [Sun, 15 Jan 2023 19:48:43 +0000 (11:48 -0800)]
alignasof: new module
This splits off support for the C23 keywords alignas and alignof,
from the now-deprecated stdalign module. The latter now merely
provides C11 support.
* MODULES.html.sh, NEWS, doc/gnulib.texi:
* doc/posix-headers/stdalign.texi: Document the change.
* lib/stdalign.in.h: Remove most of the definitions (which are now
supplied by the alignasof module), leaving only
__alignas_is_defined and __alignof_is_defined.
* modules/alignasof, modules/alignasof-tests: New files.
* m4/stdalign.m4 (gl_ALIGNASOF): New macro, with
most of the contents of the old gl_STDALIGN_H.
Do not define __alignas_is_defined or __alignof_is_defined.
(gl_STDALIGN_H): Rely on gl_ALIGNASOF for most of the work.
* modules/alignalloc, modules/alignof, modules/argp:
* modules/crypto/md4-buffer, modules/crypto/md5-buffer:
* modules/crypto/sha1-buffer, modules/crypto/sha256-buffer:
* modules/crypto/sha512-buffer, modules/crypto/sm3-buffer:
* modules/fts, modules/rawmemchr, modules/relocatable-prog-wrapper:
* modules/stddef-tests, modules/sys_socket:
Depend on alignasof, not stdalign.
* modules/stdalign: Deprecate. Depend on alignasof.
* modules/stdalign-tests: Move most contents to the new module
alignasof-tests, and depend on that.
Paul Eggert [Sun, 15 Jan 2023 00:47:41 +0000 (16:47 -0800)]
test-framework-sh: work around AIX 7.2 diff bugs
* tests/init.sh (compare_dev_null_): Run diff in the C locale.
AIX 7.2 diff messes up in UTF-8 locales; for example,
‘printf '\360\220\200\200\n' | diff - /dev/null’ incorrectly
outputs nothing and exits with status 0 when LC_ALL=en_US.UTF-8.
Paul Eggert [Fri, 13 Jan 2023 22:32:11 +0000 (14:32 -0800)]
verify: work around xlclang 16.1 compiler bug
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/grep-devel/2023-01/msg00003.html
* lib/verify.h (_GL_HAS_BUILTIN_TRAP, _GL_HAS_BUILTIN_UNREACHABLE):
Define to 0 if compiler advertises itself as clang before version 5.
xlclang 16.1 advertises itself as 4.0.1 and this patch works
around what appears to be a compiler bug when compiling dfa.c in
bleeding-edge grep.
Paul Eggert [Fri, 13 Jan 2023 19:57:35 +0000 (11:57 -0800)]
assert-h: fix configure comment-out
* m4/assert_h.m4 (gl_ASSERT_H): Also break apart "#undef
static_assert" with /**/. Problem discovered with xlclang 16.1,
though it does not directly affect xlclang 16.1.
Paul Eggert [Fri, 13 Jan 2023 19:40:24 +0000 (11:40 -0800)]
Don’t use alloc_size with xlclang 16.1
* m4/gnulib-common.m4 (_GL_HAS_ATTRIBUTE): Require Clang 5 instead
of 3.5 for this, to pacify xlclang 16.1.0 on AIX 7.2, which
advertises itself as clang 4.1.0, and which otherwise issues
warnings like “./xalloc.h:141:3: warning: 1540-2990 The attribute
"__attribute__((alloc_size(2, 3)))" is not supported. The
attribute is ignored.” when building bleeding-edge GNU grep.
Ondrej Valousek [Wed, 4 Jan 2023 14:34:26 +0000 (15:34 +0100)]
qcopy-acl: Optimize copying of ACLs by directly copying the attributes.
* lib/qcopy-acl.c (is_attr_permissions): New functions.
(qcopy_acl): If USE_XATTR, copy the ACL related attributes directly.
* m4/xattr.m4: New file.
* modules/qcopy-acl (Files): Add it.
(configure.ac): Invoke gl_FUNC_XATTR.
Bruno Haible [Thu, 12 Jan 2023 15:39:21 +0000 (16:39 +0100)]
error, verror tests: Add clarification.
* tests/test-error.c (main): Clarify why we don't test error_at_line
with a NULL filename.
* tests/test-verror.c (main): Clarify why we don't test verror_at_line
with a NULL filename.
Bruno Haible [Thu, 12 Jan 2023 11:34:43 +0000 (12:34 +0100)]
verror: Add tests.
* tests/test-verror.sh: New file, based on tests/test-error.sh.
* tests/test-verror.c: New file, based on tests/test-error.c.
* modules/verror-tests: New file.
Bruno Haible [Wed, 11 Jan 2023 18:51:43 +0000 (19:51 +0100)]
posix_spawn_file_actions_addfchdir tests: Fix test failure on Android.
* tests/test-posix_spawn-fchdir.c: Include xvasprintf.h.
(test): On Android, use "/proc" instead of "/".
(main): Determine the relative location of the 'pwd' program
accordingly.
* modules/posix_spawn_file_actions_addfchdir-tests (Depends-on): Add
xvasprintf.
Bruno Haible [Wed, 11 Jan 2023 17:15:59 +0000 (18:15 +0100)]
link, linkat tests: Fix test failures on Android/Termux.
* tests/test-link.h (test_link): On Android, treat an EACCES failure
like EPERM.
* tests/test-linkat.c (main): When test_link is marked skipped, skip the
rest of the test as well.
Jim Meyering [Tue, 3 Jan 2023 06:52:08 +0000 (22:52 -0800)]
update-copyright: also work with two or more updatable lines in a file
* build-aux/update-copyright: Replace every occurrence of the copyright
line, not just the first one.
* tests/test-update-copyright.sh: Add a test case for this.
Bruno Haible [Tue, 10 Jan 2023 16:44:04 +0000 (17:44 +0100)]
immutable: Fix initialization failure on Android.
* lib/immutable.c: Include "pathmax.h".
(do_init_mmap_file): Use $TMPDIR rather than /tmp, if it is safe.
* modules/immutable (Depends-on): Add pathmax.
Bruno Haible [Tue, 10 Jan 2023 11:52:10 +0000 (12:52 +0100)]
secure_getenv: Fix warning on Android.
* m4/secure_getenv.m4 (gl_FUNC_SECURE_GETENV): Test for issetugid using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* lib/secure_getenv.c: Fix comment regarding issetugid.
Bruno Haible [Mon, 9 Jan 2023 20:31:52 +0000 (21:31 +0100)]
threads-h: Improve portability.
* lib/threads.in.h: Use INCLUDE_NEXT_AS_FIRST_DIRECTIVE when possible.
* modules/threads-h (Makefile.am): Substitute
INCLUDE_NEXT_AS_FIRST_DIRECTIVE and NEXT_AS_FIRST_DIRECTIVE_THREADS_H.
Bruno Haible [Mon, 9 Jan 2023 20:18:20 +0000 (21:18 +0100)]
malloc-h: Improve portability.
* lib/malloc.in.h: Use INCLUDE_NEXT_AS_FIRST_DIRECTIVE when possible.
* modules/malloc-h (Makefile.am): Substitute
INCLUDE_NEXT_AS_FIRST_DIRECTIVE and NEXT_AS_FIRST_DIRECTIVE_MALLOC_H.
Bruno Haible [Mon, 9 Jan 2023 12:47:25 +0000 (13:47 +0100)]
malloc-h: Fix compilation errors in C++ mode on Android.
* lib/malloc.in.h: Don't include <stdlib.h>, except on Solaris and on
HP-UX. Include <stddef.h>. Make _GL_ATTRIBUTE_DEALLOC_FREE work (code
snippet copied from string.in.h and wchar.in.h).
* m4/malloc_h.m4 (gl_MALLOC_H_REQUIRE_DEFAULTS): Invoke
gl_STDLIB_H_REQUIRE_DEFAULTS.
* modules/malloc-h (Depends-on): Add stddef, stdlib.
(Makefile.am): Substitute GNULIB_FREE_POSIX and REPLACE_FREE.
Paul Eggert [Fri, 6 Jan 2023 19:20:05 +0000 (11:20 -0800)]
bootstrap: suppress stray message from --pull
* build-aux/bootstrap: Regenerate.
* top/bootstrap-funclib.sh (autopull): Suggest running autogen.sh
only if it exists (i.e., the package is using autopull.sh/autogen.sh).
Suggest the same name for autogen.sh that is used in the test.
Bruno Haible [Thu, 5 Jan 2023 10:11:50 +0000 (11:11 +0100)]
More systematic naming of LIB variables.
* m4/acl.m4 (gl_FUNC_ACL, gl_FILE_HAS_ACL): Set FILE_HAS_ACL_LIB to the
same value as LIB_HAS_ACL.
* modules/file-has-acl (Link): Use FILE_HAS_ACL_LIB instead of
LIB_HAS_ACL.
* modules/file-has-acl-tests (Makefile.am): Likewise.
Bruno Haible [Tue, 3 Jan 2023 20:33:32 +0000 (21:33 +0100)]
ffsl, ffsll: Fix compilation error on Android.
* lib/string.in.h: On Android as well, include <strings.h>.
* m4/ffsl.m4 (gl_FUNC_FFSL): Use a specific link test instead of
AC_CHECK_FUNCS_ONCE.
* m4/ffsll.m4 (gl_FUNC_FFSLL): Likewise.
* doc/glibc-functions/ffsl.texi: Mention Android problems.
* doc/glibc-functions/ffsll.texi: Likewise.
Bruno Haible [Tue, 3 Jan 2023 16:14:33 +0000 (17:14 +0100)]
stdio: Fix error in C++ mode on Android, due to putw.
* lib/stdio.in.h (putw): Don't declare in the C++ namespace if putw is
not declared.
* m4/stdio_h.m4 (gl_STDIO_H): Test whether putw is declared.
(gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_PUTW.
* modules/stdio (Makefile.am): Substitute HAVE_DECL_PUTW.
* doc/glibc-functions/putw.texi: Update regarding Android.
Bruno Haible [Tue, 3 Jan 2023 16:11:19 +0000 (17:11 +0100)]
stdio: Fix error in C++ mode on Android, due to getw.
* lib/stdio.in.h (getw): Don't declare in the C++ namespace if getw is
not declared.
* m4/stdio_h.m4 (gl_STDIO_H): Test whether getw is declared.
(gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_GETW.
* modules/stdio (Makefile.am): Substitute HAVE_DECL_GETW.
Bruno Haible [Mon, 2 Jan 2023 15:57:31 +0000 (16:57 +0100)]
sigsegv: Fix compilation error on Android 4.3.
* lib/sigsegv.in.h: For Android, don't include <ucontext.h> and don't
reference ucontext_t.
* lib/sigsegv.c (SIGSEGV_FAULT_): For Android, use a plain POSIX fault
handler (cf. libsigsegv/src/fault-posix.h).
Paul Eggert [Mon, 2 Jan 2023 06:06:10 +0000 (22:06 -0800)]
dfa: work around Clang 15 bug
Problem reported by Kenton Groombridge in:
https://lists.gnu.org/archive/html/bug-gawk/2022-12/msg00010.html
On x86-64, Clang 15 gets confused by a call (X ? dfaerror :
dfawarn) (Y) and generates the wrong code, presumably because
dfaerror is _Noreturn and dfawarn is not.
* lib/dfa.c (parse_bracket_exp): Reword to have one call for
dfaerror, the other for dfawarn.
Paul Eggert [Sun, 1 Jan 2023 02:40:56 +0000 (18:40 -0800)]
maint: use UTC when updating copyright date
Problem reported by Simon Joseffson in:
https://lists.gnu.org/r/bug-gnulib/2022-12/msg00125.html
* Makefile (COPYRIGHT_TZ): New macro.
(update-copyright): Use it.
Paul Eggert [Wed, 28 Dec 2022 22:15:43 +0000 (14:15 -0800)]
assert-h: port static_assert to strict C99
* lib/verify.h (_GL_VERIFY): Port MSVC hack back to C99.
Problem found when testing bleeding-edge gzip on IBM XL C for AIX,
V12.1 (5765-J02, 5725-C72), which complained ‘"malloca.c", line
42.56: 1506-041 (E) The invocation of macro _Static_assert
contains fewer arguments than are required by the macro
definition.’ This diagnostic is valid because C99 requires
that if you #define _Static_assert(R, ...) you must call
_Static_assert with at least two arguments. I found a similar
problem with Sun C 5.9 SunOS_sparc Patch 124867-12 2009/11/22.