Paul Eggert [Mon, 21 Apr 2025 17:58:58 +0000 (10:58 -0700)]
getloadavg: port to Android 3.1-
Problem reported by Po Lu in:
https://lists.gnu.org/r/bug-gnulib/2025-04/msg00172.html
* lib/getloadavg.c (getloadavg): Do not try to use sysinfo on
Android 3.1 Honeycomb (API 12, 2011) and earlier.
Paul Eggert [Mon, 7 Apr 2025 08:45:17 +0000 (01:45 -0700)]
file-has-acl: port symlink code to Cygwin
Problem reported by Corinna Vinschen in:
https://lists.gnu.org/r/bug-gnulib/2025-03/msg00112.html
* lib/file-has-acl.c (acl_get_link_np): New static function,
defined only if needed; include <fcntl.h> if needed for this.
(HAVE_ACL_GET_LINK_NP): Define this if defining acl_get_link_np.
* lib/stdio-impl.h (fp_) [__HAIKU__]: Define to FILE which is an
incomplete type on Haiku.
(_IO_EOF_SEEN) [__HAIKU__]: Define macro.
* lib/fseeko.c (fp_) [!__HAIKU__]: Define to fp.
(fseeko): Use fp_ instead of fp.
Bruno Haible [Fri, 21 Mar 2025 15:25:59 +0000 (16:25 +0100)]
getloadavg: Improve Linux and Android support.
* lib/getloadavg.c [__linux__, __ANDROID__]: Include <sys/param.h> and
<sys/sysinfo.h>.
(getloadavg) [__linux__, __ANDROID__]: Use sysinfo() instead of reading
/proc/loadavg.
(LINUX_LDAV_FILE): Remove macro.
Collin Funk [Wed, 19 Mar 2025 04:50:00 +0000 (21:50 -0700)]
futimens: Work around a GNU/Hurd bug.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Check if futimens validates the
tv_nsec values of the timespec argument. Set bits in a return value
instead of exiting early.
* doc/posix-functions/futimens.texi (futimens): Mention the GNU/Hurd
bug. Mention the same bug occurs on NetBSD 10.
Collin Funk [Tue, 18 Mar 2025 04:16:22 +0000 (21:16 -0700)]
utimensat: Work around a GNU/Hurd bug.
* lib/utimensat.c (rpl_utimensat) [__gnu_hurd__]: Check for out of range
tv_nsec values.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise. Guess that utimensat
doesn't work on GNU/Hurd.
* doc/posix-functions/utimensat.texi: Mention the bug.
Collin Funk [Thu, 13 Mar 2025 01:55:26 +0000 (18:55 -0700)]
dup3: Fix behavior for equal file descriptors on Haiku.
* lib/dup3.c (dup3) [__HAIKU__]: Set errno to EINVAL and return -1 if
both file descriptors are equal.
* doc/posix-functions/dup3.texi: Document the Haiku bug.
Bruno Haible [Sun, 9 Mar 2025 09:19:20 +0000 (10:19 +0100)]
getlogin_r: Work around musl bug.
* lib/getlogin_r.c (getlogin_r): Add implementation for Linux.
* m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Test whether getlogin_r has the
musl bug.
* tests/test-getlogin_r.c (main): Add another test.
Bruno Haible [Fri, 21 Feb 2025 10:38:35 +0000 (11:38 +0100)]
host-cpu-c-abi: Improve support for loongarch32.
Reported by <wuruilong@loongson.cn>
in <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098478>
via Simon Josefsson.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Prepare template for
__loongarch32__ in config.h.
(gl_HOST_CPU_C_ABI_32BIT): Speed up the configure test on loongarch*.
Bruno Haible [Wed, 19 Feb 2025 22:46:37 +0000 (23:46 +0100)]
readutmp: Let callers distinguish LOGINs from USERs.
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00123.html>.
* lib/readutmp.h (LOGIN_PROCESS, UT_TYPE_LOGIN_PROCESS): New macros.
* lib/readutmp.c (read_utmp_from_systemd): Possibly use LOGIN_PROCESS
instead of USER_PROCESS, depending on the session's class.
Bruno Haible [Thu, 13 Feb 2025 01:18:05 +0000 (02:18 +0100)]
setlocale: Update info about Galician and Tamil.
* lib/setlocale.c (locales_with_principal_territory): Galician is
mostly spoken in Spain, not Portugal. Tamil is mostly spoken in India,
not Sri Lanka.
Bruno Haible [Mon, 3 Feb 2025 22:55:39 +0000 (23:55 +0100)]
gnulib-tool: Apply libgnu.{,l}a specific CFLAGS to all its object files.
* gnulib-tool.sh (func_emit_initmacro_end): Define
${macro_prefix}_${libname}_{LIBOBJS,LTLIBOBJS,LIBOBJDEPS} macros, that
include libname in the base name of the object files.
(func_emit_lib_Makefile_am): Use ${macro_prefix}_${libname}_*LIBOBJS
values instead of ${macro_prefix}_*LIBOBJS values.
* pygnulib/GLEmiter.py (GLEmiter.initmacro_end): Define
{macro_prefix_arg}_{libname}_{LIBOBJS,LTLIBOBJS,LIBOBJDEPS} macros, that
include libname in the base name of the object files.
(GLEmiter.lib_Makefile_am):Use {macro_prefix}_{libname}_*LIBOBJS
values instead of {macro_prefix}_*LIBOBJS values.
Collin Funk [Sat, 25 Jan 2025 05:36:11 +0000 (21:36 -0800)]
ptsname_r: Work around ptsname_r bug on Solaris 11 OmniOS.
* lib/ptsname_r.c (ptsname_r): Ensure the resulting buffer is not
clobbered if it is too small on Solaris 11 OmniOS.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): On Solaris 11 OmniOS, arrange to
override ptsname_r.
* doc/posix-functions/ptsname_r.texi: Document the bug.
Collin Funk [Sat, 25 Jan 2025 04:38:54 +0000 (20:38 -0800)]
strerrorname_np: Work around a bug on Solaris 11 OmniOS.
* m4/strerrorname_np.m4 (gl_CHECK_STRERRORNAME_NP): Test if
strerrorname_np returns NULL when given ERESTART or ESTRPIPE.
* doc/glibc-functions/strerrorname_np.texi: Document the bug.
Paul Eggert [Sun, 19 Jan 2025 07:02:09 +0000 (23:02 -0800)]
flexmember: port to IBM XL C 16.1
* lib/flexmember.h (FLEXALIGNOF): Use the conservative definition
if _Alignof is a macro, to avoid a C99 conformance issue exposed
by IBM XL C 16.1 which otherwise complains "An aggregate
containing a flexible array member cannot be used as a member of a
structure or as an array element."
Paul Eggert [Sun, 19 Jan 2025 06:06:55 +0000 (22:06 -0800)]
alignasof: port to IBM XL C 16.1
* doc/gnulib.texi (alignof):
Improve doc to match implementation better.
* m4/stdalign.m4 (alignas): Do not define to _Alignas
if __xlC__ claims to conform to C11, because _Alignas fails with
weird diagnostics "Unexpected text %1$s encountered."
* tests/test-alignasof.c (TEST_ALIGNMENT, alignas):
Follow doc advice.
Paul Eggert [Sat, 18 Jan 2025 06:11:54 +0000 (22:11 -0800)]
alignasof: port to IBM XL C V16.1
* m4/stdalign.m4 (gl_ALIGNASOF):
Work around similar bug in IBM XL C V16.1.0 cc (non-clang).
Since this is the last version of this obsolescent compiler,
assume the bug is in earlier versions.
Paul Eggert [Fri, 17 Jan 2025 06:58:55 +0000 (22:58 -0800)]
crc-x86_64: fix unaligned access
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2025-01/msg00142.html
* lib/crc.c (crc32_update_no_xor): Don’t pass unaligned buffer to
crc32_update_no_xor_pclmul. No doubt there is a higher
performance fix, perhaps involving advancing byte-by-byte along
the buffer until we get to an aligned boundary, but at least this
should fix the alignment bug.
Pádraig Brady [Sat, 11 Jan 2025 16:40:33 +0000 (16:40 +0000)]
file-has-acl: handle NFSv4 ACLs with listxattr returning EACCES
* lib/file-has-acl.c (has_xattr): A new helper function to
lookup aclinfo for the xattr or fallback to getxattr() if appropriate.
(get_aclinfo): Use has_xattr() rather than aclinfo_has_xattr().
Discussed at <https://bugs.gnu.org/74692>
Paul Eggert [Fri, 10 Jan 2025 04:37:13 +0000 (20:37 -0800)]
file-has-acl: port to Linux 6.12 + NFS listxattr
* lib/file-has-acl.c (get_aclinfo): Try the getxattr-related calls
even if [l]listxattr fails with EACCES. Problem reported by
Pádraig Brady <https://bugs.gnu.org/74692#25>. Also, treat E2BIG
like EACCES.
Paul Eggert [Wed, 8 Jan 2025 08:32:23 +0000 (00:32 -0800)]
fcntl-h: port better to musl on GNU/Linux
* lib/fcntl.in.h (O_SEARCH): Redefine to O_RDONLY on musl,
which mistakenly defines it to be O_PATH on GNU/Linux.
Problem reported by Lasse Collin in:
https://bugs.gnu.org/75405
Bruno Haible [Mon, 6 Jan 2025 00:16:11 +0000 (01:16 +0100)]
sigsegv tests: Work around a longjmp bug on GNU/Hurd.
* tests/test-sigsegv-catch-stackoverflow1.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Undefine, as a workaround to the Hurd longjmp bug.
* tests/test-sigsegv-catch-stackoverflow2.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Likewise.
* doc/posix-functions/longjmp.texi: Document the Hurd bug.
Paul Eggert [Wed, 1 Jan 2025 07:46:36 +0000 (23:46 -0800)]
maint: update update-copyright for Emacs
* build-aux/update-copyright: Add support for Emacs, which
uses file names like Changelog.1 that are not man pages,
and file names like emacs.1.in that are man page templates.
Bruno Haible [Tue, 31 Dec 2024 18:38:42 +0000 (19:38 +0100)]
getcwd: Return "/bin" instead of "//bin" on Adélie Linux.
Reported by Zach van Rijn <me@zv.io> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-04/msg00072.html>
and <https://git.adelielinux.org/adelie/packages/-/issues/987>.
* lib/getcwd.c (__getcwd_generic): Remove a trailing slash from the
result of readlink().
Bruno Haible [Tue, 31 Dec 2024 00:39:03 +0000 (01:39 +0100)]
mbfile: Allow 2 pushback characters.
* lib/mbfile.h: Include <stdlib.h>.
(MBFILE_MAX_PUSHBACK): New macro.
(struct mbfile_multi): Replace field 'have_pushback' with
'pushback_count'. Make field 'pushback' an array.
(mbfile_multi_getc, mbfile_multi_ungetc): Handle multiple pushback
characters.
(mbf_init): Update.
Bruno Haible [Mon, 30 Dec 2024 14:38:51 +0000 (15:38 +0100)]
doc: Revisit some index entries.
* doc/attribute.texi: Refer to the 'attribute' module.
* doc/verify.texi: Refer to the 'verify' module.
* doc/noreturn.texi: Remove duplicate index entries.
Collin Funk [Sun, 29 Dec 2024 19:30:59 +0000 (11:30 -0800)]
sig2str tests: Add signature check.
* modules/sig2str-tests (Files): Add tests/signature.h.
* tests/test-sig2str.c: Include signal.h instead of sig2str.h. Check the
function signature of sig2str and str2sig.