Bruno Haible [Sat, 30 May 2020 12:16:09 +0000 (14:16 +0200)]
crypto/gc-random: Fix typo in last commit.
Bruno Haible [Sat, 30 May 2020 12:13:22 +0000 (14:13 +0200)]
crypto/gc-random: Fix link error on MSVC.
* m4/gc-random.m4 (gl_GC_RANDOM): Set LIB_GC_RAMDOM.
* modules/crypto/gc-random (Link): New section.
* modules/crypto/gc-tests (Makefile.am): Link test-gc against
$(LIB_GC_RAMDOM).
Bruno Haible [Sat, 30 May 2020 09:04:02 +0000 (11:04 +0200)]
Don't assume that UNICODE is not defined.
Many Windows API functions are defined differently (redirecting to a
function with suffix 'W') if the application defines the macro UNICODE
than by default (redirecting to a function with suffix 'A').
* lib/clean-temp.c (OSVERSIONINFO, GetVersionEx): Redirect to the
variant with suffix 'A'.
* lib/dirent-private.h (WIN32_FIND_DATA): Likewise.
* lib/gc-gnulib.c (CryptAcquireContext): Likewise.
* lib/getaddrinfo.c (GetModuleHandle): Likewise.
* lib/getlogin.c (GetUserName): Likewise.
* lib/getlogin_r.c (GetUserName): Likewise.
* lib/gettimeofday.c (LoadLibrary): Likewise.
* lib/isatty.c (LoadLibrary, QueryFullProcessImageName): Likewise.
* lib/link.c (GetModuleHandle, CreateHardLink): Likewise.
* lib/localename.c (GetLocaleInfo, EnumSystemLocales): Likewise.
* lib/mountlist.c (GetDriveType): Likewise.
* lib/nonblocking.c (GetNamedPipeHandleState): Likewise.
* lib/opendir.c (WIN32_FIND_DATA, GetFullPathName, FindFirstFile):
Likewise.
* lib/physmem.c (GetModuleHandle): Likewise.
* lib/poll.c (GetModuleHandle, PeekConsoleInput, CreateEvent,
PeekMessage, DispatchMessage): Likewise.
* lib/progreloc.c (GetModuleFileName): Likewise.
* lib/putenv.c (SetEnvironmentVariable): Likewise.
* lib/read.c (GetNamedPipeHandleState): Likewise.
* lib/readdir.c (FindNextFile): Likewise.
* lib/relocatable.c (GetModuleFileName): Likewise.
* lib/rename.c (MoveFileEx): Likewise.
* lib/rewinddir.c (FindFirstFile): Likewise.
* lib/select.c (GetModuleHandle, PeekConsoleInput, CreateEvent,
PeekMessage, DispatchMessage): Likewise.
* lib/sethostname.c (GetComputerNameEx, SetComputerNameEx): Likewise.
* lib/socket.c (WSASocket): Likewise.
* lib/stat-w32.c (LoadLibrary, GetFinalPathNameByHandle): Likewise.
* lib/stat.c (WIN32_FIND_DATA, CreateFile, FindFirstFile): Likewise.
* lib/stdio-read.c (GetNamedPipeHandleState): Likewise.
* lib/stdio-write.c (GetNamedPipeHandleState): Likewise.
* lib/tmpdir.c (GetTempPath): Likewise.
* lib/tmpfile.c (OSVERSIONINFO, GetVersionEx, GetTempPath): Likewise.
* lib/uname.c (OSVERSIONINFO, GetVersionEx): Likewise.
* lib/utime.c (CreateFile, GetFileAttributes): Likewise.
* lib/windows-cond.c (CreateEvent): Likewise.
* lib/windows-rwlock.c (CreateEvent): Likewise.
* lib/windows-timedmutex.c (CreateEvent): Likewise.
* lib/windows-timedrecmutex.c (CreateEvent): Likewise.
* lib/windows-timedrwlock.c (CreateEvent): Likewise.
* lib/write.c (GetNamedPipeHandleState): Likewise.
Bruno Haible [Sat, 30 May 2020 08:39:49 +0000 (10:39 +0200)]
physmem: Fix compilation errors on MSVC.
* lib/physmem.c (PFN_MS_EX): Use BOOL, not WINBOOL.
* modules/physmem (Depends-on): Add unistd.
Bruno Haible [Sat, 30 May 2020 01:17:19 +0000 (03:17 +0200)]
gnulib-tool: Fix link errors with a particular set of modules on mingw.
* gnulib-tool (func_emit_tests_Makefile_am): Add ../lib/libgnu.a to
LDADD a second time, after the second occurrence of libtests.a.
* pygnulib/GLEmiter.py (tests_Makefile_am): Likewise.
Bruno Haible [Fri, 29 May 2020 12:01:54 +0000 (14:01 +0200)]
fnmatch: Rely on more gnulib modules.
* modules/fnmatch (Depends-on): Add btowc, isblank, iswctype, wmemchr,
wmempcpy, mempcpy.
* lib/fnmatch.c: Assume that HAVE_WCTYPE_H, HAVE_BTOWC, HAVE_ISWCTYPE,
HAVE_WMEMCHR, HAVE_WMEMPCPY, HAVE_ISBLANK, HAVE_DECL_ISBLANK,
HAVE_MEMPCPY are all 1.
* m4/fnmatch.m4 (gl_PREREQ_FNMATCH): Don't test for btowc, isblank,
iswctype, mempcpy, wmemchr, wmemcpy, wmempcpy, <wctype.h>.
Bruno Haible [Fri, 29 May 2020 20:28:00 +0000 (22:28 +0200)]
Avoid dynamic lookup of Windows API functions when possible.
* lib/getaddrinfo.c (GetProcAddress, getaddrinfo_func,
freeaddrinfo_func, getnameinfo_func, getaddrinfo_ptr, freeaddrinfo_ptr,
getnameinfo_ptr): Don't define in a build for Windows XP or higher.
(use_win32_p): Define differently.
* lib/link.c (GetProcAddress, CreateHardLinkFuncType,
CreateHardLinkFunc, initialized, initialize): Don't define in a build
for Windows XP or higher.
Daiki Ueno [Fri, 29 May 2020 03:45:40 +0000 (05:45 +0200)]
read-file: disable buffering if RF_SENSITIVE is set
* lib/read-file.c (read_file): Call setvbuf if RF_SENSITIVE.
Suggested by Glenn Strauss.
(fread_file): Suggest calling setvbuf before calling this
function. Suggested by Bruno Haible.
Bruno Haible [Fri, 29 May 2020 11:20:46 +0000 (13:20 +0200)]
wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset: Fix autoconf test.
* m4/wmemchr.m4 (gl_FUNC_WMEMCHR): Link, not only compile, the test
program.
* m4/wmemcmp.m4 (gl_FUNC_WMEMCMP): Likewise.
* m4/wmemcpy.m4 (gl_FUNC_WMEMCPY): Likewise.
* m4/wmemmove.m4 (gl_FUNC_WMEMMOVE): Likewise.
* m4/wmemset.m4 (gl_FUNC_WMEMSET): Likewise.
Bruno Haible [Fri, 29 May 2020 10:33:46 +0000 (12:33 +0200)]
Fix compilation error on native Windows (regression from 2020-05-28).
Reported by Daiki Ueno.
* lib/gettimeofday.c (GetSystemTimePreciseAsFileTimeFunc): Define as
macro when not using dynamic loading.
* lib/isatty.c (GetNamedPipeClientProcessIdFunc,
QueryFullProcessImageNameFunc): Likewise.
* lib/stat-w32.c (GetFileInformationByHandleExFunc,
GetFinalPathNameByHandleFunc): Likewise.
Daiki Ueno [Fri, 29 May 2020 02:54:31 +0000 (04:54 +0200)]
fopen-gnu-tests: fix "\x" escape usage
* tests/test-fopen-gnu.c (DATA): Use safer escape sequence.
Bruno Haible [Fri, 29 May 2020 00:03:12 +0000 (02:03 +0200)]
Avoid dynamic loading of Windows API functions when possible.
Reported by Steve Lhomme <robux4@ycbcr.xyz> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00182.html>.
* lib/gettimeofday.c (GetProcAddress,
GetSystemTimePreciseAsFileTimeFuncType,
GetSystemTimePreciseAsFileTimeFunc, initialized, initialize): Don't
define in a build for Windows 8 or higher.
* lib/isatty.c (GetProcAddress, GetNamedPipeClientProcessIdFuncType,
GetNamedPipeClientProcessIdFunc, QueryFullProcessImageNameFuncType,
QueryFullProcessImageNameFunc, initialized, initialize): Don't define
in a build for Windows Vista or higher.
* lib/stat-w32.c (GetProcAddress, GetFileInformationByHandleExFuncType,
GetFileInformationByHandleExFunc, GetFinalPathNameByHandleFuncType,
GetFinalPathNameByHandleFunc, initialized, initialize): Likewise.
Paul Eggert [Thu, 28 May 2020 23:02:32 +0000 (16:02 -0700)]
explicit_bzero-tests: improve -Wmissing-declarations pacification
* tests/test-explicit_bzero.c: Now noinline.
Suggested by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00300.html
Bruno Haible [Thu, 28 May 2020 20:04:46 +0000 (22:04 +0200)]
Fix build errors due to read-file changes (regression from 2020-05-27).
* lib/git-merge-changelog.c (read_changelog_file): Update read_file
invocation.
* tests/test-sameacls.c (main): Likewise.
* tests/test-pipe-filter-gi1.c (main): Call read_file instead of
read_binary_file.
* tests/test-pipe-filter-ii1.c (main): Likewise.
Bruno Haible [Thu, 28 May 2020 19:48:13 +0000 (21:48 +0200)]
fts: Make more robust in multithreaded applications.
* lib/fts.c (fts_open): Pass an O_CLOEXEC flag to open().
* modules/fts (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 18:35:39 +0000 (20:35 +0200)]
relocatable-prog: Make more robust in multithreaded applications.
* lib/progreloc.c (O_CLOEXEC): Define fallback to 0 when use from module
relocatable-prog-wrapper.
(find_executable): Pass an O_CLOEXEC flag to open().
* modules/relocatable-prog (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 18:16:33 +0000 (20:16 +0200)]
getloadavg: Make more robust in multithreaded applications.
* lib/getloadavg.c (getloadavg): Pass an O_CLOEXEC flag to open().
Simplify use of O_CLOEXEC.
* modules/getloadavg (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 18:11:27 +0000 (20:11 +0200)]
vma-iter: Make more robust in multithreaded applications.
* lib/vma-iter.c (rof_open, vma_iterate): Pass an O_CLOEXEC flag to
open().
* modules/vma-iter (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 18:09:49 +0000 (20:09 +0200)]
truncate: Make more robust in multithreaded applications.
* lib/truncate.c (truncate): Pass an O_CLOEXEC flag to open().
Bruno Haible [Wed, 27 May 2020 18:08:33 +0000 (20:08 +0200)]
pagealign_alloc: Make more robust in multithreaded applications.
* lib/pagealign_alloc.c (pagealign_alloc): Pass an O_CLOEXEC flag to
open().
* modules/pagealign_alloc (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 18:06:37 +0000 (20:06 +0200)]
openat: Make more robust in multithreaded applications.
* lib/openat.c (openat_needs_fchdir): Pass an O_CLOEXEC flag to open().
Bruno Haible [Wed, 27 May 2020 18:04:38 +0000 (20:04 +0200)]
at-internal: Make more robust in multithreaded applications.
* lib/openat-proc.c (openat_proc_name): Pass an O_CLOEXEC flag to
open().
Bruno Haible [Wed, 27 May 2020 18:02:57 +0000 (20:02 +0200)]
mountlist: Make more robust in multithreaded applications.
* lib/mountlist.c (read_file_system_list): Pass an O_CLOEXEC flag to
open().
* modules/mountlist (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 18:01:30 +0000 (20:01 +0200)]
login_tty: Make more robust in multithreaded applications.
* lib/login_tty.c (login_tty): Pass an O_CLOEXEC flag to open().
* modules/login_tty (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 17:46:45 +0000 (19:46 +0200)]
javacomp: Make more robust in multithreaded applications.
* lib/javacomp.c (get_classfile_version): Pass an O_CLOEXEC flag to
open().
* modules/javacomp (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 17:45:19 +0000 (19:45 +0200)]
getprogname: Make more robust in multithreaded applications.
* lib/getprogname.c (getprogname): Pass an O_CLOEXEC flag to open().
* modules/getprogname (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 17:43:23 +0000 (19:43 +0200)]
get_progname_of: Make more robust in multithreaded applications.
* lib/get_progname_of.c (get_progname_of): Pass an O_CLOEXEC flag to
open().
* modules/get_progname_of (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 17:41:38 +0000 (19:41 +0200)]
get_ppid_of: Make more robust in multithreaded applications.
* lib/get_ppid_of.c (get_ppid_of): Pass an O_CLOEXEC flag to open().
* modules/get_ppid_of (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 17:40:08 +0000 (19:40 +0200)]
get-rusage-as: Make more robust in multithreaded applications.
* lib/get-rusage-as.c (get_rusage_as_via_setrlimit): Pass an O_CLOEXEC
flag to open().
* modules/get-rusage-as (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 17:38:36 +0000 (19:38 +0200)]
crypto/gc: Make more robust in multithreaded applications.
* lib/gc-gnulib.c (randomize): Pass an O_CLOEXEC flag to open().
* modules/crypto/gc (Depends-on): Add 'open'.
Bruno Haible [Wed, 27 May 2020 17:36:54 +0000 (19:36 +0200)]
copy-file: Make more robust in multithreaded applications.
* lib/copy-file.c (qcopy_file_preserving): Pass an O_CLOEXEC flag to
open().
Bruno Haible [Wed, 27 May 2020 17:35:28 +0000 (19:35 +0200)]
chown: Make more robust in multithreaded applications.
* lib/chown.c (rpl_chown): Pass an O_CLOEXEC flag to open().
Bruno Haible [Wed, 27 May 2020 18:33:28 +0000 (20:33 +0200)]
doc: Fix statement about O_CLOEXEC (wrong since 2017-08-14).
* doc/posix-headers/fcntl.texi: Gnulib no longer defines O_CLOEXEC to 0.
Daiki Ueno [Thu, 28 May 2020 09:40:49 +0000 (11:40 +0200)]
fopen-gnu: make 'b' flag can be used with 'e' on Windows
* lib/fopen.c (rpl_fopen): Pass O_BINARY to open, if a 'b' flag is
specified on Windows.
* tests/test-fopen-gnu.c (DATA): New define.
(main): Add test for reading binary files with an 'e' flag.
Bruno Haible [Thu, 28 May 2020 00:31:53 +0000 (02:31 +0200)]
Don't assume that UNICODE is not defined.
Some Windows types, such as TCHAR, LPTSTR, LPCTSTR, are defined
differently if the application defines the macro UNICODE.
Reported by Steve Lhomme <robux4@ycbcr.xyz> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00184.html>.
* lib/link.c (CreateHardLinkFuncType): Use LPCSTR, not LPCTSTR.
* lib/localename.c (enum_locales_fn): Use LPSTR, not LPTSTR.
* lib/stat-w32.c (GetFinalPathNameByHandleFuncType): Likewise.
Bruno Haible [Thu, 28 May 2020 00:06:51 +0000 (02:06 +0200)]
Improve pattern for defining _WIN32_WINNT.
Newer versions of the Windows API may not only add, but also remove API
functions. Therefore, when the user is e.g. building for Windows 10, we
should not set _WIN32_WINNT to e.g. Windows 8, as this may enable the
use of APIs that were present in Windows 8 but removed in Windows 10.
Suggested by Steve Lhomme <robux4@ycbcr.xyz> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00318.html>.
* lib/ftruncate.c (_WIN32_WINNT): Don't set to a smaller value.
* lib/sethostname.c (_WIN32_WINNT): Likewise.
* lib/stat-w32.c (_WIN32_WINNT): Likewise.
Bruno Haible [Tue, 26 May 2020 16:05:34 +0000 (18:05 +0200)]
javacomp: Make more robust in multithreaded applications.
* lib/javacomp.c (write_temp_file): Pass an 'e' flag to fopen_temp.
* modules/javacomp (Depends-on): Add fopen-gnu.
Bruno Haible [Tue, 26 May 2020 16:04:26 +0000 (18:04 +0200)]
mountlist: Make more robust in multithreaded applications.
* lib/mountlist.c (setmntent, read_file_system_list): Pass an 'e' flag
to fopen.
* modules/mountlist (Depends-on): Add fopen-gnu.
Bruno Haible [Tue, 26 May 2020 16:00:04 +0000 (18:00 +0200)]
sethostname: Make more robust in multithreaded applications.
* lib/sethostname.c (sethostname): Pass an 'e' flag to fopen.
* modules/sethostname (Depends-on): Add fopen-gnu.
Bruno Haible [Tue, 26 May 2020 15:57:58 +0000 (17:57 +0200)]
readutmp: Make more robust in multithreaded applications.
* lib/readutmp.c (read_utmp): Pass an 'e' flag to fopen.
* modules/readutmp (Depends-on): Add fopen-gnu.
Bruno Haible [Tue, 26 May 2020 15:56:31 +0000 (17:56 +0200)]
getpass: Make more robust in multithreaded applications.
* lib/getpass.c (getpass): Pass an 'e' flag to fopen.
* modules/getpass (Depends-on): Add fopen-gnu.
Bruno Haible [Tue, 26 May 2020 15:53:47 +0000 (17:53 +0200)]
getloadavg: Make more robust in multithreaded applications.
* lib/getloadavg.c (getloadavg): Pass an 'e' flag to fopen.
* modules/getloadavg (Depends-on): Add fopen-gnu.
Bruno Haible [Tue, 26 May 2020 15:52:23 +0000 (17:52 +0200)]
exclude: Make more robust in multithreaded applications.
* lib/exclude.c (add_exclude_file): Pass an 'e' flag to fopen.
* modules/exclude (Depends-on): Add fopen-gnu.
Bruno Haible [Tue, 26 May 2020 15:51:03 +0000 (17:51 +0200)]
bitset: Make more robust in multithreaded applications.
* lib/bitset/stats.c (bitset_stats_read, bitset_stats_write): Pass an
'e' flag to fopen.
* modules/bitset (Depends-on): Add fopen-gnu.
Daiki Ueno [Tue, 26 May 2020 08:22:37 +0000 (10:22 +0200)]
read-file: add RF_SENSITIVE flag
* lib/read-file.h (RF_SENSITIVE): New define.
* lib/read-file.c (fread_file, read_file): Take into account of
RF_SENSITIVE flag.
* modules/read-file (Depends-on): Add explicit_bzero.
This adds an alternative behavior of those functions to explicitly
clear the internal memory block when it becomes unused. This is
useful for reading sensitive information from a file.
Daiki Ueno [Wed, 27 May 2020 06:14:44 +0000 (08:14 +0200)]
read-file: add flags to modify reading behavior
* lib/read-file.h (RF_BINARY): New define.
(fread_file, read_file): Take FLAGS argument.
(read_binary_file): Remove.
* lib/read-file.c (internal_read_file): Merge into ...
(read_file): ... here.
* modules/read-file-tests (Files): Add "tests/macros.h".
* tests/test-read-file.c (main): Refactor using ASSERT macro.
* NEWS: Mention this change.
Bernhard Voelker [Tue, 26 May 2020 21:16:44 +0000 (23:16 +0200)]
doc/gnulib-intro.texi: add missing "to" in sentence
Reported by Bjarni Ingi Gislason <bjarniig@rhi.hi.is> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00316.html>.
* doc/gnulib-intro.texi (Collaborative Development): Add "to".
Bruno Haible [Tue, 26 May 2020 20:27:51 +0000 (22:27 +0200)]
count-one-bits: Fix MSVC specific code.
Reported by Gisle Vanem <gisle.vanem@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00309.html>.
* lib/count-one-bits.h (COUNT_ONE_BITS_GENERIC): Don't define if we're
using GCC.
[_MSC_VER]: Use correct syntax for #pragma intrinsic.
(__popcnt64): In 32-bit mode, define as an inline function.
(COUNT_ONE_BITS): Rename first argument to GCC_BUILTIN.
Bruno Haible [Tue, 26 May 2020 19:26:13 +0000 (21:26 +0200)]
argz: Avoid name clashes through argz.h.
Reported by Gisle Vanem <gisle.vanem@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00308.html>.
* lib/argz.h: Don't use __ prefixed identifiers.
(const): Remove definition.
(argz_next): Remove inline definitions.
Daiki Ueno [Tue, 26 May 2020 05:56:13 +0000 (07:56 +0200)]
read-file: make use of fopen-gnu
* lib/read-file.c (read_file): Pass an 'e' flag to fopen.
(read_binary_file): Likewise.
* modules/read-file (Depends-on): Add fopen-gnu.
Paul Eggert [Mon, 25 May 2020 16:19:56 +0000 (09:19 -0700)]
getentropy, getrandom: new modules
* MODULES.html.sh (func_all_modules):
* lib/unistd.in.h (getentropy, getrandom):
* m4/unistd_h.m4 (gl_UNISTD_H, gl_UNISTD_H_DEFAULTS):
* modules/unistd (unistd.h):
Add support for getentropy, getrandom.
* doc/glibc-functions/getentropy.texi (getentropy):
* doc/glibc-functions/getrandom.texi (getrandom):
These are now fixed on some platforms.
* lib/getentropy.c, lib/getrandom.c, lib/sys_random.in.h:
* m4/getentropy.m4, m4/getrandom.m4:
* modules/getentropy, modules/getentropy-tests:
* modules/getrandom, modules/getrandom-tests:
* tests/test-getentropy.c, tests/test-getrandom.c:
New files.
Bruno Haible [Mon, 25 May 2020 06:57:52 +0000 (08:57 +0200)]
Add missing C99 dependencies.
Reported by Paul Smith <psmith@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00290.html>.
* modules/assert (Depends-on): Add c99.
* modules/filenamecat-lgpl (Depends-on): Likewise.
* modules/libc-config (Depends-on): Likewise.
* modules/mktime (Depends-on): Likewise.
* modules/random_r (Depends-on): Likewise.
* modules/regex (Depends-on): Likewise.
* modules/scratch_buffer (Depends-on): Likewise.
* modules/timespec-add (Depends-on): Likewise.
* modules/timespec-sub (Depends-on): Likewise.
* modules/verify (Depends-on): Likewise.
Paul Eggert [Sun, 24 May 2020 20:51:27 +0000 (13:51 -0700)]
explicit_bzero-tests: pacify -Wmissing-declarations
* tests/test-explicit_bzero.c (do_secret_stuff, test_stack):
Now static.
Bruno Haible [Sun, 24 May 2020 18:40:01 +0000 (20:40 +0200)]
fopen-gnu: Add tests.
* tests/test-fopen-gnu.c: New file.
* modules/fopen-gnu-tests: New file.
Bruno Haible [Sun, 24 May 2020 18:38:53 +0000 (20:38 +0200)]
fopen-gnu: New module.
Suggested by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00119.html>.
* lib/fopen.c (rpl_fopen): When the fopen-gnu module is enabled and the
mode contains an 'x' or 'e' flag, use open() followed by fdopen().
* m4/fopen.m4 (gl_FUNC_FOPEN_GNU): New macro.
* modules/fopen-gnu: New file.
* doc/posix-functions/fopen.texi: Document the 'fopen-gnu' module.
Bruno Haible [Sun, 24 May 2020 18:27:39 +0000 (20:27 +0200)]
open, openat: Really support O_CLOEXEC.
* lib/open.c (open): When have_cloexec is still undecided, do pass a
O_CLOEXEC flag to orig_open.
* lib/openat.c (rpl_openat): When have_cloexec is still undecided, do
pass a O_CLOEXEC flag to orig_openat.
* tests/test-open.h (test_open): Verify that O_CLOEXEC is honoured.
* modules/open-tests (Depends-on): Add fcntl.
* modules/openat-tests (Depends-on): Likewise.
* modules/fcntl-safer-tests (Depends-on): Likewise.
Bruno Haible [Sun, 24 May 2020 11:57:59 +0000 (13:57 +0200)]
fopen: Fix the trailing slash workaround.
* lib/fopen.c (rpl_fopen): Parse the mode string. Recognize "r+" as a
write access. Pass the right flags to open().
* tests/test-fopen.h (test_fopen): Add a few more tests on directories.
Paul Eggert [Sun, 24 May 2020 02:06:16 +0000 (19:06 -0700)]
assure: new macro ‘affirm’
* lib/assure.h: Include verify.h.
(affirm): New macro, after a suggestion by Marc Nieper-Wißkirchen in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00263.html
and commentary by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00278.html
* modules/assure (Depends-on:): Add verify.
Bruno Haible [Sat, 23 May 2020 21:46:43 +0000 (23:46 +0200)]
calloc-gnu: Make the test work in non-flat address spaces.
Uses code by Paul Eggert.
* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Allow a calloc() implementation
to return more than SIZE_MAX bytes, but only without wrap-around bugs.
Bruno Haible [Sat, 23 May 2020 20:13:45 +0000 (22:13 +0200)]
calloc-gnu: Avoid wrong configure results with GCC's AddressSanitizer.
* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Split the AC_RUN_IFELSE into two
AC_RUN_IFELSE invocations.
Bruno Haible [Sat, 23 May 2020 19:17:22 +0000 (21:17 +0200)]
isnanf, isnanl, isnan: Don't use nonexistent builtins with clang.
* m4/isnanf.m4 (gl_HAVE_ISNANF_NO_LIBM, gl_HAVE_ISNANF_IN_LIBM,
gl_ISNANF_WORKS): Don't use __builtin_isnanf on clang versions that
don't have it.
* m4/isnanl.m4 (gl_HAVE_ISNANL_NO_LIBM, gl_HAVE_ISNANL_IN_LIBM,
gl_FUNC_ISNANL_WORKS): Don't use __builtin_isnanl on clang versions that
don't have it.
* lib/isnanf-nolibm.h (__has_builtin): New macro.
(isnanf): Don't use __builtin_isnanf on clang versions that don't have
it.
* lib/isnanl-nolibm.h (__has_builtin): New macro.
(isnanl): Don't use __builtin_isnanl on clang versions that don't have
it.
* lib/math.in.h (__has_builtin): New macro.
(isnanf): Don't use __builtin_isnanf on clang versions that don't have
it.
(isnanl): Don't use __builtin_isnanl on clang versions that don't have
it.
(isnan): Don't use the builtins on clang versions that don't have
__builtin_isnanf and __builtin_isnanl.
Bruno Haible [Sat, 23 May 2020 18:41:51 +0000 (20:41 +0200)]
calloc-gnu: Avoid wrong configure results with clang.
* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Mark the pointer variable as
'volatile', to defeat compiler optimizations.
Bruno Haible [Sat, 23 May 2020 17:49:42 +0000 (19:49 +0200)]
isnanl, isnanl-nolibm: Make a test work better with "gcc -O2" on x86_64.
* m4/exponentl.m4 (gl_LONG_DOUBLE_EXPONENT_LOCATION): Pass the
'long double' values by reference, with values taken from a statically
allocated array.
Bruno Haible [Sat, 23 May 2020 10:19:34 +0000 (12:19 +0200)]
findprog-in: Ignore directories.
Reported by Frederick Eaton via Dmitry Goncharov in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00003.html>.
* lib/findprog-in.c (find_in_given_path): When the file found is a
directory, set errno to EACCES and, during a PATH search, continue
searching.
* modules/findprog-in (Depends-on): Add sys_stat, stat.
Paul Eggert [Sat, 23 May 2020 16:41:54 +0000 (09:41 -0700)]
verify: document ‘assume’ better
* lib/verify.h (assume): Say it’s for static analysis, not dynamic.
Karl Berry [Sat, 23 May 2020 15:23:03 +0000 (08:23 -0700)]
autoupdate
Asher Gordon [Fri, 22 May 2020 17:39:01 +0000 (13:39 -0400)]
gendocs: Clarify licenses for templates.
* doc/gendocs_template: Add a GNU All-Permissive license notice and
bump Parent-Version.
* doc/gendocs_template_min: Add a GNU All-Permissive license notice
and copy the explanatory comment about the license notice at the
bottom from gendocs_template.
Bruno Haible [Thu, 21 May 2020 19:43:32 +0000 (21:43 +0200)]
group-member: Relicense under LGPLv2+.
Jim Meyering's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00218.html>.
Paul Eggert's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00225.html>.
Eric Blake's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00217.html>.
* modules/group-member (License): Change to LGPLv2+.
Bruno Haible [Thu, 21 May 2020 18:38:39 +0000 (20:38 +0200)]
memmem: Avoid wrong configure results with "clang -fsanitize=undefined".
Reported by Tim Rühsen in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>.
* m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): Use NULL + 1, not NULL.
Bruno Haible [Thu, 21 May 2020 18:28:56 +0000 (20:28 +0200)]
regex: Avoid wrong configure results with "clang -fsanitize=leak".
Reported by Tim Rühsen in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>.
* m4/regex.m4 (gl_REGEX): Free compiled regexes and allocated registers
before returning with status 0.
Bruno Haible [Thu, 21 May 2020 17:40:59 +0000 (19:40 +0200)]
glob: Avoid wrong configure results with "clang -fsanitize=leak".
Reported by Tim Rühsen in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>.
* m4/glob.m4 (gl_GLOB): Free allocated memory before returning.
Bruno Haible [Thu, 21 May 2020 15:19:38 +0000 (17:19 +0200)]
fchownat: Support clang -fsanitize=implicit-integer-sign-change better.
Reported by Tim Rühsen in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>.
* m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG,
gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Cast -1 to uid_t or git_t,
respectively.
Tim Rühsen [Mon, 18 May 2020 10:36:16 +0000 (12:36 +0200)]
getdelim: Avoid wrong configure results with gcc -fsanitize=address.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Fix memleak.
Paul Eggert [Tue, 19 May 2020 20:45:46 +0000 (13:45 -0700)]
ftoastr: fix ifndef typo
* lib/ftoastr.h (_GL_FTOASTR_H): Define.
Bruno Haible [Tue, 19 May 2020 05:48:27 +0000 (07:48 +0200)]
havelib: Tweak documentation.
* doc/havelib.texi (Searching for Libraries): Fix typo.
Siddhesh Poyarekar [Mon, 18 May 2020 13:46:03 +0000 (19:16 +0530)]
vcs-to-changelog: Rename vcs_to_changelog.py to use hyphens.
This was needed earlier because modules had to import the main script,
but that is no longer true. Rename the script so that it is
consistent with all other scripts in gnulib and uses hyphens.
* build-aux/vcs_to_changelog.py: Rename to...
* build-aux/vcs-to-changelog.py: ... this.
* doc/vcs-to-changelog.texi (VCS To ChangeLog): Update reference.
* modules/vcs-to-changelog: Likewise.
Bruno Haible [Sun, 17 May 2020 17:27:08 +0000 (19:27 +0200)]
Clarify intended usage of the license file modules.
Reported by Asher Gordon <AsDaGo@posteo.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00126.html>.
* doc/licenses-texi.texi (License Texinfo sources): Mention the
GNU AGPL. Explain the intended usage of the modules.
* modules/fdl (Notice): Discourage use as a module.
* modules/fdl-1.3 (Notice): Likewise.
Akim Demaille [Sun, 17 May 2020 09:55:12 +0000 (11:55 +0200)]
hash: add hash_xinsert
* lib/hash.h, lib/xhash.c (hash_xinsert): New.
Bruno Haible [Sat, 16 May 2020 15:19:42 +0000 (17:19 +0200)]
findprog-lgpl: Fix link error (existing since 2008-09-02).
* modules/findprog-lgpl (Makefile.am): Arrange to compile
findprog-lgpl.c, not findprog.c.
* lib/findprog.c (find_in_path): Add LGPLed replacement code for
XNMALLOC.
Paul Eggert [Fri, 15 May 2020 20:58:30 +0000 (13:58 -0700)]
c-stack: pacify -Wunused-result when DEBUG
Problem reported by Marc Nieper-Wißkirchen in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00132.html
* lib/c-stack.c (segv_handler, overflow_handler, segv_handler) [DEBUG]:
Explicitly ignore write failures.
Jim Meyering [Wed, 13 May 2020 23:14:18 +0000 (16:14 -0700)]
announce-gen: improve a comment
* build-aux/announce-gen: Improve comment.
Paul Eggert [Tue, 12 May 2020 16:24:05 +0000 (09:24 -0700)]
xalloc: pacify -Wanalyzer-possible-null-argument
Problem reported for GCC 10.1.0 by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00118.html
* lib/xmalloc.c (HAVE_GNU_MALLOC, HAVE_GNU_REALLOC): New constants.
(xmalloc): Suppress unnecessary check if HAVE_GNU_MALLOC.
(xrealloc): Suppress unnecssary check if HAVE_GNU_REALLOC.
Paul Eggert [Mon, 11 May 2020 17:46:07 +0000 (10:46 -0700)]
careadlinkat: fix GCC 10 workaround
* lib/careadlinkat.c (careadlinkat) [GCC_LINT]:
Massage the code so that it’s closer to what it was before
the GCC 10.1.0 workaround was introduced. This fixes
a loop when !buffer and the bug workaround is in effect.
Remove unnecessary casts. Defend in a different way
against (buffer && !buffer_size), by adding at least 1
to buf_size each time through the loop.
Bruno Haible [Mon, 11 May 2020 00:32:32 +0000 (02:32 +0200)]
doc: Mark HP-UX as unsupported.
* doc/gnulib-intro.texi (Target Platforms): List HP-UX as unsupported.
Paul Eggert [Mon, 11 May 2020 00:07:47 +0000 (17:07 -0700)]
careadlinkat: limit GCC workaround
* lib/careadlinkat.c (careadlinkat): Limit workaround to GCC
10.1.0 and later, since the workaround is pretty bad and the GCC
bug should get fixed.
Bruno Haible [Sun, 10 May 2020 20:22:07 +0000 (22:22 +0200)]
attribute: Tweak comment.
Reported by Paul Eggert.
* lib/attribute.h: Tweak a category's description.
Bruno Haible [Sun, 10 May 2020 17:54:58 +0000 (19:54 +0200)]
havelib: Enhance documentation.
* doc/havelib.texi (Searching for Libraries): Mention the bad
consequences of using LIBxxx instead of LTLIBxxx and vice versa.
Bruno Haible [Sun, 10 May 2020 17:18:44 +0000 (19:18 +0200)]
attribute: Clarify list of attributes.
* lib/attribute.h: Reorder the list of attributes, and group them by
purpose.
Bruno Haible [Sun, 10 May 2020 16:14:38 +0000 (18:14 +0200)]
string: Fix compilation error in C++ mode.
* lib/warn-on-use.h (_GL_WARN_ON_USE_CXX): In C mode, use plain
_GL_WARN_ON_USE.
* lib/string.in.h (strchr, strpbrk, strrchr): Use _GL_WARN_ON_USE_CXX
instead of _GL_WARN_ON_USE.
Akim Demaille [Sun, 10 May 2020 16:11:04 +0000 (18:11 +0200)]
announce-gen: add support for dist-lzip
* build-aux/announce-gen (@archive_suffixes): Add tar.lz.
Paul Eggert [Sun, 10 May 2020 01:07:38 +0000 (18:07 -0700)]
manywarnings: port to GCC 10.1
* build-aux/gcc-warning.spec:
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C)):
Add GCC 10.1.0 warnings.
Paul Eggert [Sun, 10 May 2020 01:01:59 +0000 (18:01 -0700)]
careadlinkat: pacify -Wreturn-local-addr
* lib/careadlinkat.c (careadlinkat) [GCC_LINT]:
Pacify gcc 10’s -Wreturn-local-addr option.
Simplify some of the later code.
Paul Eggert [Sat, 9 May 2020 19:00:08 +0000 (12:00 -0700)]
attribute: remove ATTRIBUTE_DEPRECATED
* lib/attribute.h: Improve recently-added comments, mostly
by shortening them (use active voice, etc.).
(ATTRIBUTE_DEPRECATED): Remove, as it duplicates DEPRECATED.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00089.html
Bruno Haible [Sat, 9 May 2020 15:35:57 +0000 (17:35 +0200)]
attribute: Add comments.
* lib/attribute.h: Document each macro.
Akim Demaille [Sat, 9 May 2020 11:31:07 +0000 (13:31 +0200)]
bitset: use the attribute module
* modules/bitset: Depend on 'attribute'.
* lib/bitset/base.h (ATTRIBUTE_UNUSED): Remove.
* lib/bitset.c, lib/bitset/array.c, lib/bitset/list.c,
* lib/bitset/stats.c, lib/bitset/table.c, lib/bitset/vector.c:
Use MAYBE_UNUSED instead of ATTRIBUTE_UNUSED.
Bruno Haible [Sat, 9 May 2020 11:32:44 +0000 (13:32 +0200)]
c-stack: Fix warning when DEBUG is enabled.
Patch suggested by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00081.html>.
* lib/c-stack.c: Include <stdio.h>.
Bruno Haible [Sat, 9 May 2020 11:22:49 +0000 (13:22 +0200)]
Remove redundant definitions of _GL_ATTRIBUTE_FORMAT.
* lib/argp.h (_GL_ATTRIBUTE_FORMAT): Remove macro.
* lib/argp-fmtstream.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-snprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vsnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/error.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/parse-datetime.y (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/xprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
Bruno Haible [Sat, 9 May 2020 11:14:24 +0000 (13:14 +0200)]
Remove redundant definitions of _GL_ATTRIBUTE_ALLOC_SIZE.
Reported by Akim Demaille in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00077.html>.
* lib/eealloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Remove macro.
* lib/pagealign_alloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.
* lib/xalloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.
Bruno Haible [Sat, 9 May 2020 10:58:23 +0000 (12:58 +0200)]
stdio, monetary: Don't redefine _GL_ATTRIBUTE_FORMAT.
* lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Don't override the definition
that usually comes from m4/gnulib-common.m4.
* lib/monetary.in.h (_GL_ATTRIBUTE_FORMAT): Likewise.
Bruno Haible [Sat, 9 May 2020 10:50:57 +0000 (12:50 +0200)]
dirent, stdlib, wchar, string: Don't redefine _GL_ATTRIBUTE_PURE.
* lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Don't override the definition
that usually comes from m4/gnulib-common.m4.
* lib/stdlib.in.h (_GL_ATTRIBUTE_PURE): Likewise.
* lib/string.in.h (_GL_ATTRIBUTE_PURE): Likewise.
* lib/wchar.in.h (_GL_ATTRIBUTE_PURE): Likewise.