]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agosupersede: Support the file name "/dev/null" on native Windows.
Bruno Haible [Sun, 3 Jul 2022 09:58:03 +0000 (11:58 +0200)]
supersede: Support the file name "/dev/null" on native Windows.

* lib/supersede.c (open_supersede): On native Windows, map "/dev/null"
to "NUL".

2 years agomaint.mk: fix syntax-check for unnecessary hash.h header use
Jim Meyering [Thu, 23 Jun 2022 15:12:44 +0000 (08:12 -0700)]
maint.mk: fix syntax-check for unnecessary hash.h header use

* top/maint.mk (_hash_re): Correct the regexp. It had two problems:
- lacked the "hash_" prefix, so would match non-uses
- failed to detect uses of the hash_x?initialize functions
The former led to an excess/unneeded use of hash.h in coreutils' cut.c.
The latter would have led to a FP "not needed" report for copy.c.

2 years agofchmodat: Fix test failure on native Windows.
Bruno Haible [Tue, 21 Jun 2022 23:46:37 +0000 (01:46 +0200)]
fchmodat: Fix test failure on native Windows.

* modules/fchmodat (Depends-on): Add 'chmod'.

2 years agochmod: Add tests.
Bruno Haible [Tue, 21 Jun 2022 23:45:33 +0000 (01:45 +0200)]
chmod: Add tests.

* tests/test-chmod.c: New file, based on tests/test-lchmod.c.
* modules/chmod-tests: New file.

2 years agochmod: New module.
Bruno Haible [Tue, 21 Jun 2022 23:43:52 +0000 (01:43 +0200)]
chmod: New module.

* lib/sys_stat.in.h (chmod): Declare when GNULIB_CHMOD is 1.
* lib/chmod.c: New file, based on lib/lchmod.c.
* m4/chmod.m4: New file, based on m4/fchmodat.m4.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H): Test whether chmod is declared.
(gl_SYS_STAT_H_REQUIRE_DEFAULTS): Initialize GNULIB_CHMOD.
(gl_SYS_STAT_H_DEFAULTS): Initialize REPLACE_CHMOD.
* modules/sys_stat (Makefile.am): Substitute GNULIB_CHMOD,
REPLACE_CHMOD.
* modules/chmod: New file, based on modules/lchmod.
* doc/posix-functions/chmod.texi: Mention the new module and the
problems on IRIX and Windows.

2 years agolchmod: Simplify.
Bruno Haible [Tue, 21 Jun 2022 21:19:07 +0000 (23:19 +0200)]
lchmod: Simplify.

* lib/lchmod.c: Remove unnecessary include, obsolete since 2020-02-23.

2 years agolchmod: port back to AIX 7.2
Paul Eggert [Mon, 20 Jun 2022 04:30:01 +0000 (23:30 -0500)]
lchmod: port back to AIX 7.2

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00075.html
* lib/lchmod.c: Include string.h, for strlen.
(lchmod): Do not depend on HAVE_READLINK since we now depend on
the readlink module.  Check for AIX 7.2 bug.
* m4/lchmod.m4 (gl_PREREQ_LCHMOD): Do not check for readlink
since we now depend on the readlink module.
* modules/lchmod (Depends-on): Depend on readlink.

2 years agofchmodat: pacify gcc -Wunused-variable
Paul Eggert [Mon, 20 Jun 2022 04:29:07 +0000 (23:29 -0500)]
fchmodat: pacify gcc -Wunused-variable

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00075.html
* lib/fchmodat.c (fchmodat): Remove unused local.

2 years agogetlogin, getlogin_r tests: Really avoid test failure.
Bruno Haible [Sun, 19 Jun 2022 14:14:19 +0000 (16:14 +0200)]
getlogin, getlogin_r tests: Really avoid test failure.

Reported by Letu Ren <fantasquex@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-06/msg00037.html>.

* tests/test-getlogin.h (test_getlogin_result): Parse the contents of
/proc/self/loginuid as an unsigned integer.

2 years agofchmodat: port better to MS-Windows etc.
Paul Eggert [Sun, 12 Jun 2022 20:46:52 +0000 (13:46 -0700)]
fchmodat: port better to MS-Windows etc.

MS-Windows problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00041.html
Although I don’t use MS-Windows I see some related fstatat etc.
problems and am trying to fix them with this further patch.
* lib/fchmodat.c (fchmodat):
* lib/lchmod.c (lchmod):
* lib/lchown.c (lchown)
[!HAVE_LCHOWN && HAVE_CHOWN && !CHOWN_MODIFIES_SYMLINK]:
* lib/renameatu.c (renameatu)
[HAVE_RENAME && RENAME_TRAILING_SLASH_SOURCE_BUG]:
Use readlinkat/readlink instead of fstatat/lstat to test merely
whether a string names a symlink, as this avoids problems
with EOVERFLOW.  Also, I hope it works around the MS-Windows
issues that Bruno noted.
* m4/fchmodat.m4 (gl_PREREQ_FCHMODAT):
Check for readlinkat, not lchmod.
* m4/lchmod.m4 (gl_FUNC_LCHMOD): Do not require AC_CANONICAL_HOST
or check for lstat.
(gl_PREREQ_LCHMOD): Check for readlink.
* modules/lchown (Depends-on): Add readlink.  Do not depend on
lstat merely because !HAVE_LCHOWN.
* modules/renameatu (Depends-on): Add fstatat, readlinkat.

2 years agofchmodat: port to old Linux kernel + newer headers
Paul Eggert [Sat, 11 Jun 2022 23:58:25 +0000 (16:58 -0700)]
fchmodat: port to old Linux kernel + newer headers

Problem reported by Lance Fredrickson in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00038.html
* lib/fchmodat.c (fchmodat):
* lib/lchmod.c (lchmod): Do not rely on AT_EMPTY_PATH as to
whether syscalls work on ""; instead, if a call fails with
ENOENT assume that those syscalls do not work.
Do not use fstatat to determine whether a file is a symlink,
as this has problems with EOVERFLOW.  Use readlinkat instead,
and if it fails with EINVAL then the file is not a symlink.
Remove #if tests on __linux__ || __ANDROID__ || __CYGWIN__
as this has been a maintenance hassle and it’s unlikely
these days that a new platform would #define O_PATH without also
either supporting /proc or keeping it absent.
* modules/fchmodat (Depends-on): Remove fstatat.
There should be no need for either fchmodat or lchmod to depend on
readlinkat, since they use readlinkat only in contexts where it
should work without Gnulib intervention.

2 years agofopen-gnu: Make this module work again (regression 2022-01-03).
Bruno Haible [Mon, 6 Jun 2022 14:34:48 +0000 (16:34 +0200)]
fopen-gnu: Make this module work again (regression 2022-01-03).

Reported by Nelson H. F. Beebe <beebe@math.utah.edu> in
<https://lists.gnu.org/archive/html/platform-testers/2022-04/msg00005.html>.

* modules/fopen-gnu (configure.ac): Invoke gl_STDIO_MODULE_INDICATOR.

2 years agogetlogin, getlogin_r tests: Avoid test failure in specific environments.
Bruno Haible [Mon, 6 Jun 2022 09:55:04 +0000 (11:55 +0200)]
getlogin, getlogin_r tests: Avoid test failure in specific environments.

Reported by Letu Ren <fantasquex@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-06/msg00001.html>.

* modules/getlogin-tests (Depends-on): Add stdbool.
* modules/getlogin_r-tests (Depends-on): Likewise.
* tests/test-getlogin.h: Include stdbool.h.
(test_getlogin_result): On Linux, skip the test if /proc/self/loginuid
contains "-1".

2 years agoautoupdate
Karl Berry [Thu, 26 May 2022 14:24:56 +0000 (07:24 -0700)]
autoupdate

2 years agoautoupdate
Karl Berry [Wed, 25 May 2022 14:54:30 +0000 (07:54 -0700)]
autoupdate

2 years agostrstr-simple: pacify GCC 12.1
Paul Eggert [Sat, 21 May 2022 20:38:29 +0000 (13:38 -0700)]
strstr-simple: pacify GCC 12.1

