Bruno Haible [Sun, 9 Feb 2025 05:07:13 +0000 (06:07 +0100)]
intprops tests: Strengthen INT_PROMOTE tests.
* lib/intprops.h (INT_PROMOTE): Refine comment.
* tests/test-intprops.c: Check the size and sign of INT_PROMOTE (x) on
all compilers.
(main): Check that INT_PROMOTE is a no-op on floats.
Collin Funk [Sun, 9 Feb 2025 01:40:48 +0000 (17:40 -0800)]
doc: Document free_aligned_sized and free_sized added in C23.
* doc/posix-functions/free_aligned_sized.texi: New file.
* doc/posix-functions/free_sized.texi: New file.
* doc/gnulib.texi (Functions in <stdlib.h>): Include them.
Paul Eggert [Sat, 8 Feb 2025 22:58:51 +0000 (14:58 -0800)]
memalignment: document
* doc/gnulib-readme.texi (Other portability assumptions):
Mention the C23 function memalignment.
* doc/posix-functions/memalignment.texi: New file.
* doc/gnulib.texi (Functions in <stdlib.h>): Include it.
Paul Eggert [Fri, 7 Feb 2025 22:36:55 +0000 (14:36 -0800)]
intprops: new macro INT_PROMOTE
Something like this was requested for Emacs.
* doc/intprops.texi (Arithmetic Type Conversion): New section.
* lib/intprops.h (INT_PROMOTE): New macro.
* tests/test-intprops.c: Test it.
Bruno Haible [Wed, 5 Feb 2025 20:04:34 +0000 (21:04 +0100)]
xstring-buffer-reversed: New module.
* lib/xstring-buffer-reversed.c: New file, based on
lib/xstring-buffer.c.
* lib/xstring-buffer-reversed-printf.c: New file, based on
lib/xstring-buffer-printf.c.
* modules/xstring-buffer-reversed: New file.
Bruno Haible [Wed, 5 Feb 2025 19:57:16 +0000 (20:57 +0100)]
string-buffer-reversed: New module.
* lib/string-buffer-reversed.h: New file, based on lib/string-buffer.h.
* lib/string-buffer-reversed.c: New file, based on lib/string-buffer.c.
* lib/string-buffer-reversed-printf.c: New file, based on
lib/string-buffer-printf.c.
* modules/string-buffer-reversed: New file.
Bruno Haible [Tue, 4 Feb 2025 11:00:50 +0000 (12:00 +0100)]
gnulib-tool: Fix the result of --create-testdir (regression yesterday).
* gnulib-tool.sh (func_emit_lib_Makefile_am): If $for_test, revert to
the previous code.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): If for_test, revert
to the previous code.
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.
Paul Eggert [Sun, 2 Feb 2025 23:32:15 +0000 (15:32 -0800)]
quotearg: pacify -Wswitch-enum
* lib/quotearg.c (quotearg_buffer_restyled): Use switch (+E), and
omit default case, to pacify gcc -Wswitch-enum. This is a good
way to pacify -Wswitch-enum when we don’t want to enumerate
all the enum values. Omit unnecessary ‘default: break;’s.
Paul Eggert [Sun, 2 Feb 2025 23:27:39 +0000 (15:27 -0800)]
test-gettext-h: check call results
* tests/test-gettext-h.c: Include string.h.
(main): Check return values of calls.
This also pacifies GCC, which otherwise might
warn about a variable being set but not used.
Bruno Haible [Tue, 28 Jan 2025 09:33:34 +0000 (10:33 +0100)]
git-version-gen: Change suffix.
* doc/package-version.texi (Propagating the package version): Drop the
git-version-gen postprocessing line, that does not work on Solaris.
* build-aux/git-version-gen: Likewise. Produce a suffix '-modified'
instead of '-dirty'.
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.
Bruno Haible [Sat, 25 Jan 2025 03:07:32 +0000 (04:07 +0100)]
package-version: Simplify further.
* doc/package-version.texi (Propagating the package version): Recommend
use of gl_INIT_PACKAGE_VERSION instead of gl_INIT_PACKAGE.
* build-aux/git-version-gen: Likewise.
* m4/init-package-version.m4: Likewise.
(gl_INIT_PACKAGE_VERSION): Renamed from gl_INIT_PACKAGE. Take only one
argument. Don't fiddle with AC_PACKAGE_NAME, AC_PACKAGE_TARNAME,
PACKAGE.
(gl_RPL_INIT_AUTOMAKE): Update.
Bruno Haible [Fri, 24 Jan 2025 21:03:29 +0000 (22:03 +0100)]
package-version: Simplify its use.
Reported by Basil L. Contovounesios <basil@contovou.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00195.html>.
* doc/package-version.texi (Propagating the package version): Recommend
to pass the usual arguments to AC_INIT.
* m4/init-package-version.m4: Likewise.
(gl_INIT_PACKAGE): Define PACKAGE_VERSION and PACKAGE_STRING as needed.
(gl_RPL_INIT_AUTOMAKE): Improve quoting.
Bruno Haible [Fri, 24 Jan 2025 17:34:04 +0000 (18:34 +0100)]
sys_socket-h tests: Avoid compilation error on Solaris 11.4.
* doc/posix-headers/sys_socket.texi: Update.
* tests/test-sys_socket-h.c (main): Don't assume that all platforms that
have SOCK_CLOFORK also have MSG_CMSG_CLOFORK.
Bruno Haible [Thu, 23 Jan 2025 20:39:35 +0000 (21:39 +0100)]
bootstrap: Make it work with module 'package-version'.
Reported by Basil L. Contovounesios <basil@contovou.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00195.html>.
* top/bootstrap-funclib.sh (normalize_package_name): New variable.
(extract_package_name): Don't normalize the package name here.
(package): Also look at the first argument of a gl_INIT_PACKAGE
invocation.
* build-aux/bootstrap: Regenerated.
Bruno Haible [Wed, 22 Jan 2025 20:31:52 +0000 (21:31 +0100)]
doc: Document the workflows of the .tarball-version and .version files.
* doc/package-version.texi: New file.
* doc/gnulib.texi (Build Infrastructure Modules): Include it.
* build-aux/git-version-gen: Fix comments: Fix description of
.tarball-version. Recommend to invoke git-version-gen at configure time,
not at autoconf time. Remove description of .version. Rename Makefile
target 'tarball-version' to 'dist-tarball-version'.
* top/GNUmakefile: Improve comments.
Bruno Haible [Sun, 19 Jan 2025 09:40:02 +0000 (10:40 +0100)]
attribute: Add note about ongoing standardization of some attributes.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Add note that the meaning of
_GL_ATTRIBUTE_REPRODUCIBLE and _GL_ATTRIBUTE_UNSEQUENCED are likely to
change.
* lib/attribute.h (UNSEQUENCED, REPRODUCIBLE): Likewise.
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 implementationa 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.
* modules/stdalign, modules/stdalign-h, modules/stdnoreturn:
* modules/stdnoreturn-h: Use more consistent deprecation
warnings, that do not recommend a different deprecated module.
Bruno Haible [Fri, 17 Jan 2025 21:51:55 +0000 (22:51 +0100)]
sys_stat-h: Ensure blksize_t and blkcnt_t are defined.
* tests/test-sys_stat-h.c: Check that blksize_t and blkcnt_t are
defined. Include intprops.h. Check the signedness of various types.
* modules/sys_stat-h-tests (Depends-on): Add intprops.
* doc/posix-headers/sys_stat.texi: Mention the issues with blksize_t and
blkcnt_t.
Bruno Haible [Fri, 17 Jan 2025 21:32:58 +0000 (22:32 +0100)]
sys_types-h: Ensure blksize_t and blkcnt_t are defined.
* lib/sys_types.in.h (blksize_t, blkcnt_t): New definitions.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Set HAVE_BLKSIZE_T and
HAVE_BLKCNT_T.
* modules/sys_types-h (Makefile.am): Substitute HAVE_BLKSIZE_T and
HAVE_BLKCNT_T.
* tests/test-sys_types-h.c: Check that blksize_t and blkcnt_t are
defined. Include intprops.h. Check the signedness of various types.
* modules/sys_types-h-tests (Depends-on): Add assert-h, intprops.
* doc/posix-headers/sys_types.texi: Mention the issues with blksize_t
and blkcnt_t.
Paul Eggert [Fri, 17 Jan 2025 18:39:38 +0000 (10:39 -0800)]
crc-x86_64: port to old GCC compilers
* m4/crc-x86_64.m4 (gl_CRC_X86_64_PCLMUL):
Check that the compiler supports __m128i_u, too,
since we’re using the type now. Issue reported in
the same message from Lasse Collin.
Paul Eggert [Fri, 17 Jan 2025 18:27:55 +0000 (10:27 -0800)]
crc-x86_64: better fix for unaligned access
Avoid undefined behavior in a way that doesn’t require
the input buffer to be aligned.
From a suggestion by Lasse Collin in:
https://lists.gnu.org/r/bug-gnulib/2025-01/msg00148.html
* lib/crc-x86_64-pclmul.c (crc32_update_no_xor_pclmul):
Since the const void * pointer ‘buf’ might not be aligned,
assign it to const __m128i_u * instead of to const __m128i *.
* lib/crc.c (crc32_update_no_xor):
Remove recently-addeda check for buffer alignment.
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.
Paul Eggert [Mon, 13 Jan 2025 18:17:21 +0000 (10:17 -0800)]
fts, savedir: avoid glibc 2.2 readdir ENOENT bug
This is mostly to document the bug.
If these old platforms were still common I suppose we should
change the readdir module to work around it. However, I’m not
sure it’s worth the hassle at this point.
* doc/posix-functions/readdir.texi, doc/posix-functions/readdir_r.texi:
Document the bug.
* lib/fts.c (fts_build):
* lib/savedir.c (streamsavedir):
Work around it.
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>
Bruno Haible [Fri, 10 Jan 2025 22:52:54 +0000 (23:52 +0100)]
sys_un-h: Ensure that <sys/un.h> defines sa_family_t.
* lib/sys_un.in.h: Include <sys/socket.h> or define sa_family_t
explicitly.
* m4/sys_socket_h.m4 (gl_PREREQ_SYS_SA_FAMILY): New macro, extracted
from gl_SYS_SOCKET_H.
(gl_SYS_SOCKET_H): Invoke it.
(gl_SYS_SOCKET_H_DEFAULTS): Don't initialize HAVE_SA_FAMILY_T.
* m4/sys_un_h.m4 (gl_SYS_UN_H): Invoke gl_PREREQ_SYS_SA_FAMILY. Test
whether <sys/un.h> defines sa_family_t. If not, set GL_GENERATE_SYS_UN_H
to true.
* modules/sys_un-h (Makefile.am): Substitute HAVE_SA_FAMILY_T,
HAVE_SA_FAMILY_T_IN_SYS_UN_H.
* tests/test-sys_un-h.c: Include intprops.h. Verify that sa_family_t is
defined and an unsigned integer type.
* modules/sys_un-h-tests (Depends-on): Add intprops.
* doc/posix-headers/sys_un.texi: Mention the problem with sa_family_t.
Paul Eggert [Fri, 10 Jan 2025 18:34:58 +0000 (10:34 -0800)]
doc: document some file system portability issues
* doc/glibc-functions/flistxattr.texi:
* doc/glibc-functions/listxattr.texi:
* doc/glibc-functions/llistxattr.texi:
* doc/posix-functions/fchdir.texi, doc/posix-functions/fstat.texi:
* doc/posix-functions/fstatvfs.texi:
Document some portability gotchas that Gnulib does not work around.
Bruno Haible [Fri, 10 Jan 2025 11:57:01 +0000 (12:57 +0100)]
gitlog-to-changelog: Recommend more reliable Makefile rule idiom.
Reported by Basil L. Contovounesios <basil@contovou.net>.
* doc/gitlog-to-changelog.texi: Make the gen-ChangeLog rule fail if the
ChangeLog file cannot be created or if the disk is full. Drop the use of
an intermediate file, not needed under $(distdir).
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.
Bruno Haible [Wed, 8 Jan 2025 21:24:13 +0000 (22:24 +0100)]
sys_select-h: Update for POSIX:2024.
* lib/sys_select.in.h (rpl_fd_isset): Change type of second parameter to
'const fd_set *'.
* tests/test-sys_select-h.c: Check for some more types and for
FD_SETSIZE.
(FD_ISSET): Expect type of second parameter to be 'const fd_set *'.
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
Paul Eggert [Mon, 6 Jan 2025 04:44:22 +0000 (20:44 -0800)]
parse-datetime-tests: port to Gnulib mktime
Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/bug-gnulib/2025-01/msg00040.html
* tests/test-parse-datetime.c (main): Allow both pedantic and
naive interpretation of "now - 35 years", since the main point of
the test introfuced to fix <https://bugs.gnu.org/48085> was that
parse_datetime shouldn’t fail.
Paul Eggert [Mon, 6 Jan 2025 01:45:41 +0000 (17:45 -0800)]
utimensat: mention Linux kernel bug with CIFS
* doc/posix-functions/utimensat.texi (utimensat):
Mention Linux kernel bug reported by Bruno Haible in:
https://lists.gnu.org/r/bug-tar/2024-12/msg00004.html