]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agodoc: Fix warnings about regex chapter structure (regression 2022-05-15).
Bruno Haible [Sun, 5 Jun 2022 17:09:15 +0000 (19:09 +0200)]
doc: Fix warnings about regex chapter structure (regression 2022-05-15).

* doc/regex.texi (GNU Operators): Fix menu.

2 years agoregex-quote: \} -> } in EREs
Paul Eggert [Sat, 4 Jun 2022 16:55:28 +0000 (09:55 -0700)]
regex-quote: \} -> } in EREs

* lib/regex-quote.c (ere_special): Don’t use \} in EREs,
as POSIX says the interpretation is undefined.
* tests/test-regex-quote.c (test_bre, test_ere):
Add tests for }.

2 years agodfa: do not warn about \] and \}
Paul Eggert [Sat, 4 Jun 2022 01:46:37 +0000 (18:46 -0700)]
dfa: do not warn about \] and \}

* lib/dfa.c (lex): Do not warn about \] and \}, since they’re
surely universally supported even though POSIX says their
interpretation is undefined.

2 years agoregex-quote: \] -> ] in EREs and BREs
Paul Eggert [Sat, 4 Jun 2022 00:52:19 +0000 (17:52 -0700)]
regex-quote: \] -> ] in EREs and BREs

* build-aux/bootstrap:
* build-aux/bootstrap.conf (gettext_external):
* check-AC_LIBOBJ:
* lib/regex-quote.c (bre_special, ere_special):
* gnulib-tool (func_modules_transitive_closure)
(func_emit_autoconf_snippet, func_import, func_create_testdir):
* tests/test-regex-quote.c (test_bre, test_ere):
* top/maint.mk (longopt_re, gpg_key_ID):
Don’t use \] in BREs and EREs, as POSIX says the interpretation is
undefined.

2 years agofilevercmp: don’t treat entire filename as suffix
Paul Eggert [Sat, 4 Jun 2022 00:27:44 +0000 (17:27 -0700)]
filevercmp: don’t treat entire filename as suffix

Problem reported by Artém S. Tashkinóv in:
https://lists.gnu.org/r/bug-gnulib/2022-06/msg00012.html
* lib/filevercmp.c (file_prefixlen): When stripping
(\.[A-Za-z~][A-Za-z0-9~]*)*$ suffixes, do not strip
the entire file name.
* tests/test-filevercmp.c (examples): Adjust to match new behavior.

2 years agosetlocale: Update after Turkey changed its name.
Bruno Haible [Fri, 3 Jun 2022 15:46:27 +0000 (17:46 +0200)]
setlocale: Update after Turkey changed its name.

* lib/setlocale.c: Update comments.

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

2 years agoGNU Emacs Operator node deleted from regex.texi
Karl Berry [Wed, 25 May 2022 14:55:36 +0000 (07:55 -0700)]
GNU Emacs Operator node deleted from regex.texi

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

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

2 years agodfa: new options DFA_STAR_WARN, DFA_PLUS_WARN
Paul Eggert [Tue, 24 May 2022 23:03:29 +0000 (16:03 -0700)]
dfa: new options DFA_STAR_WARN, DFA_PLUS_WARN

This lets ‘grep -E '(*a|+b)'’ warn about the * and the +.
* lib/dfa.h (DFA_STAR_WARN, DFA_PLUS_WARN): New flags.
* lib/dfa.c (lex): Support them.

2 years agodfa: '\n' is not governed by RE_LIMITED_OPS
Paul Eggert [Mon, 23 May 2022 19:17:49 +0000 (12:17 -0700)]
dfa: '\n' is not governed by RE_LIMITED_OPS

* lib/dfa.c (lex): Pay no attention to RE_LIMITED_OPS when
deciding how to parse '\n', since regcomp.c doesn’t.

2 years agodfa: new option DFA_STRAY_BACKSLASH_WARN
Paul Eggert [Mon, 23 May 2022 19:05:14 +0000 (12:05 -0700)]
dfa: new option DFA_STRAY_BACKSLASH_WARN

