]> Savannah Git Hosting - gnulib.git/log
gnulib.git
4 years agogetentropy: Enhance tests.
Bruno Haible [Sun, 31 May 2020 18:13:27 +0000 (20:13 +0200)]
getentropy: Enhance tests.

* tests/test-getentropy.c (main): Add one more test.
* tests/test-unistd-c++.cc: Check the signature of getentropy.

4 years agogetentropy: Work around a macOS and Solaris problem.
Bruno Haible [Sun, 31 May 2020 18:12:04 +0000 (20:12 +0200)]
getentropy: Work around a macOS and Solaris problem.

* lib/unistd.in.h: Include <sys/random.h>, when needed for the
'getentropy' module.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
UNISTD_H_HAVE_SYS_RANDOM_H.
* m4/sys_random_h.m4 (gl_HEADER_SYS_RANDOM): Set
UNISTD_H_HAVE_SYS_RANDOM_H.
* modules/unistd (Makefile.am): Substitute UNISTD_H_HAVE_SYS_RANDOM_H.
* doc/glibc-functions/getentropy.texi: Document the macOS and Solaris
problem. List more platforms.

4 years agofnmatch: merge from glibc
Paul Eggert [Sun, 31 May 2020 17:14:41 +0000 (10:14 -0700)]
fnmatch: merge from glibc

Also, merge in Gnulib’s more-recent methods of making it easier
to share between Gnulib and glibc.
* lib/fnmatch.c: Reorder includes to match glibc better.
Include libc-config.h instead of config.h.
Include alloca.h only if _LIBC || HAVE_ALLOCA.
Do not include "../locale/elem-hash.h" if _LIBC.
Define macros for btowc, etc. if _LIBC.  All uses simplified.
Define FALLTHROUGH if _LIBC, instead of including attribute.h.
Include intprops.h, since glibc has it now.
(SIZE_MAX): Remove; use (size_t) -1 instead.
Omit the "Comment out all this code" ifdef, since Gnulib
has never really needed it.
(STREQ): Remove; no longer used.
(__libc_use_alloca, alloca, alloca_account): Define as
needed if !_LIBC.
(ISWCTYPE): Remove; all uses replaced by iswctype.
(HANDLE_MULTIBYTE): Remove.  All uses removed by assuming true.
(internal_function): Remove.  All uses removed.
(STRUCT): New macro.
(WIDE_CHAR_VERSION): Define to 0 instead of leaving undefined.
(WMEMCMP): New macro.
(FINDIDX): Define if _LIBC, and include <locale/weight.h>
and <locale/weightwc.h>.
(fnmatch): Prefer __glibc_likely and __glibc_unlikely to
__builtin_expect.  Check for integer overflow more
systematically.  Account for alloca storage better when
recursive.  Use strnlen instead of strlen for efficiency.
* lib/fnmatch_loop.c: Include stdint.h if _LIBC, for int32_t etc.
(struct STRUCT): New type.
(FCT, EXT): New ENDS and ALLOCA_USED args.
All callers changed.
(FCT): Prefer __glibc_unlikely to __builtin_expect.
Simplify by assuming WIDE_CHAR_SUPPORT.
Copy _LIBC code from glibc without worrying Gnulib compatibility.
Cast cold to UCHAR to avoid signedness warning.
(END): Check for invalid pattern.
(EXT): Improve alloca/malloc checking (taken from glibc),
and improve it some more by using intprops.h and checking
for integer overflow and using bool for booleans.
* lib/libc-config.h (compat_symbol): New macro.
(versioned_symbol): Make it ‘extern int dummy’ so that it’s
acceptable to non-GCC when a trailing semicolon is added.
* modules/fnmatch (Depends-on): Add alloca-opt, intprops,
libc-config, strnlen.  Remove alloca.

4 years agogetrandom: Doc and test tweaks.
Bruno Haible [Sun, 31 May 2020 16:47:12 +0000 (18:47 +0200)]
getrandom: Doc and test tweaks.