* lib/str-two-way.h (two_way_long_needle): Pacify GCC 12.1
-Wsuggest-attribute=pure (x86-64, -O2).

2 years agoautoupdate
Karl Berry [Fri, 20 May 2022 14:55:14 +0000 (07:55 -0700)]
autoupdate

2 years agostring, wchar: Fix compilation error on MSVC (regression 2021-09-07).
Bruno Haible [Sun, 15 May 2022 11:25:46 +0000 (13:25 +0200)]
string, wchar: Fix compilation error on MSVC (regression 2021-09-07).

* lib/string.in.h (free): For MSVC, add the dllimport specification if
the MSVC headers have it.
* lib/wchar.in.h (free): Likewise.

2 years agoglob tests: Fix a warning (regression from 2022-03-23).
Bruno Haible [Sat, 14 May 2022 20:34:12 +0000 (22:34 +0200)]
glob tests: Fix a warning (regression from 2022-03-23).

* tests/test-glob.c: Include <fcntl.h>.
* modules/glob-tests (Depends-on): Add fcntl-h.

2 years agodfa: fix bug with ‘.’ and UTF-8 Hangul Syllables
Paul Eggert [Sat, 14 May 2022 06:23:35 +0000 (23:23 -0700)]
dfa: fix bug with ‘.’ and UTF-8 Hangul Syllables

This fixes a bug introduced in 2019-12-18T05:41:27Z!eggert@cs.ucla.edu,
an earlier patch that fixed dfa.c to not match invalid UTF-8.
Unfortunately that patch had a couple of typos when dfa.c is
matching against the regular expression ‘.’ (dot).  One typo
caused dfa.c to incorrectly reject the valid UTF-8 sequences
(ED)(90-9F)(80-BF) corresponding to U+D400 through U+D7FF, which
are some Hangul Syllables and Hangul Jamo Extended-B.  The other
typo caused dfa.c to incorrectly reject the valid sequences
(F4)(88-8F)(80-BF)(80-BF) which correspond to U+108000 through
U+10FFFF (Supplemental Private Use Area plane B).
* lib/dfa.c (utf8_classes): Fix typos.
* tests/test-dfa-match.sh: Test the fix.

2 years agomanywarnings: update C warnings for GCC 12
Paul Eggert [Thu, 12 May 2022 22:13:04 +0000 (15:13 -0700)]
manywarnings: update C warnings for GCC 12

Adjust for C programs compiled by GCC 12.
(A C++ expert still needs to look at manywarnings-c++.m4.)
* build-aux/gcc-warning.spec: Add warnings introduced in GCC 12.
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add -Wbidi-chars=any,ucn
and -Wuse-after-free=3.  Although not enabled by -Wall or -Wextra
they seem suitable for Gnulib-using C code.

2 years agoautoupdate
Karl Berry [Mon, 9 May 2022 15:33:17 +0000 (08:33 -0700)]
autoupdate

2 years agolibc-config: update to match cdefs
Paul Eggert [Thu, 5 May 2022 21:37:21 +0000 (14:37 -0700)]
libc-config: update to match cdefs

* lib/libc-config.h (__attribute_alloc_align__)
(__attribute_maybe_unused, __fortified_attr_access)
(__glibc_fortify, __glibc_fortify_n, __glibc_likely)
(__glibc_safe_len_cond, __glibc_safe_or_unknown_len)
(__glibc_unsafe_len, __glibc_unsigned_or_positive, __wur):
Undef these too, since lib/cdefs.h now defines them
unconditionally.

2 years agocdefs: merge from glibc
Paul Eggert [Thu, 5 May 2022 21:34:23 +0000 (14:34 -0700)]
cdefs: merge from glibc

* lib/cdefs.h (__glibc_safe_or_unknown_len):
Use glibc’s newer version.

2 years agoaf_alg: port to Ubuntu 22.04
Paul Eggert [Mon, 2 May 2022 16:01:08 +0000 (09:01 -0700)]
af_alg: port to Ubuntu 22.04

Without this patch, maintainer builds of coreutils fail on Ubuntu
22.04 with diagnostics like "./lib/gl_openssl.h:79:1: error:
'MD5_Init' is deprecated: Since OpenSSL 3.0
[-Werror=deprecated-declarations]".  From
<https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes>
it appears that Gnulib needs to either define OPENSSL_API_COMPAT
to a version less than 3.0, or use a compatibility layer, or
assume OpenSSL 1.1.0 or later.  The simplest workaround is to
define OPENSSL_API_COMPAT for 1.1.1, the oldest OpenSSL release
still supported.  A better fix would be to rewrite the code to
assume OpenSSL 1.1.1 or later, and stop using the older API.
* lib/md5.h, lib/sha1.h, lib/sha256.h, lib/sha512.h, lib/sm3.h:
Define OPENSSL_API_COMPAT to 0x10101000L to suppress
the deprecation warnings on Ubuntu 22.04.

2 years agostring: Avoid syntax error on glibc systems with GCC 11.
Bruno Haible [Sat, 30 Apr 2022 12:09:00 +0000 (14:09 +0200)]
string: Avoid syntax error on glibc systems with GCC 11.

Reported by Tom Tromey <tromey@adacore.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00075.html>
and by Satadru Pramanik <satadru@umich.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00076.html>.

* lib/string.in.h (strndup): Don't rededeclare strndup if it is defined
as a macro.

2 years agostdlib: Fix error in C++ mode on glibc systems (regr. 2022-04-13).
Simon Marchi [Thu, 28 Apr 2022 23:47:55 +0000 (01:47 +0200)]
stdlib: Fix error in C++ mode on glibc systems (regr. 2022-04-13).

* lib/stdlib.in.h (free): Add exception specification like glibc does.

2 years agoglob: improve config and test cleanup
Paul Eggert [Thu, 28 Apr 2022 21:40:48 +0000 (14:40 -0700)]
glob: improve config and test cleanup

Config problem reported by Benno Schulenberg in:
https://lists.gnu.org/r/bug-gnulib/2022-04/msg00071.html
* m4/glob.m4 (gl_GLOB): Clean up temporary file.
Also, name it conf$$-file not conf-file, so it’s cleaned
up on interrupt.
* modules/glob-tests (MOSTLYCLEANFILES):
Append test-glob.tglobfile, test-glob.tgloblink[123].

2 years agoFix ChangeLog typo
Paul Eggert [Tue, 26 Apr 2022 22:00:24 +0000 (15:00 -0700)]
Fix ChangeLog typo

2 years agoglob: port to NetBSD 9.2
Paul Eggert [Tue, 26 Apr 2022 21:54:26 +0000 (14:54 -0700)]
glob: port to NetBSD 9.2

Problem reported by Benno Schulenberg in:
https://lists.gnu.org/r/bug-gnulib/2022-04/msg00052.html
* doc/posix-functions/dirfd.texi: Document NetBSD 9.2 portability
bugs.  Remove an old common about errno that is no longer true
of POSIX 2018.
* lib/glob.c (glob_in_dir): Convert dirfd arg from void *
to DIR * before passing it to dirfd.

2 years agobackupfile: fix bug when renaming simple backups
Paul Eggert [Thu, 21 Apr 2022 02:34:57 +0000 (19:34 -0700)]
backupfile: fix bug when renaming simple backups

* lib/backupfile.c (backupfile_internal): Fix bug when RENAME
and when doing simple backups.  Problem reported by Steve Ward in:
https://bugs.gnu.org/55029

2 years agoautoupdate
Karl Berry [Tue, 19 Apr 2022 14:48:24 +0000 (07:48 -0700)]
autoupdate

2 years agoverify: port to Mac OS 10.7.5
Paul Eggert [Sun, 17 Apr 2022 02:18:03 +0000 (19:18 -0700)]
verify: port to Mac OS 10.7.5

Mac OS 10.7.5 clang sets __clang_major__ to 4 even though it was
derived from Clang 3.2.  Problem reported by Werner Lemberg in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg00779.html
* lib/verify.h (_GL_HAVE__STATIC_ASSERT): Don’t define to 1
when __clang_major__ == 4 && !__cplusplus
&& __STDC_VERSION__ < 201112L && !defined __STRICT_ANSI__.