This is for grep, which wants to warn about stray backslashes that
lead to unspecified behavior.  For example, "grep -oi '\a'"
surprisingly is not equivalent to "grep -oi 'a'", so the stray
backslash should be warned about.
* lib/dfa.c: Include wctype.h, for iswprint and iswspace.
(lex): Add support for DFA_STRAY_BACKSLASH_WARN.
* lib/dfa.h (DFA_STRAY_BACKSLASH_WARN): New constant.

2 years agodfa: new option DFA_CONFUSING_BRACKETS_ERROR
Paul Eggert [Mon, 23 May 2022 17:04:18 +0000 (10:04 -0700)]
dfa: new option DFA_CONFUSING_BRACKETS_ERROR

This is for grep, which wants [:alpha:] to be an error
at the top level.
* lib/dfa.c (struct regex_syntax): New member dfaopts,
replacing anchor.  All uses changed.
(parse_bracket_exp): Error, not warn, if DFA_CONFUSING_BRACKETS_ERROR.
* lib/dfa.h (DFA_CONFUSING_BRACKETS_ERROR): New constant.

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 agodfa: steer cleer of POSIX-reserved symbols
Paul Eggert [Fri, 20 May 2022 23:55:34 +0000 (16:55 -0700)]
dfa: steer cleer of POSIX-reserved symbols

* lib/dfa.c (str_eq): Rename from streq.  All uses changed.
(c_isdigit): Rename from isasciidigit.  The function worked in
EBCDIC so it wasn’t ASCII-specific anyway.  All uses changed.

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

2 years agoparse-datetime: support 'J' military time zone
Paul Eggert [Tue, 17 May 2022 22:47:35 +0000 (15:47 -0700)]
parse-datetime: support 'J' military time zone

Requested by Brian Inglis in:
https://savannah.gnu.org/support/?110644
* lib/parse-datetime.y (parser_control): New member J_zones_seen.
(item): New item 'J'.
(military_table): Add 'J'.
(parse_datetime_body): Set and use J_zones_seen.
* tests/test-parse-datetime.c (main): Test "J".

2 years agodoc: remove Emacs-specific documentation; match code
Reuben Thomas [Wed, 11 May 2022 10:47:00 +0000 (11:47 +0100)]
doc: remove Emacs-specific documentation; match code