* lib/getrandom.c (getrandom): Mention that it never returns 0, and that
it sets errno when failing.
* tests/test-getrandom.c (main): Disable the high-quality check on those
platforms on which it fails.
* doc/glibc-functions/getrandom.texi: Add Minix, AIX, HP-UX, IRIX,
Cygwin to the list of platforms that don't have the function. Add a note
about the quality of the result.
* doc/glibc-headers/sys_random.texi: Don't mention the 'getrandom'
declaration; this is fixed by module 'getrandom'.

4 years agogetrandom: Add support for native Windows.
Bruno Haible [Sun, 31 May 2020 16:23:04 +0000 (18:23 +0200)]
getrandom: Add support for native Windows.

* lib/getrandom.c: Include <errno.h>, <windows.h>, <bcrypt.h>,
<wincrypt.h>.
(CRYPT_VERIFY_CONTEXT): New macro.
(LoadLibrary, CryptAcquireContext): Redirect to the variant with suffix
'A'.
(GetProcAddress): New macro.
(BCryptGenRandomFuncType): New type.
(BCryptGenRandomFunc, initialized): New variables.
(initialize): New function.
(getrandom): On native Windows, use <bcrypt.h> API when available, and
<wincrypt.h> API as fallback.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Set LIB_GETRANDOM.
* modules/getrandom (Link): New section.
* modules/getentropy (Link): Likewise.
* modules/getrandom-tests (Makefile.am): Link test-getrandom against
$(LIB_GETRANDOM).
* modules/getentropy-tests (Makefile.am): Link test-getentropy against
$(LIB_GETRANDOM).
* modules/sys_random-c++-tests (Makefile.am): Link test-sys_random-c++
against $(LIB_GETRANDOM).
* doc/glibc-functions/getrandom.texi: Mention the native Windows
support.

4 years agogetrandom: Simplify the determination of the random number devices.
Bruno Haible [Sun, 31 May 2020 11:44:04 +0000 (13:44 +0200)]
getrandom: Simplify the determination of the random number devices.

Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00383.html>.

* lib/getrandom.c (NAME_OF_RANDOM_DEVICE, NAME_OF_NONCE_DEVICE): New
macros.
* modules/getrandom (Depends-on): Remove crypto/gc-random.

4 years agocrypto/gc-random: Fix list of crypto devices for Solaris.
Bruno Haible [Sun, 31 May 2020 10:55:52 +0000 (12:55 +0200)]
crypto/gc-random: Fix list of crypto devices for Solaris.

* m4/gc-random.m4 (gl_GC_RANDOM): Don't special-case Solaris.

4 years agolist: fix GCC warnings
Akim Demaille [Sun, 31 May 2020 06:59:25 +0000 (08:59 +0200)]
list: fix GCC warnings

* lib/gl_anytree_list2.h (gl_tree_iterator_free)
(gl_tree_next_node, gl_tree_node_nx_set_value)
(gl_tree_previous_node, gl_tree_next_node):
Mark unused arguments.
* lib/gl_anytree_oset.h (gl_tree_iterator_free): Likewise.
* lib/gl_anylinked_list2.h (gl_linked_node_value)
(gl_linked_node_nx_set_value, gl_linked_iterator_free): Likewise.

* lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Avoid using
the same variable name in nested scopes.

4 years agolist-c++, set-c++, oset-c++, map-c++, omap-c++: Don't fool the compiler.
Bruno Haible [Sun, 31 May 2020 10:01:27 +0000 (12:01 +0200)]
list-c++, set-c++, oset-c++, map-c++, omap-c++: Don't fool the compiler.

Reported by Akim Demaille in
<https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00102.html>.

* lib/gl_list.hh (gl_List::iterator::next): Avoid a reinterpret_cast.
* lib/gl_set.hh (gl_Set::iterator::next): Likewise.
* lib/gl_oset.hh (gl_OSet::iterator::next): Likewise.
* lib/gl_map.hh (gl_Map::iterator::next): Likewise.
* lib/gl_omap.hh (gl_OMap::iterator::next): Likewise.