2 years agosigsegv: Fix compilation error on arceb CPUs.
Bruno Haible [Sat, 16 Apr 2022 01:01:51 +0000 (03:01 +0200)]
sigsegv: Fix compilation error on arceb CPUs.

Reported by Fabrice Fontaine <fontaine.fabrice@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00028.html>.

* m4/stack-direction.m4 (SV_STACK_DIRECTION): Treat the 'arc' variants
like 'arc'.

2 years agostring, wchar: Fix error in C++ mode on glibc systems with clang.
Bruno Haible [Wed, 13 Apr 2022 22:52:26 +0000 (00:52 +0200)]
string, wchar: Fix error in C++ mode on glibc systems with clang.

* lib/string.in.h (free): Add exception specification like glibc does.
* lib/wchar.in.h (free): Likewise.

2 years agostring: Fix errors in C++ mode on glibc systems with clang.
Bruno Haible [Wed, 13 Apr 2022 22:29:04 +0000 (00:29 +0200)]
string: Fix errors in C++ mode on glibc systems with clang.

* lib/string.in.h (memchr, memrchr, rawmemchr, strchrnul, strpbrk,
strstr, strcasestr): Use _GL_CXXALIASWARN1 also with clang, and add
exception specification.

2 years agomath: Fix errors in C++ mode on glibc systems with clang.
Bruno Haible [Wed, 13 Apr 2022 21:43:05 +0000 (23:43 +0200)]
math: Fix errors in C++ mode on glibc systems with clang.

* lib/math.in.h (GNULIB_NAMESPACE_LACKS_ISFINITE,
GNULIB_NAMESPACE_LACKS_ISINF, GNULIB_NAMESPACE_LACKS_ISNAN,
GNULIB_NAMESPACE_LACKS_SIGNBIT): New macros.
* tests/test-math-c++.cc (isfinite): Skip test if
GNULIB_NAMESPACE_LACKS_ISFINITE is 1.
(isinf): Skip test if GNULIB_NAMESPACE_LACKS_ISINF is 1.
(isnan): Skip test if GNULIB_NAMESPACE_LACKS_ISNAN is 1.
(signbit): Skip test if GNULIB_NAMESPACE_LACKS_SIGNBIT is 1.

2 years agolibgmp: pacify Clang too
Paul Eggert [Fri, 8 Apr 2022 23:45:11 +0000 (16:45 -0700)]
libgmp: pacify Clang too

* lib/mini-gmp-gnulib.c [NDEBUG]: Also use -Wunused-variable if clang.
Problem reported for Emacs by Mattias Engdegård.

2 years agoglob: test for glibc bug 25659
Paul Eggert [Wed, 23 Mar 2022 17:22:51 +0000 (10:22 -0700)]
glob: test for glibc bug 25659

https://sourceware.org/bugzilla/show_bug.cgi?id=25659
* m4/glob.m4 (gl_GLOB): Replace glob if it has bug 25659.
* tests/test-glob.c (main): Test for glibc bug 25659.

2 years agoglob: fix symlink and // issues; improve speed
Paul Eggert [Wed, 23 Mar 2022 16:52:58 +0000 (09:52 -0700)]
glob: fix symlink and // issues; improve speed

* lib/glob.c: Include fcntl.h.
(dirfd) [_LIBC]: New macro.
(GLOB_STAT64, GLOB_LSTAT64): Remove.  Replace all uses with ...
(GLOB_FSTATAT64): ... this new macro.
(glob_in_dir): Treat DT_LNK like DT_UNKNOWN.
Use directory-relative fstatat unless GLOB_ALTDIRFUNC, or dirfd fails.
Avoid duplicate strlen (directory).
Work even if directory is "/", without turning it into "//".
Use a scratch buffer instead of by-hand alloca stuff.
Use mempcpy and memcpy instead of stpcpy and strcpy.
* modules/glob (Depends-on): Add dirfd, fstatat.  Remove stat.
(License): Change from LGPLv2+ to GPL, since it depends on
fstatat.

2 years agoglob: resolve DT_UNKNOWN via is_dir
DJ Delorie [Wed, 23 Mar 2022 16:39:37 +0000 (09:39 -0700)]
glob: resolve DT_UNKNOWN via is_dir

The DT_* values returned by getdents (readdir) are only hints and
not required.  In fact, some Linux filesystems return DT_UNKNOWN
for most entries, regardless of actual type.  This causes make
to mis-match patterns with a trailing slash (via GLOB_ONLYDIR)
(see make's functions/wildcard test case).  Thus, this patch
detects that case and uses is_dir() to make the type known enough
for proper operation.

Performance in non-DT_UNKNOWN cases is not affected.

The lack of DT_* is a well known issue on older XFS installations
(for example, RHEL 7 and 8, Fedora 28) but can be recreated by
creating an XFS filesystem with flags that mimic older behavior:

$ fallocate -l 10G /xfs.fs
$ mkfs.xfs -n ftype=0 -m crc=0 -f /xfs.fs
$ mkdir /xfs
$ mount -o loop /xfs.fs /xfs

2 years agoautoupdate
Karl Berry [Sun, 20 Mar 2022 15:39:33 +0000 (08:39 -0700)]
autoupdate

2 years agoNEWS: Document Automake 1.14 requirement here too.
Ben Pfaff [Sun, 13 Mar 2022 19:16:40 +0000 (12:16 -0700)]
NEWS: Document Automake 1.14 requirement here too.

It had been documented there before for the Automake 1.11 requirement.
* NEWS: Mention the change.

2 years agosigsegv: Add support for Linux/PowerPC (32-bit) with musl libc.
Bruno Haible [Sun, 13 Mar 2022 14:12:46 +0000 (15:12 +0100)]
sigsegv: Add support for Linux/PowerPC (32-bit) with musl libc.

Reported by Khem Raj <raj.khem@gmail.com> in
<https://lists.gnu.org/archive/html/m4-patches/2022-03/msg00000.html>.

* src/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): In the Linux/PowerPC
32-bit case, handle musl libc differently.
* modules/sigsegv (Files): Add m4/musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.

2 years agoregex: fix double-free
Paul Eggert [Sat, 12 Mar 2022 01:23:53 +0000 (17:23 -0800)]
regex: fix double-free

* lib/regex_internal.c (re_dfa_add_node): Don’t free storage
twice if an allocation fails.

2 years agoregex: fix minor over-allocation
Paul Eggert [Fri, 11 Mar 2022 21:34:07 +0000 (13:34 -0800)]
regex: fix minor over-allocation

* lib/regexec.c (push_fail_stack): Fix off-by-one error that
over-allocated the stack.

2 years agoregex: fix free_fail_stack undefined behavior
Paul Eggert [Fri, 11 Mar 2022 21:27:33 +0000 (13:27 -0800)]
regex: fix free_fail_stack undefined behavior

* lib/regexec.c (push_fail_stack): Don’t increment number of
re_fail_stack_t entries until after successful allocation.  This
prevents a crash if re_realloc or re_malloc fails here, and a
later free_fail_stack examines regs or a later pop_fail_stack
examines node.  Problem discovered by Coverity scan sent
2022-03-11 11:03:52Z.

2 years agoCreate lib/Makefile.am after gnulib-comp.m4
Paul Eggert [Tue, 1 Mar 2022 18:01:22 +0000 (10:01 -0800)]
Create lib/Makefile.am after gnulib-comp.m4

* gnulib-tool (func_import): Create library makefile after
creating gnulib-comp.m4.  With --gnu-make, the latter depends on
the former.  See <https://bugs.gnu.org/32452#109>.

2 years agogettime-res: fix unlikely overflow bug
Paul Eggert [Sat, 26 Feb 2022 21:13:09 +0000 (13:13 -0800)]
gettime-res: fix unlikely overflow bug

* lib/gettime-res.c (gettime_res): Fix bug when hz * tv_sec overflows.
With 64-bit ‘long’ and nanosecond resolution the bug can occur
starting in the year 2262, with probability about 2e-9.
With 32-bit ‘long’ the bug can occur now, with same probability.
The probability goes up on hosts with worse timestamp resolution.