* doc/regex.texi: Remove mention of both Emacs and non-Emacs syntax tables,
as these are no longer supported by the code. Document the word character
class (alnum + _).   Add documentation for \s and \S.  Replace mentions
of #defining emacs with RE_NO_GNU_OPS (which takes effect in the opposite
sense); merge the node “GNU Emacs Operators” into “GNU Operators”.  For \`
and \', refer to the “whole string” rather than the (Emacs) “buffer”.

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 agotermcap: Fix link error when no suitable library is found.
Bruno Haible [Sat, 14 May 2022 19:59:58 +0000 (21:59 +0200)]
termcap: Fix link error when no suitable library is found.

* m4/termcap.m4 (gl_TERMCAP_BODY): If no suitable library is found,
set LIBTERMCAP and LTLIBTERMCAP to empty.

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 agoparse-datetime: remove Emacs cruft
Paul Eggert [Wed, 11 May 2022 16:35:45 +0000 (09:35 -0700)]
parse-datetime: remove Emacs cruft

* lib/parse-datetime.y: Remove an ‘ifdef emacs’.  Emacs has never
used this module.  The module is derived from code taken from
Emacs, but that code was removed from Emacs in the 1990s.

2 years agoalloca: Remove old code for Emacs, unused since 2009.
Bruno Haible [Wed, 11 May 2022 11:00:53 +0000 (13:00 +0200)]
alloca: Remove old code for Emacs, unused since 2009.

Reported by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-05/msg00032.html>.

* lib/alloca.c: Remove Emacs specific code.

2 years agoSay that it is not the old interface
Paul Eggert [Mon, 9 May 2022 19:20:24 +0000 (12:20 -0700)]
Say that it is not the old interface

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

3 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.

3 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.

3 years agogettime-res: help the compiler
Paul Eggert [Mon, 2 May 2022 16:52:48 +0000 (09:52 -0700)]
gettime-res: help the compiler

* lib/gettime-res.c (gettime_res): Pacify GCC versions that
incorrectly complain about earlier.tv_sec not being initialized.
Let GCC know that gcd args are always positive.

3 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.

3 years agovasnprintf: Simplify. Reduce binary code size.
Paul Eggert [Sun, 1 May 2022 21:24:02 +0000 (23:24 +0200)]
vasnprintf: Simplify. Reduce binary code size.

* lib/vasnprintf.c (VASNPRINTF): Coalesce cleanup code.

3 years agovasnprintf: Simplify 'result' variable.
Paul Eggert [Sun, 1 May 2022 20:48:07 +0000 (22:48 +0200)]
vasnprintf: Simplify 'result' variable.

* lib/vasnprintf.c (VASNPRINTF): Simplify initialization and test of
'result' variable.

3 years agovasnprintf: Simplify a free() call.
Paul Eggert [Sun, 1 May 2022 20:38:50 +0000 (22:38 +0200)]
vasnprintf: Simplify a free() call.

* lib/vasnprintf.c (divide): Just call
free (x) instead of doing ‘if (x != NULL) free (x);’.

3 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.

3 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.

3 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].

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

3 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.

3 years agoregex: match [...---...] like V7 grep
Paul Eggert [Fri, 22 Apr 2022 01:56:12 +0000 (18:56 -0700)]
regex: match [...---...] like V7 grep

Problem reported by Arnold Robbins in:
https://bugs.gnu.org/20657
https://lists.gnu.org/r/bug-gnulib/2022-04/msg00053.html
* lib/regcomp.c (peek_token_bracket): Let [...---...] match '-'.
This is an extension to POSIX, and matches V7 Unix grep.

3 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

3 years agogettime-res: more-robust sampling
Paul Eggert [Wed, 20 Apr 2022 17:42:51 +0000 (10:42 -0700)]
gettime-res: more-robust sampling

* lib/gettime-res.c (gettime_res): If adjacent timestamps are
identical search for a differing timestamp.  Also, stop collecting
samples thereafter since they surely won’t help.

3 years agoPort _GL_HAS_C_ATTRIBUTE to pedantic gcc -std=c99
Paul Eggert [Wed, 20 Apr 2022 01:23:37 +0000 (18:23 -0700)]
Port _GL_HAS_C_ATTRIBUTE to pedantic gcc -std=c99

* m4/gnulib-common.m4 (_GL_HAS_C_ATTRIBUTE):
Disable -Wpedantic if using __has_c_attribute and this is not C2x.

3 years agoverify: port to pedantic gcc -std=c99
Paul Eggert [Wed, 20 Apr 2022 01:02:43 +0000 (18:02 -0700)]
verify: port to pedantic gcc -std=c99

* lib/verify.h (_GL_VERIFY): If we lack both _Static_assert and
static_assert, suppress -Wnexted-externs.

3 years agogettime-res: add tests
Paul Eggert [Tue, 19 Apr 2022 22:13:09 +0000 (15:13 -0700)]
gettime-res: add tests

* modules/gettime-res-tests, tests/test-gettime-res.c: New files.

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

3 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__.

3 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'.

3 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.

3 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.

3 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.

3 years agoautoupdate
Karl Berry [Sun, 10 Apr 2022 14:10:12 +0000 (07:10 -0700)]
autoupdate

3 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.

3 years agoinit.sh: don’t assume gzip
Paul Eggert [Mon, 4 Apr 2022 17:53:12 +0000 (10:53 -0700)]
init.sh: don’t assume gzip

* tests/init.sh (rand_bytes_): Don’t assume gzip is installed.
I found this while testing gzip installation on a platform where I
had removed the installed gzip.  gzip is executed only on
platforms lacking mktemp and /dev/urandom so this code is rarely
used; however, these platforms might also lack gzip since gzip
is neither specified by POSIX or required by the GNU Coding Standards.

3 years agoglob: sync better with glibc
Paul Eggert [Wed, 30 Mar 2022 23:29:11 +0000 (16:29 -0700)]
glob: sync better with glibc

* lib/glob.c (dirfd) [_LIBC]: Use #undef instead of #ifdef.
Problem reported by DJ Delorie.

3 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.

3 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.

3 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

3 years agomaint: bootstrap: split a too-long line
Jim Meyering [Mon, 21 Mar 2022 01:38:50 +0000 (18:38 -0700)]
maint: bootstrap: split a too-long line

* build-aux/bootstrap (git_modules_config): Split longer-than-80 line.

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

3 years agomaintainer-makefile: Improve GnuPG announce-gen options.
Simon Josefsson [Mon, 14 Mar 2022 10:14:50 +0000 (11:14 +0100)]
maintainer-makefile: Improve GnuPG announce-gen options.

* top/maint.mk (gpg_key_emil): New variable.
(gpg_keyring_url): New variable.
(announcement): Pass them as --gpg-key-email and
--gpg-keyring-url.

3 years agoannounce-gen: Modernize GnuPG key retrieval suggestions.
Simon Josefsson [Mon, 14 Mar 2022 10:13:45 +0000 (11:13 +0100)]
announce-gen: Modernize GnuPG key retrieval suggestions.

Based on patch by Darshit Shah in:
https://lists.gnu.org/archive/html/bug-gnulib/2022-03/msg00022.html

* build-aux/announce-gen (usage): Add --gpg-key-email and
--gpg-keyring-url.
(main): Support the new options.
(main): Don't suggest 'gpg --keyserver' since the situation with
public key servers is complicated and GnuPG version dependent.

3 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.

3 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.

3 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.

3 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.

3 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.

3 years agofts: revert change to use AT_NO_AUTOMOUNT
Paul Eggert [Thu, 10 Mar 2022 21:07:53 +0000 (13:07 -0800)]
fts: revert change to use AT_NO_AUTOMOUNT

* NEWS: Don’t mention AT_NO_AUTOMOUNT.
* lib/fts.c (fts_stat): Don’t use AT_NO_AUTOMOUNT, as
it has no effect with fstatat.

3 years agostatat: now obsolete
Paul Eggert [Wed, 9 Mar 2022 21:54:53 +0000 (13:54 -0800)]
statat: now obsolete

* lib/openat.h (statat, lstatat): Now deprecated.
All uses removed, and replaced with fstatat.
* modules/statat: Mark as obsolete, because it’s confusing:
it’s not clear whether it should use AT_NO_AUTOMOUNT,
which is implied by stat and by lstat, but not by fstatat.
* tests/test-statat.c: Disable deprecated-declarations warnings.

3 years agofts: be consistent about AT_NO_AUTOMOUNT
Paul Eggert [Wed, 9 Mar 2022 19:54:13 +0000 (11:54 -0800)]
fts: be consistent about AT_NO_AUTOMOUNT

* lib/fts.c (fts_stat): Use fstatat with AT_NO_AUTOMOUNT
consistently, instead of sometimes using stat (which implies
AT_NO_AUTOMOUNT) and sometimes using fstatat without AT_NO_AUTOMOUNT.
Remove a goto while we’re at it.

3 years agofcntl-h: add AT_NO_AUTOMOUNT
Pádraig Brady [Mon, 7 Mar 2022 14:04:53 +0000 (14:04 +0000)]
fcntl-h: add AT_NO_AUTOMOUNT

* lib/fcntl.in.h: Define AT_NO_AUTOMOUNT to 0 where not defined.
This is available on Linux since 2.6.38.

3 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>.

3 years agoautoupdate
Karl Berry [Sun, 27 Feb 2022 15:09:13 +0000 (07:09 -0800)]
autoupdate

3 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.

3 years agoDocument clang -fsanitize=undefined glitch
Paul Eggert [Sat, 26 Feb 2022 19:39:32 +0000 (11:39 -0800)]
Document clang -fsanitize=undefined glitch

* doc/gnulib-intro.texi (Unsupported Platforms):
Document incompatibility of ‘clang -fsanitize=undefined’
with Gnulib, and how to work around it by also using
‘-fno-sanitize=pointer-overflow’.

3 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.

3 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.

3 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.

3 years agonanosleep: simplify by using pselect
Paul Eggert [Fri, 25 Feb 2022 19:54:49 +0000 (11:54 -0800)]
nanosleep: simplify by using pselect

GNU Emacs avoids Gnulib’s ‘select’ module and uses only pselect,
which it implements in a special way on MS-DOS.
Unfortunately, though, nanosleep uses ‘select’;
problem reported by Lars Ingebrigtsen (Bug#32452#74).
As far as I can tell, Gnulib nanosleep's use of
‘select’ with signals is only for ancient platforms
that Gnulib no longer cares about, so remove that use of ‘select’.
I don’t know of any platforms that still need this fallback code,
but just in case, fall back to pselect instead, while removing
signal handling that it shouldn’t be needed nowadays.
* lib/nanosleep.c: Do not include sig-handler.h, sys/time.h.
(SIGCONT, suspended, sighandler, my_usleep): Remove.
(nanosleep) [!HAVE_BUG_BIG_NANOSLEEP && !(_WIN32 && !__CYGWIN__)]:
Just call pselect.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Do not check for sys/time.h
or call gl_FUNC_SELECT.  Do not include sys/time.h or worry
about LIBSOCKET.
(gl_PREREQ_NANOSLEEP): Remove as it’s no longer needed.
All uses removed.
* modules/nanosleep (Depends-on): Add pselect.
Remove select, sigaction, sys_time.

3 years agouserspec: warn about '.' separator
Paul Eggert [Fri, 25 Feb 2022 01:10:12 +0000 (17:10 -0800)]
userspec: warn about '.' separator

Problem reported by Dan Jacobson (Bug#44770).
* lib/userspec.c: Don’t include stdbool.h since it’s now in our API.
(parse_user_spec_warn): New function, broken out of parse_user_spec
and with a new PWARN arg.
(parse_user_spec): Use it.
* lib/userspec.h: Include stdbool.h and declare new function.
* tests/test-userspec.c (struct test.in): Now a char array
so that it can be modified.
(T): Make the placeholder a valid test, as that simplifies
the code.  Omit NULL placeholder at the end, likewise.
(main): Set up T in the new way, and test that the "."  separator
acts like the ":" separator except with a warning if it works.

3 years agouserspec: no need for static vars
Paul Eggert [Thu, 24 Feb 2022 16:45:55 +0000 (08:45 -0800)]
userspec: no need for static vars

* lib/userspec.c (parse_with_separator): Simplify.

3 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.

3 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%.

3 years agoclose-stream: don't depend on fclose
Paul Eggert [Tue, 22 Feb 2022 05:59:12 +0000 (21:59 -0800)]
close-stream: don't depend on fclose

This reverts 2022-01-26T17:33:03Z!eggert@cs.ucla.edu.
Depending on fclose broke Emacs, and since this dependency didn't
help GNU m4 let's remove it for now.  Problem reported by
Lars Ingebrigtsen <https://bugs.gnu.org/32452#47>.
* modules/close-stream (Depends-on): Remove fclose.

3 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.

3 years agomktime: improve heuristic for ca-1986 Indiana DST
Paul Eggert [Sat, 19 Feb 2022 23:04:43 +0000 (15:04 -0800)]
mktime: improve heuristic for ca-1986 Indiana DST

Problem reported by Mark Krenz <https://bugs.gnu.org/48085>.
* lib/mktime.c (__mktime_internal): Be more generous about
accepting arguments with the wrong value of tm_isdst, by falling
back to a one-hour DST difference if we find no nearby DST that is
unusual.  This fixes a problem where "1986-04-28 00:00 EDT" was
rejected when TZ="America/Indianapolis" because the nearest DST
timestamp occurred in 1970, a temporal distance too great for the
old heuristic.  This also also narrows the search a bit, which
is a minor performance win.
* m4/mktime.m4 (gl_FUNC_MKTIME_WORKS):
Check for putenv failures and for Bug#48085.
* tests/test-parse-datetime.c (main):
Test for setenv failures and for Bug#48085.

3 years agofilevercmp: fix several unexpected results
Paul Eggert [Sun, 13 Feb 2022 00:27:05 +0000 (16:27 -0800)]
filevercmp: fix several unexpected results

Problems reported by Michael Debertol in <https://bugs.gnu.org/49239>.
While looking into this, I spotted some more areas where the
code and documentation did not agree, or where the documentation
was unclear.  The biggest change needed by coreutils is a new
function filenvercmp that can compare byte strings containing NUL.
* lib/filevercmp.c: Do not include sys/types.h, stdlib.h, string.h.
Include idx.h, verify.h.
(match_suffix): Remove, replacing all uses with calls to ...
(file_prefixlen): ... this new function.  Simplify it by
avoiding the need for a confusing READ_ALPHA state variable.
Change its API to something more useful, with a *LEN arg.
it with a new *LEN arg.
(file_prefixlen, verrevcmp):
Prefer idx_t to size_t where either will do.
(order): Change args to S, POS, LEN instead of just S[POS].
This lets us handle NUL bytes correctly.  Callers changed.
Verify that ints are sufficiently wide for its API.
(verrevcmp): Don't assume that S1[S1_LEN] is a non-digit,
and likewise for S2[S2_LEN].  The byte might not be accessible
if filenvercmp is being called.
(filevercmp): Reimplement by calling filenvercmp.
(filenvercmp): New function, rewritten without the assumption
that the inputs are null-terminated.
Remove "easy comparison to see if strings are identical", as the
use of it later (a) was undocumented, and (b) caused sort -V to be
unstable.  When both strings start with ".", do not skip past
the "."s before looking for suffixes, as this disagreed
with the documentation.
* lib/filevercmp.h: Fix comments, which had many mistakes.
(filenvercmp): New decl.
* modules/filevercmp (Depends-on): Add idx, verify.  Remove string.
* tests/test-filevercmp.c: Include string.h.
(examples): Reorder examples ".0" and ".9" that matched the code
but not the documentation.  The code has been fixed to match the
documentation.  Add some examples involving \1 so that they
can be tried with both \1 and \0.  Add some other examples
taken from the bug report.
(equals): New set of test cases.
(sign, test_filevercmp): New functions.
(main): Remove test case where the fixed filevercmp disagrees with
strverscmp.  Use test_filevercmp instead of filevercmp, so that
we also test filenvercmp.  Test the newly-introduced EQUALS cases.

3 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.

3 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.

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

3 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".

3 years agotermcap, termcap-h: Deprecate.
Bruno Haible [Sun, 6 Feb 2022 11:55:51 +0000 (12:55 +0100)]
termcap, termcap-h: Deprecate.

* modules/termcap (Status, Notice): Add deprecation.
* modules/termcap-h (Status, Notice): Likewise.

3 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.

3 years agouserspec: help fix GNU ‘id’ incompatibility
Paul Eggert [Fri, 4 Feb 2022 22:27:41 +0000 (14:27 -0800)]
userspec: help fix GNU ‘id’ incompatibility

* lib/userspec.c (parse_with_separator):
Don’t set *username to a numeric string that is not a user name,
and similarly for *groupname.  Needed to fix Bug#53631.

3 years agoargmatch: add variants that only match full argument
Pádraig Brady [Sun, 30 Jan 2022 16:50:27 +0000 (16:50 +0000)]
argmatch: add variants that only match full argument

* lib/argmatch.h (argmatch_exact, [X]ARGMATCH_EXACT): New interfaces
that don't allow abbreviations.
* lib/argmatch.c (argmatch_exact): Likewise.
(__xargmatch_internal): Add a bool parameter to disable abbreviations.
* tests/test-argmatch.c: Add tests.

3 years agotests: Fix interpretation of setupterm's return code.
Bruno Haible [Sun, 30 Jan 2022 17:50:28 +0000 (18:50 +0100)]
tests: Fix interpretation of setupterm's return code.

* tests/test-terminfo.c (main): Test the value of err when setupterm
fails, not when it succeeds.
* tests/test-termcap.c (main): Likewise.

3 years agoterminfo: Add tests.
Bruno Haible [Sun, 30 Jan 2022 16:01:07 +0000 (17:01 +0100)]
terminfo: Add tests.

* tests/test-terminfo.c: New file.
* modules/terminfo-tests: New file.

3 years agoterminfo, terminfo-h: New modules.
Bruno Haible [Sun, 30 Jan 2022 15:44:27 +0000 (16:44 +0100)]
terminfo, terminfo-h: New modules.

* lib/terminfo.h: New file, from GNU gettext.
* m4/terminfo.m4: New file, from GNU gettext.
* modules/terminfo: New file, from GNU gettext.
* modules/terminfo-h: New file, from GNU gettext.

3 years agotermcap: Add tests.
Bruno Haible [Sun, 30 Jan 2022 15:34:07 +0000 (16:34 +0100)]
termcap: Add tests.

* tests/test-termcap.c: New file.
* modules/termcap-tests: New file.