]> Savannah Git Hosting - gnulib.git/log
gnulib.git
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 agojavacomp-script, javaexec-script: Add support for disabling Java.
Bruno Haible [Mon, 20 Jun 2022 05:20:53 +0000 (07:20 +0200)]
javacomp-script, javaexec-script: Add support for disabling Java.

* m4/javacomp.m4 (gt_JAVACOMP_DISABLED): New macro.
* m4/javaexec.m4 (gt_JAVAEXEC_DISABLED): New macro.

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 agodoc: Update O_PATH platforms list.
Bruno Haible [Sun, 12 Jun 2022 14:52:30 +0000 (16:52 +0200)]
doc: Update O_PATH platforms list.

* doc/posix-headers/fcntl.texi: Update O_PATH platforms list.

2 years agofcntl: document O_PATH
Paul Eggert [Sat, 11 Jun 2022 23:59:12 +0000 (16:59 -0700)]
fcntl: document O_PATH

* doc/posix-headers/fcntl.texi: Mention O_PATH.

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 agodoc: Add section to attract more people towards the GNU project.
Bruno Haible [Sun, 5 Jun 2022 22:03:30 +0000 (00:03 +0200)]
doc: Add section to attract more people towards the GNU project.

Inspired by a suggestion from José E. Marchesi <jemarch@gnu.org> on
the gnu-prog-discuss mailing list.

* doc/join-gnu.texi: New file.
* doc/gnulib-readme.texi: Include it.

2 years agodoc: Add section to attract more people towards the GNU project.
Bruno Haible [Sun, 5 Jun 2022 17:21:43 +0000 (19:21 +0200)]
doc: Add section to attract more people towards the GNU project.

Inspired by a suggestion from José E. Marchesi <jemarch@gnu.org> on
the gnu-prog-discuss mailing list.

* doc/join-gnu.texi: New file.
* doc/gnulib-readme.texi: Include it.

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.