2 years ago* doc/gnulib-readme.texi: Typo fix.
Paul Eggert [Sat, 26 Feb 2022 19:33:36 +0000 (11:33 -0800)]
* doc/gnulib-readme.texi: Typo fix.

2 years agomodules/unicase/special-casing: Fix compilation error
Darshit Shah [Fri, 25 Feb 2022 23:36:25 +0000 (15:36 -0800)]
modules/unicase/special-casing: Fix compilation error

* modules/unicase/special-casing: Don't prepend $(AM_V_at) to the
second part of a compound command.  It causes make to try and
execute the command "@sed" which doesn't exist.

2 years agoPort __has_attribute to Apple’s Clang renumbering
Paul Eggert [Fri, 25 Feb 2022 23:30:42 +0000 (15:30 -0800)]
Port __has_attribute to Apple’s Clang renumbering

Problem reported by Kirill A. Korinsky in:
https://lists.gnu.org/r/bug-gnulib/2022-02/msg00034.html
* config/srclist.txt: Comment out sys/cdefs.h for now.
* lib/cdefs.h (__glibc_has_attribute):
* m4/gnulib-common.m4 (gl_COMMON_BODY):
Port to Apple’s renumbering of Clang versions.

2 years agodoc: add two missing closing parentheses
Benno Schulenberg [Tue, 22 Feb 2022 10:53:35 +0000 (11:53 +0100)]
doc: add two missing closing parentheses

* doc/regex.texi (Syntax Bits): Add missing closing parenthesis.
* doc/regex.texi (BSD Regular Expression Compiling): Likewise.

2 years agognulib-tool: Bump automake dependency.
Simon Josefsson [Tue, 22 Feb 2022 11:47:14 +0000 (12:47 +0100)]
gnulib-tool: Bump automake dependency.

* gnulib-tool (func_emit_lib_Makefile_am)
(func_emit_tests_Makefile_am): Demand Automake ≥ 1.14, for
%reldir%.

2 years agoDocument that Automake ≥ 1.14 is needed (regression 2021-12-15).
Bruno Haible [Sun, 20 Feb 2022 20:04:57 +0000 (21:04 +0100)]
Document that Automake ≥ 1.14 is needed (regression 2021-12-15).

Reported by Simon Josefsson and Mike Frysinger in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-02/msg00010.html>.

* DEPENDENCIES (Automake): Require version 1.14 or newer.

2 years agostring: Fix "mismatched allocation function" warnings regarding strndup.
Bruno Haible [Thu, 10 Feb 2022 01:44:14 +0000 (02:44 +0100)]
string: Fix "mismatched allocation function" warnings regarding strndup.

* lib/string.in.h (strndup): Mark with _GL_ATTRIBUTE_MALLOC and
_GL_ATTRIBUTE_DEALLOC_FREE. For GCC >= 11: Declare also when the
platform already declares the function or when the module 'strndup' is
not in use.

2 years agounictype/category-byname: Fix test failure.
Bruno Haible [Wed, 9 Feb 2022 22:38:59 +0000 (23:38 +0100)]
unictype/category-byname: Fix test failure.

* modules/unictype/category-byname (configure.ac): Bump required
libunistring version.

2 years agoautoupdate
Karl Berry [Wed, 9 Feb 2022 22:01:03 +0000 (14:01 -0800)]
autoupdate

2 years agomaint: restore ChangeLog entries dropped in 2004
Paul Eggert [Mon, 7 Feb 2022 02:38:32 +0000 (18:38 -0800)]
maint: restore ChangeLog entries dropped in 2004

These entries were dropped by mistake in
2004-10-15T22:57:10Z!simon@josefsson.org
which looks like a merge commit of some sort.
I found the mistake by noticing the misspelling "xstrto".

2 years agoparse-datetime: allow calculations to yield -1
Paul Eggert [Sat, 5 Feb 2022 19:05:44 +0000 (11:05 -0800)]
parse-datetime: allow calculations to yield -1

Problem reported by Jeremy Cantrell <https://bugs.gnu.org/50115>.
* lib/parse-datetime.y (parse_datetime_body): When calling mktime,
use an unmodifed and negative tm_wday or tm_yday to detect an error,
as a (time_t) -1 return value is valid on most hosts.
* tests/test-parse-datetime.c (main): Add a test for the bug.

2 years agomaint: fix up stale XARGCASEMATCH comment
Pádraig Brady [Sun, 30 Jan 2022 12:14:24 +0000 (12:14 +0000)]
maint: fix up stale XARGCASEMATCH comment

* lib/argmatch.c: Remove reference to no longer available macro.

2 years agomaintainer-makefile: fix sc_error_message_uppercase false failure
Pádraig Brady [Fri, 28 Jan 2022 14:54:00 +0000 (14:54 +0000)]
maintainer-makefile: fix sc_error_message_uppercase false failure

* top/maint.mk (sc_error_message_uppercase): Don't trigger for
any of the PRI... defines.  Note we add an extra constraint
here that PRI always follows a double quote, but that's
almost always the case, or can be easily made so by prepending
"" for example.

2 years agomaint: Update copyright notices
Paul Eggert [Thu, 27 Jan 2022 18:57:02 +0000 (10:57 -0800)]
maint: Update copyright notices

* build-aux/announce-gen, build-aux/declared.sh:
* build-aux/git-version-gen, build-aux/gitlog-to-changelog:
* build-aux/gnu-web-doc-update, build-aux/gnupload:
* build-aux/increment-serial, build-aux/libtool-next-version:
* build-aux/useless-if-before-free:
Update some copyright notices by hand, that were not
updated automatically.

2 years agocalloc-gnu: fix misspelling in 2022-01-03 patch
Paul Eggert [Thu, 27 Jan 2022 07:00:41 +0000 (23:00 -0800)]
calloc-gnu: fix misspelling in 2022-01-03 patch

Problem reported by Thien-Thi Nguyen in:
https://lists.gnu.org/r/bug-gnulib/2022-01/msg00170.html
* modules/calloc-gnu (Depends-on):
* modules/calloc-posix (Depends-on):
Fix misspelling of REPLACE_CALLOC_FOR_CALLOC_POSIX.

2 years agoxstrtoimax, xstrtoumax: depend on inttypes-incomplete
Paul Eggert [Mon, 24 Jan 2022 05:07:39 +0000 (21:07 -0800)]
xstrtoimax, xstrtoumax: depend on inttypes-incomplete

This fixes a call to strtoimax without declaring it,
and similarly for strtoumax.
* lib/xstrtoimax.c, lib/xstrtoumax.c (XSTRTOL_INCLUDE_INTTYPES_H):
Define, so that strtoimax and strtoumax are declared.
* lib/xstrtol.c [XSTRTOL_INCLUDE_INTTYPES_H]: Include inttypes.h.
* modules/xstrtoimax, modules/xstrtoumax (Depends-on):
Add inttypes-incomplete.

2 years agoautoupdate
Karl Berry [Wed, 19 Jan 2022 19:00:03 +0000 (11:00 -0800)]
autoupdate

2 years agolog tests: Avoid test failure with nvc 22.1.
Bruno Haible [Sat, 15 Jan 2022 22:39:23 +0000 (23:39 +0100)]
log tests: Avoid test failure with nvc 22.1.

* tests/test-log.h (test_function): With nvc, expect up to 4 ulps error.

2 years agohavelib: Recognize ELF platform despite nvc 22.1.
Bruno Haible [Sat, 15 Jan 2022 22:08:47 +0000 (23:08 +0100)]
havelib: Recognize ELF platform despite nvc 22.1.

* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Recognize Linux as an ELF
platform, even with a compiler that does not define __ELF__.

2 years agooset-c++: Avoid compilation error with nvc++ 22.1.
Bruno Haible [Sat, 15 Jan 2022 18:52:28 +0000 (19:52 +0100)]
oset-c++: Avoid compilation error with nvc++ 22.1.

* lib/gl_oset.hh: With EDG C++ compilers, avoid 'friend'.

2 years agointprops: work around nvc 22.1 bug
Paul Eggert [Sat, 15 Jan 2022 02:50:48 +0000 (18:50 -0800)]
intprops: work around nvc 22.1 bug