4 years agowmemchr: Relicense under LGPLv2+.
Bruno Haible [Sun, 31 May 2020 00:48:31 +0000 (02:48 +0200)]
wmemchr: Relicense under LGPLv2+.

* modules/wmemchr (License): Set to LGPLv2+.

4 years agowmempcpy: New module.
Bruno Haible [Sun, 31 May 2020 00:42:47 +0000 (02:42 +0200)]
wmempcpy: New module.

Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00387.html>.

* lib/wchar.in.h (wmempcpy): New declaration.
* lib/wmempcpy.c: New file.
* m4/wmempcpy.m4: New file.
* m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmempcpy is declared.
(gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMPCPY, HAVE_WMEMPCPY.
* modules/wchar (Makefile.am): Substitute GNULIB_WMEMPCPY,
HAVE_WMEMPCPY.
* modules/wmempcpy: New file.
* tests/test-wchar-c++.cc: Check the signature of wmempcpy.
* doc/glibc-functions/wmempcpy.texi: Mention the new module.
* modules/mempcpy (Description): Fix typo.

4 years agocrypto/gc-random: Fix list of crypto devices for NetBSD, OpenBSD.
Bruno Haible [Sat, 30 May 2020 23:10:37 +0000 (01:10 +0200)]
crypto/gc-random: Fix list of crypto devices for NetBSD, OpenBSD.

* m4/gc-random.m4 (gl_GC_RANDOM): Don't special-case NetBSD and OpenBSD.

4 years agosys_random: Work around macOS bug.
Bruno Haible [Sat, 30 May 2020 23:02:21 +0000 (01:02 +0200)]
sys_random: Work around macOS bug.

* m4/sys_random_h.m4 (gl_HEADER_SYS_RANDOM): Include <sys/types.h> and
<stdlib.h> before <sys/random.h>.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Likewise.
* lib/sys_random.in.h: On macOS, include <sys/types.h> and <stdlib.h>
first.
* doc/glibc-headers/sys_random.texi: Mention the macOS problem.

4 years agogetrandom: Fix typo in last commit.
Bruno Haible [Sat, 30 May 2020 18:58:44 +0000 (20:58 +0200)]
getrandom: Fix typo in last commit.

* m4/sys_random_h.m4 (gl_SYS_RANDOM_H_DEFAULTS): Fix value of REPLACE_GETRANDOM.

4 years agogetrandom: Override incompatible system function on Solaris 11.
Bruno Haible [Sat, 30 May 2020 15:33:46 +0000 (17:33 +0200)]
getrandom: Override incompatible system function on Solaris 11.

* lib/sys_random.in.h (getrandom): Override if REPLACE_GETRANDOM is 1.
* lib/getrandom.c (getrandom): When the system has getrandom, just
invoke it.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Set REPLACE_GETRANDOM if the
system's getrandom function's prototype is not the expected one.
* m4/sys_random_h.m4 (gl_SYS_RANDOM_H_DEFAULTS): Initialize
REPLACE_GETRANDOM.
* modules/sys_random (Makefile.am): Substitute REPLACE_GETRANDOM.
* modules/getrandom (modules/getrandom): Consider REPLACE_GETRANDOM.
* tests/test-getrandom.c (main): Allow error EINVAL as an alternative to
EAGAIN.
* doc/glibc-functions/getrandom.texi: Mention the new module and the
Solaris problem.

4 years agosys_random: Add C++ tests.
Bruno Haible [Sat, 30 May 2020 14:22:25 +0000 (16:22 +0200)]
sys_random: Add C++ tests.

* tests/test-sys_random-c++.cc: New file.
* modules/sys_random-c++-tests: New file.
* modules/sys_random-tests (Depends-on): Depend on it.

4 years agosys_random: Add tests.
Bruno Haible [Sat, 30 May 2020 14:20:32 +0000 (16:20 +0200)]
sys_random: Add tests.

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

4 years agosys_random: New module.
Bruno Haible [Sat, 30 May 2020 14:18:36 +0000 (16:18 +0200)]
sys_random: New module.

* lib/sys_random.in.h: Use the common idioms for overridable header
files.
* m4/sys_random_h.m4: New file.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Require gl_SYS_RANDOM_H_DEFAULTS.
* modules/sys_random: New file.
* modules/getrandom (Files): Remove lib/sys_random.in.h.
(Depends-on): Add sys_random.
(configure.ac): Use gl_SYS_RANDOM_MODULE_INDICATOR, not
gl_UNISTD_MODULE_INDICATOR.
(Makefile.am): Don't generate sys/random.h here.
* doc/glibc-headers/sys_random.texi: New file.
* doc/gnulib.texi: Include it.

4 years agounistd: Remove conflicting declaration of getrandom().
Bruno Haible [Sat, 30 May 2020 13:15:55 +0000 (15:15 +0200)]
unistd: Remove conflicting declaration of getrandom().

* lib/unistd.in.h (getrandom): Remove declaration.
* m4/unistd_h.m4 (gl_UNISTD_H): Don't test whether getrandom is
declared.
(gl_UNISTD_H_DEFAULTS): Don't initialize GNULIB_GETRANDOM,
HAVE_GETRANDOM.
* modules/unistd (Makefile.am): Don't substitute GNULIB_GETRANDOM,
HAVE_GETRANDOM.

4 years agogetrandom: Add tests.
Bruno Haible [Sat, 30 May 2020 12:58:28 +0000 (14:58 +0200)]
getrandom: Add tests.

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

4 years agocrypto/gc-random: Fix typo in last commit.
Bruno Haible [Sat, 30 May 2020 12:16:09 +0000 (14:16 +0200)]
crypto/gc-random: Fix typo in last commit.

4 years agocrypto/gc-random: Fix link error on MSVC.
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).

