Paul Eggert [Sat, 22 Feb 2020 01:27:02 +0000 (17:27 -0800)]
largefile: remove _DARWIN_USE_64_BIT_INODE
It’s not needed in currently-supported macOS versions, and was
problematic anyway in MacOS X 10.5 which was the only version that
could use it. Problem reported by Peter Eisentraut in:
https://lists.gnu.org/r/bug-autoconf/2020-02/msg00004.html
* m4/largefile.m4 (AC_SYS_LARGEFILE):
Don’t define _DARWIN_USE_64_BIT_INODE.
This syncs with Autoconf master.
Paul Eggert [Fri, 21 Feb 2020 20:41:33 +0000 (12:41 -0800)]
Add ‘extern "C"’ to count-one-bits.h etc.
This ports these .h files to C++.
Problem reported by Simon Marchi in:
https://lists.gnu.org/r/bug-gnulib/2020-02/msg00110.html
* lib/count-leading-zeros.h, lib/count-one-bits.h:
* lib/count-trailing-zeros.h: Add ‘extern "C"’.
Bruno Haible [Sun, 16 Feb 2020 22:01:08 +0000 (23:01 +0100)]
fchmodat: Make more future-proof.
* m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Define
NEED_FCHMODAT_NONSYMLINK_FIX.
(gl_PREREQ_FCHMODAT): New macro.
* lib/fchmodat.c (fchmodat): Test NEED_FCHMODAT_NONSYMLINK_FIX. Access
/proc only on Linux. Return EOPNOTSUPP only on Linux and on platforms
without lchmod function.
* modules/fchmodat (configure.ac): Invoke gl_PREREQ_FCHMODAT.
Bruno Haible [Sun, 16 Feb 2020 21:37:28 +0000 (22:37 +0100)]
lchmod: Make more future-proof.
* m4/lchmod.m4 (gl_FUNC_LCHMOD): Define NEED_LCHMOD_NONSYMLINK_FIX.
(gl_PREREQ_LCHMOD): New macro.
* lib/lchmod.c (orig_lchmod): New function.
(lchmod): Test NEED_LCHMOD_NONSYMLINK_FIX. Access /proc only on Linux.
Return EOPNOTSUPP only on Linux and on platforms without lchmod
function.
* modules/lchmod (configure.ac): Invoke gl_PREREQ_LCHMOD.
Paul Eggert [Sun, 16 Feb 2020 20:47:52 +0000 (12:47 -0800)]
xnanosleep: prefer pause, and get remaining time
Problem reported by Vladimir Panteleev in:
https://lists.gnu.org/r/bug-gnulib/2020-02/msg00052.html
* lib/xnanosleep.c: Include intprops.h, unistd.h.
(xnanosleep) [HAVE_PAUSE]: Prefer pause when sleeping infinitely.
(xnanosleep): Obtain remaining time when nanosleep is interrupted.
* m4/xnanosleep.m4 (gl_XNANOSLEEP): Check for 'pause'.
* modules/xnanosleep (Depends-on): Add intprops, unistd.
Bruno Haible [Fri, 14 Feb 2020 18:44:08 +0000 (19:44 +0100)]
wctype-h: Fix compilation errors in C++ (regression from 2020-01-25).
Reported by Christian Biesinger in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00064.html>.
* lib/wctype.in.h (iswdigit, iswxdigit): Don't declare if the
corresponding module is not enabled.
* tests/test-wctype-h-c++.cc (iswdigit, iswxdigit): Don't check the
prototype if the corresponding module is not enabled.
Paul Eggert [Thu, 13 Feb 2020 18:41:10 +0000 (10:41 -0800)]
fchmodat, lchmod: port to buggy Linux filesystems
Problem reported by Florian Weimer in:
https://www.sourceware.org/ml/libc-alpha/2020-02/msg00534.html
* lib/fchmodat.c (fchmodat):
* lib/lchmod.c (lchmod):
Don’t assume that chmod on the O_PATH-opened fd will do
the right thing on a symbolic link.
* lib/fchmodat.c (fchmodat):
Don’t attempt to special-case
any flag value other than AT_SYMLINK_NOFOLLOW.
Bruno Haible [Tue, 11 Feb 2020 02:58:39 +0000 (03:58 +0100)]
pthread-mutex-tests, pthread-rwlock-tests: Fix link errors on HP-UX.
* modules/pthread-mutex-tests (Makefile.am): Link test-pthread-mutex
with $(LIB_SEMAPHORE).
* modules/pthread-rwlock-tests (Makefile.am): Link test-pthread-rwlock
with $(LIB_SEMAPHORE).
Bruno Haible [Sat, 8 Feb 2020 19:47:58 +0000 (20:47 +0100)]
fchmodat: Strengthen tests.
* tests/test-fchmodat.c (BASE): New macro.
(main): Use it, to avoid conflicts with other unit tests. Verify that
fchmodat changed the file permission bits.
Bruno Haible [Sat, 8 Feb 2020 19:38:01 +0000 (20:38 +0100)]
fchmodat: Improve cross-compilation guesses.
* m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Require AC_CANONICAL_HOST. When
cross-compiling, guess depending on the platform.
* doc/posix-functions/fchmodat.texi: Clarify.
Bruno Haible [Sat, 8 Feb 2020 14:54:25 +0000 (15:54 +0100)]
doc: Update for glibc 2.31.
* doc/glibc-functions/pthread_clockjoin_np.texi: New file.
* doc/gnulib.texi: Include it.
* doc/pastposix-functions/h_errno.texi: Update.
* doc/posix-functions/*.texi: Likewise.
Paul Eggert [Sat, 8 Feb 2020 00:34:12 +0000 (16:34 -0800)]
fchmodat: AT_SYMLINK_NOFOLLOW fix for non-symlinks
Fix lchmod, and fchmodat with AT_SYMLINK_NOFOLLOW, so that
they act like chmod on non-symlinks.
* NEWS:
* doc/glibc-functions/lchmod.texi (lchmod):
* doc/posix-functions/fchmodat.texi (fchmodat):
Mention this.
* lib/fchmodat.c: Define __need_system_sys_stat_h before including
config.h, and undef it after including sys/stat.h the first time.
Include fcntl.h, stdio.h, unistd.h, intprops.h, and include
sys/stat.h a second time after defining orig_fchmodat.
(orig_fchmodat) [HAVE_FCHMODAT]: New function.
(fchmodat) [HAVE_FCHMODAT]: Work around the AT_SYMLINK_NOFOLLOW bug.
* lib/lchmod.c: New file.
* lib/sys_stat.in.h (fchmodat, lchmod):
Support replacing these functions.
* m4/fchmodat.m4 (gl_FUNC_FCHMODAT): If fchmodat exists,
test that AT_SYMLINK_NOFOLLOW works on non-symlinks.
* m4/lchmod.m4 (gl_FUNC_LCHMOD): Check for lstat.
Test that lchmod works on non-symlinks.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS):
Default REPLACE_FCHMODAT and REPLACE_LCHMOD to 0.
* modules/fchmodat (Depends-on): Add fstatat, intprops, lchmod, unistd.
(Depends-on, configure.ac): Check REPLACE_FCHMODAT too.
* modules/lchmod (Files): Add lib/lchmod.c.
(Depends-on): Add errno, fcntl-h, fchmodat, intprops, lstat, unistd.
(configure.ac): Compile lchmod.c if needed.
(lib_SOURCES): Add lchmod.c.
* modules/sys_stat (sys/stat.h): Substitute REPLACE_FCHMODAT
and REPLACE_LCHMOD.
* tests/test-fchmodat.c: Include fcntl.h, sys/stat.h.
(main): Test fchmodat with AT_SYMLINK_NOFOLLOW on non-symlinks.
Marc Dionne [Wed, 5 Feb 2020 21:35:12 +0000 (13:35 -0800)]
mountlist: Consider AFS filesystems as remote
df --local relies on the ME_REMOTE macro to determine if a given
mount entry should be considered "local". There is special logic
for nfs and smb/cifs mounts, but /afs as mounted by OpenAFS, the
kernel's kafs module or AuriStorFS is treated as a local mount.
* lib/mountlist.c (ME_REMOTE): Treat mounts of type 'afs'
(OpenAFS, kernel kafs) and 'auristorfs' (AuriStorFS) as remote.
Paul Eggert [Mon, 3 Feb 2020 21:20:09 +0000 (13:20 -0800)]
Port _Noreturn to older Clang
Problem reported by Jeffery Walton in:
https://lists.gnu.org/r/bug-gnulib/2020-02/msg00013.html
* lib/_Noreturn.h (_Noreturn):
* m4/gnulib-common.m4 (gl_COMMON_BODY):
Assume _Noreturn works in Clang 3.5 and later.
It is documented to work in Clang 3.5:
http://releases.llvm.org/3.5.0/tools/clang/docs/AttributeReference.html
and is not documented in Clang 3.4:
https://releases.llvm.org/3.4/tools/clang/docs/LanguageExtensions.html
Apple sets __clang_version__ to a different value, so use
__apple_build_version__ there. See:
https://lists.gnu.org/r/bug-gnulib/2020-02/msg00017.html
Pádraig Brady [Tue, 4 Feb 2020 00:57:12 +0000 (00:57 +0000)]
test-canonicalize: avoid an unused function warning
* tests/test-canonicalize.c: Protect the inclusion of null-ptr.h
with the same guard as that used to protect usage of the null_ptr
function, so that one doesn't get a -Wunused warning
about the function being defined but unused.
* tests/test-canonicalize-lgpl.c: Likewise.
Pádraig Brady [Sun, 2 Feb 2020 16:06:48 +0000 (16:06 +0000)]
read-file: reduce max size from SIZE_MAX to PTRDIFF_MAX
On x86_64 with glibc-2.30, gcc 9.2 is giving:
error: argument 2 value '18446744073709551615'
exceeds maximum object size 9223372036854775807
[-Werror=alloc-size-larger-than=]
The details of this restriction are discussed at:
https://stackoverflow.com/q/42574890/4421
* lib/read-file.c: s/SIZE_MAX/PTRDIFF_MAX/
Paul Eggert [Thu, 30 Jan 2020 00:47:51 +0000 (16:47 -0800)]
dfa: do not depend on isblank
This removes a difference between Gawk dfa.c and Gnulib dfa.c.
* lib/dfa.c (isblank): Define if neither system nor Gnulib does.
* modules/dfa (Depends-on): Remove isblank.
* modules/isblank: Add a module indicator, for lib/dfa.c.
Paul Eggert [Wed, 29 Jan 2020 18:58:26 +0000 (10:58 -0800)]
dfa: do not assume 64-bit int
Problem reported for VAX/VMS C (!) by Arnold Robbins in:
https://lists.gnu.org/r/bug-gnulib/2020-01/msg00173.html
* lib/dfa.c (CHARCLASS_PAIR): Bring back this macro.
(CHARCLASS_WORD_BITS, charclass_word) [!UINT_LEAST64_MAX]:
Fall back to 32-bit words.
(CHARCLASS_INIT): Go back to having 8 32-bit args instead
of 4 64-bit args. All uses changed.
Paul Eggert [Mon, 27 Jan 2020 21:00:57 +0000 (13:00 -0800)]
regex: port to non-GCC pre-IEC-60559
Problem reported by Arnold Robbins in:
https://lists.gnu.org/r/bug-gnulib/2020-01/msg00154.html
* lib/regex_internal.h (ULONG_WIDTH): Make this usable in #if.
Bruno Haible [Sat, 25 Jan 2020 22:36:41 +0000 (23:36 +0100)]
c32isalnum: New module.
* lib/c32isalnum.c: New file.
* lib/c32is-impl.h: New file.
* modules/c32isalnum: New file.
* doc/posix-functions/iswalnum.texi: Mention the new module.
Paul Eggert [Fri, 24 Jan 2020 08:32:32 +0000 (00:32 -0800)]
regex: port to Gawk on nonstandard platforms
* lib/regex_internal.h (ULONG_WIDTH): Define if not already defined.
This is useful for Gawk, which does not use the Gnulib stdlib-h
module. Problem reported by Arnold Robbins in:
https://lists.gnu.org/r/bug-gnulib/2020-01/msg00138.html
Paul Eggert [Wed, 22 Jan 2020 01:59:10 +0000 (17:59 -0800)]
regex: fix bug with >=16 subexpressions
* lib/regex_internal.h (struct re_backref_cache_entry):
Use bitset_word_t as the type of eps_reachable_subexps_map,
instead of unsigned short int. This fixes a bug I introduced
to glibc in 2005-09-28T17:33:18Z!drepper@redhat.com (glibc commit 2c05d33f90861d074dc12808dafbde30f487b1a0, BZ #1302).
Remove unused member 'unused'.
Paul Eggert [Wed, 22 Jan 2020 01:29:35 +0000 (17:29 -0800)]
regex: simplify definition of BITSET_WORD_BITS
* config/srclist.txt: Remove regex.c, regex_internal.h temporarily.
* lib/regex.c (__STDC_WANT_IEC_60559_BFP_EXT__): Define.
* lib/regex_internal.h (BITSET_WORD_BITS):
* modules/regex (Depends-on): Add limits-h.
Simplify now that we can use ULONG_WIDTH.
Bruno Haible [Mon, 20 Jan 2020 17:29:24 +0000 (18:29 +0100)]
lock: Fix test-once1 failure on FreeBSD 11 (regression from 2020-01-19).
* lib/glthread/lock.c (glthread_once_multithreaded): New function.
* lib/glthread/lock.h (glthread_once_multithreaded): New declaration.
(glthread_once): Use it.