Problem reported by Olivier Cessenat (Bug#53256).
* lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW) [__EDG__]:
Define to 0, since __builtin_add_overflow doesn’t work
on NVIDIA HPC SDK 22.1.

2 years agocopy-file-range: work around Linux kernel bug
Paul Eggert [Sat, 15 Jan 2022 01:27:51 +0000 (17:27 -0800)]
copy-file-range: work around Linux kernel bug

This workaround is adapted from Coreutils.
* lib/copy-file-range.c [__linux__ && HAVE_COPY_FILE_RANGE]:
Include <sys/utsname.h>.
(copy_file_range): Use a stub to replace the copy_file_range of
Linux kernel versions 4.5 through 5.2.
* lib/unistd.in.h (copy_file_range):
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS):
* modules/copy-file-range (configure.ac):
* modules/unistd (unistd.h):
Support replacement of copy_file_range.
* m4/copy-file-range.m4 (gl_FUNC_COPY_FILE_RANGE):
Define HAVE_COPY_FILE_RANGE if the system has copy_file_range,
and on Linux check whether the system’s is known to work.

2 years agoautoupdate
Karl Berry [Thu, 13 Jan 2022 17:12:18 +0000 (09:12 -0800)]
autoupdate

2 years agoAvoid warning "_GL_ATTRIBUTE_DEALLOC_FREE redefined" (regr. 2022-01-04).
Bruno Haible [Thu, 13 Jan 2022 15:23:21 +0000 (16:23 +0100)]
Avoid warning "_GL_ATTRIBUTE_DEALLOC_FREE redefined" (regr. 2022-01-04).

Reported by Werner Lemberg <wl@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-01/msg00094.html>.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Avoid redefining
_GL_ATTRIBUTE_DEALLOC_FREE.

2 years agobackupfile: fix bug when renaming not from wd
Paul Eggert [Mon, 10 Jan 2022 18:34:09 +0000 (10:34 -0800)]
backupfile: fix bug when renaming not from wd

* lib/backupfile.c (backupfile_internal): Fix bug when DIR_FD
does not specify the working directory, and when RENAME.
Without the bug fix, FILE is treated as relative to the working
directory, not relative to DIR_FD, when renaming FILE.
This bug was introduced when DIR_FD and RENAME were introduced,
in 2018-10-24T02:10:21Z!eggert@cs.ucla.edu.
While we’re at it, when SDIR is nonnegative improve performance a
bit by passing an SDIR-relative old name to renameatu.

2 years agoautoupdate
Karl Berry [Mon, 10 Jan 2022 14:43:19 +0000 (06:43 -0800)]
autoupdate

2 years agohost-cpu-c-abi: Add support for LoongArch64 CPU.
Bruno Haible [Sun, 9 Jan 2022 23:24:33 +0000 (00:24 +0100)]
host-cpu-c-abi: Add support for LoongArch64 CPU.

* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Define __loongarch64__. (GCC
and clang predefine only __loongarch__, __loongarch64.)

2 years agognulib-tool: Fix "Don't forget" messages (regression 2021-12-12).
Bruno Haible [Sat, 8 Jan 2022 22:28:29 +0000 (23:28 +0100)]
gnulib-tool: Fix "Don't forget" messages (regression 2021-12-12).

* gnulib-tool (func_import): Fix variable references in "Don't forget"
messages.

2 years agosigsegv: Improve support for Linux/LoongArch64.
Bruno Haible [Fri, 7 Jan 2022 18:11:25 +0000 (19:11 +0100)]
sigsegv: Improve support for Linux/LoongArch64.

* lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): Add special case for
Linux/LoongArch.

2 years agostring, wchar: Fix compilation error on MSVC (regression 2021-09-07).
Bruno Haible [Tue, 4 Jan 2022 12:20:55 +0000 (13:20 +0100)]
string, wchar: Fix compilation error on MSVC (regression 2021-09-07).

* lib/string.in.h (free): Don't redeclare as rpl_free. Instead, redefine
_GL_ATTRIBUTE_DEALLOC_FREE to reference rpl_free directly.
* lib/wchar.in.h (free): Likewise.

2 years agogetpass-gnu: Allow use as dependency from test modules.
Bruno Haible [Mon, 3 Jan 2022 15:34:39 +0000 (16:34 +0100)]
getpass-gnu: Allow use as dependency from test modules.