4 years agoDon't assume that UNICODE is not defined.
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.

4 years agophysmem: Fix compilation errors on MSVC.
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.

4 years agognulib-tool: Fix link errors with a particular set of modules on mingw.
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.

4 years agofnmatch: Rely on more gnulib modules.
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>.

4 years agoAvoid dynamic lookup of Windows API functions when possible.
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.

4 years agoread-file: disable buffering if RF_SENSITIVE is set
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.

4 years agowmemchr, wmemcmp, wmemcpy, wmemmove, wmemset: Fix autoconf test.
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.

4 years agoFix compilation error on native Windows (regression from 2020-05-28).
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.

4 years agofopen-gnu-tests: fix "\x" escape usage
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.

4 years agoAvoid dynamic loading of Windows API functions when possible.
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.

4 years agoexplicit_bzero-tests: improve -Wmissing-declarations pacification
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

4 years agoFix build errors due to read-file changes (regression from 2020-05-27).
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.

4 years agofts: Make more robust in multithreaded applications.
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'.

4 years agorelocatable-prog: Make more robust in multithreaded applications.
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'.

4 years agogetloadavg: Make more robust in multithreaded applications.
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'.

4 years agovma-iter: Make more robust in multithreaded applications.
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'.

4 years agotruncate: Make more robust in multithreaded applications.
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().

4 years agopagealign_alloc: Make more robust in multithreaded applications.
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'.

4 years agoopenat: Make more robust in multithreaded applications.
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().

4 years agoat-internal: Make more robust in multithreaded applications.
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().

4 years agomountlist: Make more robust in multithreaded applications.
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'.

4 years agologin_tty: Make more robust in multithreaded applications.
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'.

4 years agojavacomp: Make more robust in multithreaded applications.
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'.

4 years agogetprogname: Make more robust in multithreaded applications.
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'.

4 years agoget_progname_of: Make more robust in multithreaded applications.
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'.

4 years agoget_ppid_of: Make more robust in multithreaded applications.
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'.

4 years agoget-rusage-as: Make more robust in multithreaded applications.
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'.

4 years agocrypto/gc: Make more robust in multithreaded applications.
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'.

4 years agocopy-file: Make more robust in multithreaded applications.
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().

