Bruno Haible [Thu, 19 Jan 2023 20:55:27 +0000 (21:55 +0100)]
Fix warnings for functions introduced in Android API level 21.
* m4/_Exit.m4 (gl_FUNC__EXIT): Test for _Exit using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/c-strtod.m4 (gl_C_STRTOLD): Test for strtold_l using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): Test for c32rtomb like
gl_CHECK_FUNCS_ANDROID does.
* m4/dprintf.m4 (gl_FUNC_DPRINTF): Test for dprintf using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Likewise.
* m4/dup3.m4 (gl_FUNC_DUP3): Test for dup3 using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Test for duplocale using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/execvpe.m4 (gl_FUNC_EXECVPE): Test for execvpe using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/fts.m4 (gl_FUNC_FTS_CORE): Test for fts_open using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNC.
* m4/getprogname.m4 (gl_FUNC_GETPROGNAME): Test for getprogname using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE): Test for uselocale using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/iswblank.m4 (gl_FUNC_ISWBLANK): Test for iswblank using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/libtextstyle-optional.m4 (gl_LIBTEXTSTYLE_OPTIONAL): Test for
tcdrain using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/linkat.m4 (gl_FUNC_LINKAT): Test for linkat using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/localename.m4 (gl_LOCALENAME): Test for newlocale, duplocale,
freelocale using gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/mbrtoc32.m4 (gl_CHECK_FUNC_MBRTOC32): Test for mbrtoc32 like
gl_CHECK_FUNCS_ANDROID does.
* m4/mbsnrtowcs.m4 (gl_FUNC_MBSNRTOWCS): Test for mbsnrtowcs using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/mbtowc.m4 (gl_FUNC_MBTOWC): Test for mbtowc using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Test for mknodat using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/mountlist.m4 (gl_MOUNTLIST): Test for setmntent, endmntent using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/posix_openpt.m4 (gl_FUNC_POSIX_OPENPT): Test for posix_openpt using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/pty.m4 (gl_FUNC_OPENPTY): Test for posix_openpt using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/random.m4 (gl_FUNC_RANDOM): Test for initstate, setstate using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/stpcpy.m4 (gl_FUNC_STPCPY): Test for stpcpy using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/stpncpy.m4 (gl_FUNC_STPNCPY): Test for stpncpy using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Test for symlinkat using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/truncate.m4 (gl_FUNC_TRUNCATE): Test for truncate using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/tsearch.m4 (gl_FUNC_TSEARCH): Test for twalk using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/vdprintf.m4 (gl_FUNC_VDPRINTF): Test for vdprintf using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise.
* m4/wcsnrtombs.m4 (gl_FUNC_WCSNRTOMBS): Test for wcsnrtombs using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/readlinkat.m4 (gl_FUNC_READLINKAT): Test for readlinkat using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/fchmodat.m4 (gl_PREREQ_FCHMODAT): Likewise.
* modules/careadlinkat (configure.ac): Likewise.
* modules/ftoastr (configure.ac): Test for strtof using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* modules/duplocale-tests (configure.ac): Test for duplocale using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* modules/hard-locale-tests (configure.ac): Likewise.
* modules/locale-tests (configure.ac): Test for newlocale using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* modules/localename-tests (configure.ac): Likewise.
* modules/tsearch-tests (configure.ac): Test for initstate using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* modules/unistr/u8-stpcpy (configure.ac): Test for stpcpy using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/tcgetattr.m4: New file, extracted from m4/getpass.m4.
* m4/getpass.m4 (gl_PREREQ_GETPASS): Remove code that tests for
tcgetattr. Invoke gl_HAVE_TCGETATTR instead.
* modules/getpass (Files): Add tcgetattr.m4.
* modules/getpass-gnu (Files): Add tcgetattr.m4.
* modules/term-style-control (Files): Add tcgetattr.m4.
(configure.ac): Remove code that tests for tcgetattr. Invoke
gl_HAVE_TCGETATTR instead.
Bruno Haible [Thu, 19 Jan 2023 20:55:25 +0000 (21:55 +0100)]
Fix warnings for functions introduced in Android API level 19.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Test for futimens using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/utimens.m4 (gl_UTIMENS): Likewise.
* m4/imaxabs.m4 (gl_FUNC_IMAXABS): Test for imaxabs using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Test for imaxdiv using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
Bruno Haible [Thu, 19 Jan 2023 20:55:23 +0000 (21:55 +0100)]
Fix warnings for functions introduced in Android API level 18.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Test for getdelim using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/getline.m4 (gl_FUNC_GETLINE): Test for getline using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNC.
* m4/log2.m4 (gl_FUNC_LOG2): Test for log2 using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/log2f.m4 (gl_FUNC_LOG2F): Test for log2f using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/log2l.m4 (gl_FUNC_LOG2L): Test for log2l using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
Bruno Haible [Thu, 19 Jan 2023 20:55:17 +0000 (21:55 +0100)]
Fix warnings for functions introduced in Android API level 16.
* m4/faccessat.m4 (gl_FUNC_FACCESSAT): Test for faccessat using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE,
gl_CANONICALIZE_LGPL_SEPARATE): Likewise.
* m4/euidaccess.m4 (gl_PREREQ_EUIDACCESS): Likewise.
* m4/tsearch.m4 (gl_FUNC_TSEARCH): Test for tsearch using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/setenv.m4 (gl_PREREQ_SETENV): Likewise.
Bruno Haible [Thu, 19 Jan 2023 20:55:15 +0000 (21:55 +0100)]
Fix warnings for functions introduced in Android API level 12.
Reported by Po Lu <luangruo@yahoo.com>.
* m4/ftruncate.m4 (gl_FUNC_FTRUNCATE): Test for ftruncate using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/glob.m4 (gl_PREREQ_GLOB): Test for getpwnam_r using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/nproc.m4 (gl_PREREQ_NPROC): Test for sched_getaffinity using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/pread.m4 (gl_FUNC_PREAD): Test for pread using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/pwrite.m4 (gl_FUNC_PWRITE): Test for pwrite using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/thread.m4 (gl_THREAD): Test for pthread_atfork using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
* m4/timegm.m4 (gl_FUNC_TIMEGM): Test for timegm using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Test for utimensat using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/utimens.m4 (gl_UTIMENS): Likewise.
Bruno Haible [Thu, 19 Jan 2023 20:55:13 +0000 (21:55 +0100)]
Fix warnings for functions introduced in Android API level 9.
* m4/pipe2.m4 (gl_FUNC_PIPE2): Test for pipe2 using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* m4/fdatasync.m4 (gl_FUNC_FDATASYNC): Update comments.
Paul Eggert [Tue, 17 Jan 2023 23:21:26 +0000 (15:21 -0800)]
qcopy-acl: port to Fedora 9
It has libattr-2.4.41, which is too old for our code.
Problem reported by Po Lu <https://bugs.gnu.org/60843>.
* m4/xattr.m4 (gl_FUNC_XATTR): Check that we can use
ATTR_ACTION_PERMISSIONS, too. Refactor so that there’s a single
test program that we compile and link, rather than doing the tests
in dribs and drabs.
Bruno Haible [Tue, 17 Jan 2023 18:16:29 +0000 (19:16 +0100)]
fflush: Fix a buffer overrun on 32-bit Android.
* lib/stdio-impl.h (fp_): On Android, change the type of _offset to
'long'.
* lib/fflush.c (update_fpos_cache): On Android, update a 'long', not an
'fpos_t'.
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.