* m4/getpass.m4 (gl_FUNC_GETPASS_GNU): Set
REPLACE_GETPASS_FOR_GETPASS_GNU instead of REPLACE_GETPASS.
* m4/unistd_h.m4 (gl_UNISTD_H_REQUIRE_DEFAULTS): Initialize the
getpass-gnu module indicator.
(gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETPASS_FOR_GETPASS_GNU.
* modules/unistd (Makefile.am): Substitute GNULIB_GETPASS_GNU,
REPLACE_GETPASS_FOR_GETPASS_GNU.
* modules/getpass-gnu (configure.ac): Test
REPLACE_GETPASS_FOR_GETPASS_GNU instead of REPLACE_GETPASS. Set a module
indicator.
* lib/unistd.in.h (getpass): Test REPLACE_GETPASS,
REPLACE_GETPASS_FOR_GETPASS_GNU, and the respective module indicators
instead of just REPLACE_GETPASS.

2 years agofopen-gnu: Allow use as dependency from test modules.
Bruno Haible [Mon, 3 Jan 2022 15:17:18 +0000 (16:17 +0100)]
fopen-gnu: Allow use as dependency from test modules.

* m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Set REPLACE_FOPEN_FOR_FOPEN_GNU
instead of REPLACE_FOPEN.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize the fopen-gnu
module indicator.
(gl_STDIO_H_DEFAULTS): Initialize REPLACE_FOPEN_FOR_FOPEN_GNU.
* modules/stdio (Makefile.am): Substitute GNULIB_FOPEN_GNU,
REPLACE_FOPEN_FOR_FOPEN_GNU.
* modules/fopen-gnu (Depends-on): Add more dependencies.
(configure.ac): Test REPLACE_FOPEN_FOR_FOPEN_GNU instead of
REPLACE_FOPEN.
* lib/stdio.in.h (fopen): Test REPLACE_FOPEN,
REPLACE_FOPEN_FOR_FOPEN_GNU, and the respective module indicators
instead of just REPLACE_FOPEN.

2 years agorealloc-gnu: Allow use as dependency from test modules.
Bruno Haible [Mon, 3 Jan 2022 14:31:53 +0000 (15:31 +0100)]
realloc-gnu: Allow use as dependency from test modules.

* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Set
REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC.
(gl_FUNC_REALLOC_POSIX): Set REPLACE_REALLOC_FOR_REALLOC_POSIX instead
of REPLACE_REALLOC.
* m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the
realloc-gnu module indicator.
(gl_STDLIB_H_DEFAULTS): Initialize REPLACE_REALLOC_FOR_REALLOC_GNU,
REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC.
* modules/stdlib (Makefile.am): Substitute GNULIB_REALLOC_GNU,
REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not
REPLACE_REALLOC.
* modules/realloc-posix (Depends-on, configure.ac): Test
REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC.
* modules/realloc-gnu (Comment): Remove section.
(Depends-on): Add free-posix, malloc-gnu, xalloc-oversized.
(configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_GNU instead of
REPLACE_REALLOC. Set a module indicator.
* lib/stdlib.in.h (realloc): Test REPLACE_REALLOC_FOR_REALLOC_POSIX,
REPLACE_REALLOC_FOR_REALLOC_GNU, and the respective module indicators
instead of just REPLACE_REALLOC.

2 years agocalloc-gnu: Allow use as dependency from test modules.
Bruno Haible [Mon, 3 Jan 2022 14:17:02 +0000 (15:17 +0100)]
calloc-gnu: Allow use as dependency from test modules.

* m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Set REPLACE_CALLOC_FOR_CALLOC_GNU
instead of REPLACE_CALLOC.
(gl_FUNC_CALLOC_POSIX): Set REPLACE_CALLOC_FOR_CALLOC_POSIX instead of
REPLACE_CALLOC.
* m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the
calloc-gnu module indicator.
(gl_STDLIB_H_DEFAULTS): Initialize REPLACE_CALLOC_FOR_CALLOC_GNU,
REPLACE_CALLOC_FOR_CALLOC_POSIX, not REPLACE_CALLOC.
* modules/stdlib (Makefile.am): Substitute GNULIB_CALLOC_GNU,
REPLACE_CALLOC_FOR_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_POSIX, not
REPLACE_CALLOC.
* modules/calloc-posix (Depends-on, configure.ac): Test
REPLACE_CALLOC_FOR_CALLOC_POSIX instead of REPLACE_CALLOC.
* modules/calloc-gnu (Depends-on): Add xalloc-oversized.
(configure.ac): Test REPLACE_CALLOC_FOR_CALLOC_GNU instead of
REPLACE_CALLOC. Set a module indicator.
* lib/stdlib.in.h (calloc): Test REPLACE_CALLOC_FOR_CALLOC_POSIX,
REPLACE_CALLOC_FOR_CALLOC_GNU, and the respective module indicators
instead of just REPLACE_CALLOC.

2 years agomalloc-gnu: Allow use as dependency from test modules.
Bruno Haible [Mon, 3 Jan 2022 13:49:04 +0000 (14:49 +0100)]
malloc-gnu: Allow use as dependency from test modules.

* m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Set REPLACE_MALLOC_FOR_MALLOC_GNU
instead of REPLACE_MALLOC.
(gl_FUNC_MALLOC_PTRDIFF, gl_FUNC_MALLOC_POSIX): Set
REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC.
* m4/calloc.m4 (gl_FUNC_CALLOC_POSIX): Test
REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC.
* m4/realloc.m4 (gl_FUNC_REALLOC_POSIX): Likewise.
* m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the
malloc-gnu module indicator.
(gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MALLOC_FOR_MALLOC_GNU,
REPLACE_MALLOC_FOR_MALLOC_POSIX, not REPLACE_MALLOC.
* modules/stdlib (Makefile.am): Substitute GNULIB_MALLOC_GNU,
REPLACE_MALLOC_FOR_MALLOC_GNU, REPLACE_MALLOC_FOR_MALLOC_POSIX, not
REPLACE_MALLOC.
* modules/malloc-posix (Depends-on, configure.ac): Test
REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC.
* modules/malloc-gnu (Comment): Remove section.
(Depends-on): Add xalloc-oversized.
(configure.ac): Test REPLACE_MALLOC_FOR_MALLOC_GNU instead of
REPLACE_MALLOC. Set a module indicator.
* lib/stdlib.in.h (malloc): Test REPLACE_MALLOC_FOR_MALLOC_POSIX,
REPLACE_MALLOC_FOR_MALLOC_GNU, and the respective module indicators
instead of just REPLACE_MALLOC.

2 years agogen-header: port to BusyBox ‘sed’
Paul Eggert [Sat, 1 Jan 2022 23:30:38 +0000 (15:30 -0800)]
gen-header: port to BusyBox ‘sed’

Problem reported by Tim Rühsen in:
https://lists.gnu.org/r/bug-gnulib/2022-01/msg00004.html
* modules/gen-header (SED_HEADER_NOEDIT): Replace instead of prepend.
(SED_HEADER_STDOUT, SED_HEADER_TO_AT_t): Adjust to that change.
Do not use ‘w foo’ twice in the same script, as BusyBox ‘sed’
mistakenly opens ‘foo’ for output twice, thus losing some output.

2 years agoautoupdate
Paul Eggert [Sat, 1 Jan 2022 20:05:00 +0000 (12:05 -0800)]
autoupdate

3 years agomaint: Update copyright notices.
Bruno Haible [Sat, 1 Jan 2022 18:48:46 +0000 (19:48 +0100)]
maint: Update copyright notices.

* build-aux/declared.sh (func_version): Bump year.

3 years agomaint: Update copyright notices in code generating programs.
Bruno Haible [Sat, 1 Jan 2022 18:48:03 +0000 (19:48 +0100)]
maint: Update copyright notices in code generating programs.

* lib/gen-uni-tables.c (output_predicate_test, output_predicate,
output_category, output_combclass, output_bidi_category,
output_decimal_digit_test, output_decimal_digit, output_digit_test,
output_digit, output_numeric_test, output_numeric, output_mirror,
output_joining_type_test, output_joining_type,
output_joining_group_test, output_joining_group, output_scripts,
output_scripts_byname, output_blocks, output_ident_category,
output_nonspacing_property, output_lbrk_tables,
output_lbrk_rules_as_tables, output_wbrk_tables, output_gbp_test,
output_gbp_table, output_decomposition_tables,
output_composition_tables, output_simple_mapping_test,
output_simple_mapping, output_casing_rules): Extend copyright year of
generated file to 2022.
* lib/uniname/gen-uninames.lisp (main): Likewise. Produce license notice
that is consistent with the gnulib/etc/license-notices/ files.
* All files regenerated.

3 years agomaint: fix ‘make update-copyright’ on symlinks
Paul Eggert [Sat, 1 Jan 2022 18:24:28 +0000 (10:24 -0800)]
maint: fix ‘make update-copyright’ on symlinks

After running ‘make update-copyright’ I noticed that it
incorrectly replaced a couple of symlinks with their contents.
* Makefile (update-copyright): Do not update symlinks.
* etc/license-notices/GPL, etc/license-notices/LGPL:
Change these back to symlinks.

3 years agomaint: run 'make update-copyright'
Paul Eggert [Sat, 1 Jan 2022 17:43:19 +0000 (09:43 -0800)]
maint: run 'make update-copyright'

3 years agounistdio: Prefer newer version to older, buggy one.
Bruno Haible [Fri, 31 Dec 2021 23:44:56 +0000 (00:44 +0100)]
unistdio: Prefer newer version to older, buggy one.

* modules/unistdio/ulc-vasnprintf (configure.ac): Bump required
libunistring version. This is needed because of the heap overrun fix
(2018-09-23) and the need to avoid %n on more platforms (2020-10-04).
* modules/unistdio/ulc-asnprintf (configure.ac): Likewise.
* modules/unistdio/ulc-asprintf (configure.ac): Likewise.
* modules/unistdio/ulc-fprintf (configure.ac): Likewise.
* modules/unistdio/ulc-snprintf (configure.ac): Likewise.
* modules/unistdio/ulc-sprintf (configure.ac): Likewise.
* modules/unistdio/ulc-vasprintf (configure.ac): Likewise.
* modules/unistdio/ulc-vfprintf (configure.ac): Likewise.
* modules/unistdio/ulc-vsnprintf (configure.ac): Likewise.
* modules/unistdio/ulc-vsprintf (configure.ac): Likewise.

3 years agouniwidth: Optimize.
Bruno Haible [Fri, 31 Dec 2021 22:53:39 +0000 (23:53 +0100)]
uniwidth: Optimize.

* lib/gen-uni-tables.c (output_nonspacing_property): Add version
parameter. Emit the usual boilerplate header for generated files.
(is_width2): New function, based on lib/uniwidth/width.c.
(output_width2_property): New function.
(main): Create uniwidth/width0.h instead of uniwidth/width.c.part.
Create uniwidth/width2.h.
* lib/uniwidth/width.c: Include width0.h, width2.h, bitmap.h.
(nonspacing_table_data, nonspacing_table_ind): Remove here.
(uc_width): Replace the double-width character with an u_width2 bitmap
lookup.
* modules/uniwidth/width (Files): Add lib/uniwidth/width0.h,
lib/uniwidth/width2.h, lib/unictype/bitmap.h.

3 years agoUpdate to Unicode 14.0.0.
Bruno Haible [Fri, 31 Dec 2021 17:38:12 +0000 (18:38 +0100)]
Update to Unicode 14.0.0.

* lib/gen-uni-tables.c (UC_JOINING_GROUP_THIN_YEH,
UC_JOINING_GROUP_VERTICAL_TAIL): New enum values.
(fill_arabicshaping, joining_group_as_c_identifier): Recognize these
joining groups.
* lib/unictype.in.h (UC_JOINING_GROUP_THIN_YEH,
UC_JOINING_GROUP_VERTICAL_TAIL): New enum values.
* lib/unictype/joininggroup_name.h: Add the THIN_YEH, VERTICAL_TAIL
joining groups.
* lib/unictype/joininggroup_byname.gperf: Likewise.

* lib/gen-uni-tables.c (LBP_ID1, LBP_ID2): New enum values.
(LBP_ID): Assign artificial value.
(get_lbp): Use the extended_pictographic property to assign LBP_ID1,
LBP_ID2 instead of LBP_ID. Update such that unilbrk/lbrkprop.txt comes
out as expected.
(debug_output_lbp): Print either LBP_ID1 or LBP_ID2 as LBP_ID.
(lbp_value_to_string): Handle LBP_ID1, LBP_ID2 instead of LBP_ID.
(output_lbrk_rules_as_tables): Treat LBP_ID as macro that maps to two
table rows/columns. In rule LB30b, use LBP_ID2 in addition to LBP_EB.
Remove redundant part of rule LB27.
* lib/unilbrk/lbrktables.h (LBP_ID1, LBP_ID2): New enum values.
(LBP_ID): Remove enum value.
(unilbrk_table): Update declaration.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Use LBP_ID1 instead of LBP_ID.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
* tests/unilbrk/test-u8-possible-linebreaks.c (test_function): Add a
test of potential future emoji.
* tests/unilbrk/test-u16-possible-linebreaks.c (test_function):
Likewise.
* tests/unilbrk/test-u32-possible-linebreaks.c (test_function):
Likewise.

* lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind):
Update.
(uc_width): Assign width 2 to the characters 0x1AFF0..0x1AFF3,
0x1AFF5..0x1AFFB, 0x1AFFD..0x1AFFE, 0x1B120..0x1B122, 0x1F6DD..0x1F6DF,
0x1F7F0, 0x1FA7B..0x1FA7C, 0x1FAA9..0x1FAAC, 0x1FAB7..0x1FABA,
0x1FAC3..0x1FAC5, 0x1FAD7..0x1FAD9, 0x1FAE0..0x1FAE7, 0x1FAF0..0x1FAF6.
* tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters
0x0890..0x0891, 0x0898..0x089F, 0x08CA..0x0902, 0x0C3C, 0x180F,
0x1AC1..0x1ACE, 0x1DFA, 0x10F82..0x10F85, 0x11070, 0x11073..0x11074,
0x110C2, 0x1CF00..0x1CF2D, 0x1CF30..0x1CF46, 0x1E2AE. Expect ambiguous
width for the character 0x1734. Expect width 2 for the characters
0x1AFF0..0x1AFF3, 0x1AFF5..0x1AFFB, 0x1AFFD..0x1AFFE, 0x1B120..0x1B122,
0x1F6DD..0x1F6DF, 0x1F7F0, 0x1FA7B..0x1FA7C, 0x1FAA9..0x1FAAC,
0x1FAB7..0x1FABA, 0x1FAC3..0x1FAC5, 0x1FAD7..0x1FAD9, 0x1FAE0..0x1FAE7,
0x1FAF0..0x1FAF6.

* All generated files under lib/uni* and tests/uni*: Regenerate.
* tests/uniname/NameAliases.txt: Update.
* tests/uniname/UnicodeData.txt: Update.
* tests/uninorm/NormalizationTest.txt: Update.
* tests/unigbrk/GraphemeBreakTest.txt: Update.
* tests/uniwbrk/WordBreakTest.txt: Update.

* All the affected modules: Bump required libunistring version.

3 years agoCorrect last ChangeLog entry.
Bruno Haible [Fri, 31 Dec 2021 17:15:02 +0000 (18:15 +0100)]
Correct last ChangeLog entry.

* tests/unilbrk/test-u8-possible-linebreaks.c (test_function): Add a
test for East Asian opening parenthesis.
* tests/unilbrk/test-u16-possible-linebreaks.c (test_function):
Likewise.
* tests/unilbrk/test-u32-possible-linebreaks.c (test_function):
Likewise.

3 years agoUpdate to Unicode 13.0.0.
Bruno Haible [Fri, 31 Dec 2021 11:20:27 +0000 (12:20 +0100)]
Update to Unicode 13.0.0.

* lib/gen-uni-tables.c (is_WBP_MIDLETTER): Add character 0x055F.
(get_wbp): Assign value WBP_ALETTER to the characters 0x02E5..0x02EB,
0x055A, 0x058A, 0xA708..0xA716.

* lib/gen-uni-tables.c (LBP_CP1, LBP_CP2, LBP_OP1, LBP_OP2): New enum
values.
(LBP_OP, LBP_CP): Assign artificial values.
(get_lbp): Use the unicode_width[] table to assign LBP_CP1, LBP_CP2
instead of LBP_CP, and LBP_OP1, LBP_OP2 instead of LBP_OP. Update such
that unilbrk/lbrkprop.txt comes out as expected.
(debug_output_lbp): Print either LBP_CP1 or LBP_CP2 as LBP_CP. Print
either LBP_OP1 or LBP_OP2 as LBP_OP.
(lbp_value_to_string): Handle LBP_CP1, LBP_CP2, LBP_OP1, LBP_OP2 instead
of LBP_CP, LBP_OP.
(output_lbrk_rules_as_tables): Treat LBP_CP and LBP_OP as macros that
map to two table rows/columns. In rule LB30, use only LBP_OP1 instead of
LBP_OP, and only LBP_CP1 instead of LBP_CP. Simplify rule LB22.
* lib/unilbrk/lbrktables.h (LBP_CP1, LBP_CP2, LBP_OP1, LBP_OP2): New
enum values.
(LBP_OP, LBP_CP): Remove enum values.
(unilbrk_table): Update declaration.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Add a test for East Asian opening parenthesis.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

* lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind):
Update.
(uc_width): Assign width 2 to the characters 0x16FF0..0x16FF1,
0x18AF3..0x18CD5, 0x18D00..0x18D08, 0x1F6D6..0x1F6D7, 0x1F6FB..0x1F6FC,
0x1F90C, 0x1FA74, 0x1FA83..0x1FA86, 0x1FA96..0x1FAA8, 0x1FAB0..0x1FAB6,
0x1FAC0..0x1FAC2, 0x1FAD0..0x1FAD6.
Assign width 1 to the characters 0x1F93B, 0x1F946.
* tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters
0x0B55, 0x0D81, 0x1ABF..0x1AC0, 0xA82C, 0x10EAB..0x10EAC, 0x111CF,
0x1193B..0x1193C, 0x1193E, 0x11943, 0x16FE4. Expect width 2 for the
characters 0x16FF0..0x16FF1, 0x18AF3..0x18CD5, 0x18D00..0x18D08,
0x1F6D6..0x1F6D7, 0x1F6FB..0x1F6FC, 0x1F90C, 0x1FA74, 0x1FA83..0x1FA86,
0x1FA96..0x1FAA8, 0x1FAB0..0x1FAB6, 0x1FAC0..0x1FAC2, 0x1FAD0..0x1FAD6.
Expect width 1 for the characters 0x1F93B, 0x1F946.

* All generated files under lib/uni* and tests/uni*: Regenerate.
* tests/uniname/NameAliases.txt: Update.
* tests/uniname/UnicodeData.txt: Update.
* tests/uninorm/NormalizationTest.txt: Update.
* tests/unigbrk/GraphemeBreakTest.txt: Update.
* tests/uniwbrk/WordBreakTest.txt: Update.

* All the affected modules: Bump required libunistring version.

3 years agouniwbrk: Correction of Unicode 10.0.0 support.
Bruno Haible [Thu, 30 Dec 2021 22:12:41 +0000 (23:12 +0100)]
uniwbrk: Correction of Unicode 10.0.0 support.

* lib/gen-uni-tables.c (is_WBP_MIDLETTER): Remove character 0x02D7.
The generated files are not affected.

3 years agoUpdate to Unicode 12.1.0.
Bruno Haible [Thu, 30 Dec 2021 21:38:55 +0000 (22:38 +0100)]
Update to Unicode 12.1.0.

* lib/gen-uni-tables.c: Update comments.

* All generated files under lib/uni* and tests/uni*: Regenerate.
* tests/uniname/NameAliases.txt: Update.
* tests/uniname/UnicodeData.txt: Update.
* tests/uninorm/NormalizationTest.txt: Update.
* tests/unigbrk/GraphemeBreakTest.txt: Update.
* tests/uniwbrk/WordBreakTest.txt: Update.

* All the affected modules: Bump required libunistring version.

3 years agoUpdate to Unicode 12.0.0.
Bruno Haible [Thu, 30 Dec 2021 20:54:23 +0000 (21:54 +0100)]
Update to Unicode 12.0.0.

* lib/gen-uni-tables.c (is_property_default_ignorable_code_point):
Exclude 0x13430..0x13438.
(get_lbp): Update such that unilbrk/lbrkprop.txt comes out as expected.
(get_wbp): Map 0xFF10..0xFF19 to WBP_NUMERIC.

* lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind):
Update.
(uc_width): Assign width 2 to the characters 0x16FE2..0x16FE3,
0x187F2..0x187F7, 0x1B150..0x1B152, 0x1B164..0x1B167, 0x1F6D5, 0x1F6FA,
0x1F7E0..0x1F7EB, 0x1F90D..0x1F90F, 0x1FA70..0x1FA73, 0x1FA78..0x1FA7A,
0x1FA80..0x1FA82, 0x1FA90..0x1FA95.
* tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters
0x0EBA, 0xA9BD, 0x119D4..0x119D7, 0x119DA..0x119DB, 0x119E0,
0x13430..0x13438, 0x16F4F, 0x1E130..0x1E136, 0x1E2EC..0x1E2EF. Expect
width 2 for the characters 0x16FE2..0x16FE3, 0x187F2..0x187F7,
0x1B150..0x1B152, 0x1B164..0x1B167, 0x1F6D5, 0x1F6FA, 0x1F7E0..0x1F7EB,
0x1F90D..0x1F90F, 0x1FA70..0x1FA73, 0x1FA78..0x1FA7A, 0x1FA80..0x1FA82,
0x1FA90..0x1FA95.