4 years agochown: Make more robust in multithreaded applications.
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().

4 years agodoc: Fix statement about O_CLOEXEC (wrong since 2017-08-14).
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.

4 years agofopen-gnu: make 'b' flag can be used with 'e' on Windows
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.

4 years agoDon't assume that UNICODE is not defined.
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.

4 years agoImprove pattern for defining _WIN32_WINNT.
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.

4 years agojavacomp: Make more robust in multithreaded applications.
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.

4 years agomountlist: Make more robust in multithreaded applications.
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.

4 years agosethostname: Make more robust in multithreaded applications.
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.

4 years agoreadutmp: Make more robust in multithreaded applications.
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.

4 years agogetpass: Make more robust in multithreaded applications.
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.

4 years agogetloadavg: Make more robust in multithreaded applications.
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.

4 years agoexclude: Make more robust in multithreaded applications.
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.

4 years agobitset: Make more robust in multithreaded applications.
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.

4 years agoread-file: add RF_SENSITIVE flag
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.

4 years agoread-file: add flags to modify reading behavior
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.

4 years agodoc/gnulib-intro.texi: add missing "to" in sentence
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".

4 years agocount-one-bits: Fix MSVC specific code.
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.

4 years agoargz: Avoid name clashes through argz.h.
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.

4 years agoread-file: make use of fopen-gnu
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.

4 years agogetentropy, getrandom: new modules
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.

4 years agoAdd missing C99 dependencies.
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.

4 years agoexplicit_bzero-tests: pacify -Wmissing-declarations
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.

4 years agofopen-gnu: Add tests.
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.

4 years agofopen-gnu: New module.
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.

4 years agoopen, openat: Really support O_CLOEXEC.
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.

4 years agofopen: Fix the trailing slash workaround.
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.

4 years agoassure: new macro ‘affirm’
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.

4 years agocalloc-gnu: Make the test work in non-flat address spaces.
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.

4 years agocalloc-gnu: Avoid wrong configure results with GCC's AddressSanitizer.
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.

4 years agoisnanf, isnanl, isnan: Don't use nonexistent builtins with clang.
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.

4 years agocalloc-gnu: Avoid wrong configure results with clang.
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.

4 years agoisnanl, isnanl-nolibm: Make a test work better with "gcc -O2" on x86_64.
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.

4 years agofindprog-in: Ignore directories.
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.

4 years agoverify: document ‘assume’ better
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.

4 years agoautoupdate
Karl Berry [Sat, 23 May 2020 15:23:03 +0000 (08:23 -0700)]
autoupdate

4 years agogendocs: Clarify licenses for templates.
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.

4 years agogroup-member: Relicense under LGPLv2+.
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+.

4 years agomemmem: Avoid wrong configure results with "clang -fsanitize=undefined".
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.

4 years agoregex: Avoid wrong configure results with "clang -fsanitize=leak".
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.

4 years agoglob: Avoid wrong configure results with "clang -fsanitize=leak".
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.

4 years agofchownat: Support clang -fsanitize=implicit-integer-sign-change better.
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.

4 years agogetdelim: Avoid wrong configure results with gcc -fsanitize=address.
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.

4 years agoftoastr: fix ifndef typo
Paul Eggert [Tue, 19 May 2020 20:45:46 +0000 (13:45 -0700)]
ftoastr: fix ifndef typo

* lib/ftoastr.h (_GL_FTOASTR_H): Define.

4 years agohavelib: Tweak documentation.
Bruno Haible [Tue, 19 May 2020 05:48:27 +0000 (07:48 +0200)]
havelib: Tweak documentation.

* doc/havelib.texi (Searching for Libraries): Fix typo.

4 years agovcs-to-changelog: Rename vcs_to_changelog.py to use hyphens.
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.

4 years agoClarify intended usage of the license file modules.
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.

4 years agohash: add hash_xinsert
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.

4 years agofindprog-lgpl: Fix link error (existing since 2008-09-02).
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.

4 years agoc-stack: pacify -Wunused-result when DEBUG
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.