* All generated files under lib/uni* and tests/uni*: Regenerate.
* tests/uniname/NameAliases.txt: Update.
* tests/uniname/UnicodeData.txt: Update.
* tests/uninorm/NormalizationTest.txt: Update.
* tests/unigbrk/GraphemeBreakTest.txt: Update.
* tests/uniwbrk/WordBreakTest.txt: Update.

* All the affected modules: Bump required libunistring version.

3 years agocrypto/sm3-buffer: fix C99 conformance bug
Paul Eggert [Thu, 30 Dec 2021 19:02:40 +0000 (11:02 -0800)]
crypto/sm3-buffer: fix C99 conformance bug

* lib/sm3.c (sm3_process_block): Call varargs macro with enough
arguments.  Problem found by IBM XL/C 12.1.0.0 for AIX.

3 years agoUpdate to Unicode 11.0.0.
Bruno Haible [Thu, 30 Dec 2021 15:45:39 +0000 (16:45 +0100)]
Update to Unicode 11.0.0.

* lib/gen-uni-tables.c (is_property_default_ignorable_code_point):
Simplify by use of PROP_PREPENDED_CONCATENATION_MARK.
(UC_JOINING_GROUP_HANIFI_ROHINGYA_PA,
UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA): New enum values.
(fill_arabicshaping, joining_group_as_c_identifier): Recognize these
joining groups.
(get_lbp): Update such that unilbrk/lbrkprop.txt comes out as expected.
(WBP_EB, WBP_EM, WBP_GAZ, WBP_EBG): Remove enum values.
(WBP_WSS): New enum value.
(get_wbp): Update such that uniwbrk/wbrkprop.txt comes out as expected.
(debug_output_wbp, fill_org_wbp, debug_output_org_wbp, output_wbp):
Update for changed enum values.

* lib/unictype.in.h (UC_JOINING_GROUP_HANIFI_ROHINGYA_*): New enum
values.
* lib/unictype/joininggroup_name.h: Add the HANIFI_ROHINGYA_* joining
groups.
* lib/unictype/joininggroup_byname.gperf: Likewise.

* lib/unigbrk.in.h: Mark 4 enum values as obsolete.
* lib/unigbrk/u-grapheme-breaks.h (FUNC): Handle emoji modifier sequence
according to Unicode 11.0.0.
* lib/unigbrk/u8-grapheme-breaks.c: Include <stdbool.h>, unictype.h.
* lib/unigbrk/u16-grapheme-breaks.c: Likewise.
* lib/unigbrk/u32-grapheme-breaks.c: Likewise.
* lib/unigbrk/uc-grapheme-breaks.c: Likewise.
* modules/unigbrk/u8-grapheme-breaks (Depends-on): Add
unictype/property-extended-pictographic, stdbool.
* modules/unigbrk/u16-grapheme-breaks (Depends-on): Likewise.
* modules/unigbrk/u32-grapheme-breaks (Depends-on): Likewise.
* modules/unigbrk/uc-grapheme-breaks (Depends-on): Likewise.
* tests/unigbrk/test-u8-grapheme-breaks.c (main): Add test for emoji
modifier / ZWJ sequence.
* tests/unigbrk/test-u16-grapheme-breaks.c (main): Likewise.
* tests/unigbrk/test-u32-grapheme-breaks.c (main): Likewise.
* tests/unigbrk/test-uc-is-grapheme-break.c: Include <stdbool.h>,
unictype.h.
(main): Update workaround logic to match the one in
lib/unigbrk/u-grapheme-breaks.h.
* modules/unigbrk/uc-is-grapheme-break-tests (Depends-on): Add
unictype/property-extended-pictographic, stdbool.

* lib/uniwbrk.in.h: Mark 4 enum values as obsolete.
(WBP_WSS): New enum value.
* lib/uniwbrk/u-wordbreaks.h (FUNC): Handle emoji ZWJ sequences and
horizontal whitespace according to Unicode 11.0.0.
* lib/uniwbrk/u8-wordbreaks.c: Include unictype.h.
* lib/uniwbrk/u16-wordbreaks.c: Likewise.
* lib/uniwbrk/u32-wordbreaks.c: Likewise.
* lib/uniwbrk/wbrktable.c (uniwbrk_prop_index, uniwbrk_table): Add a row
and column for WBP_WSS.
* lib/uniwbrk/wbrktable.h (uniwbrk_prop_index, uniwbrk_table): Update
declarations.
* modules/uniwbrk/u8-wordbreaks (Depends-on): Add
unictype/property-extended-pictographic.
* modules/uniwbrk/u16-wordbreaks (Depends-on): Likewise.
* modules/uniwbrk/u32-wordbreaks (Depends-on): Likewise.
* tests/uniwbrk/test-u8-wordbreaks.c (main): Update expected results.
* tests/uniwbrk/test-u16-wordbreaks.c (main): Likewise.
* tests/uniwbrk/test-u32-wordbreaks.c (main): Likewise.
* tests/uniwbrk/test-uc-wordbreaks.c (wordbreakproperty_to_string):
Update.

* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Handle ZWJ according to Unicode 11.0.0.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

* lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind):
Update.
(uc_width): Assign width 2 to the characters 0x187ED..0x187F1, 0x1F6F9,
0x1F9E7..0x1F9FF.
* tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters
0x07FD, 0x08D3, 0x09FE, 0x0C04, 0xA8FF, 0x10D24..0x10D27,
0x10F46..0x10F50, 0x110CD, 0x111C9, 0x1133B, 0x1145E, 0x1182F..0x11837,
0x11839..0x1183A, 0x11D90..0x11D91, 0x11D95, 0x11D97, 0x11EF3..0x11EF4.
Expect width 2 for the characters 0x187ED..0x187F1, 0x1F6F9,
0x1F9E7..0x1F9FF.

* All generated files under lib/uni* and tests/uni*: Regenerate.
* tests/uniname/NameAliases.txt: Update.
* tests/uniname/UnicodeData.txt: Update.
* tests/uninorm/NormalizationTest.txt: Update.
* tests/unigbrk/GraphemeBreakTest.txt: Update.
* tests/uniwbrk/WordBreakTest.txt: Update.

* All the affected modules: Bump required libunistring version.