Bruno Haible [Mon, 6 Aug 2018 13:00:38 +0000 (15:00 +0200)]
fnmatch-h: New module.
* lib/fnmatch.in.h: Use the usual gnulib idioms for header file
replacements.
(FNM_*): Don't redefine if fnmatch exists and we are not overriding it.
(fnmatch): Use the usual gnulib idiom for function declarations. Enable
'posixcheck' warning.
* m4/fnmatch_h.m4: New file.
* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Require gl_FNMATCH_H. Remove
code that is moved to fnmatch_h.m4. When fnmatch does not exist, don't
bother testing whether it is working. Set HAVE_FNMATCH, REPLACE_FNMATCH
as appropriate.
* modules/fnmatch-h: New file.
* modules/fnmatch (Files): Remove lib/fnmatch.in.h.
(Dependencies): Add fnmatch-h. Remove extensions, snippet/*. Change
conditions.
(configure.ac): Test HAVE_FNMATCH and REPLACE_FNMATCH. Set module
indicator.
(Makefile.am): Remove code that is moved to fnmatch-h.
* modules/fnmatch-gnu (configure.ac): Test HAVE_FNMATCH and
REPLACE_FNMATCH.
* doc/posix-headers/fnmatch.texi: Mention the 'fnmatch-h' module.
* modules/posixcheck (Depends-on): Add fnmatch-h.
Bruno Haible [Sun, 5 Aug 2018 12:06:08 +0000 (14:06 +0200)]
Fix link error regarding 'rpl_environ' (regression from 2012-11-21).
* m4/extern-inline.m4: Add more comments.
* lib/warn-on-use.h (_GL_WARN_ON_USE_ATTRIBUTE): New macro.
* lib/unistd.in.h (rpl_environ): Use it instead of _GL_WARN_ON_USE.
* lib/math.in.h (_GL_WARN_REAL_FLOATING_DECL): Likewise.
Bruno Haible [Sat, 4 Aug 2018 15:25:57 +0000 (17:25 +0200)]
New module 'posixcheck'.
* modules/posixcheck: New file.
* m4/posixcheck.m4: New file.
* doc/gnulib-tool.texi (Finding POSIX substitutes): New section.
(Which modules?): Reference it.
Paul Eggert [Wed, 1 Aug 2018 23:08:26 +0000 (16:08 -0700)]
ieee754-h: new module
It looks like Emacs can use this for some NaN processing.
Emacs uses it only on double NaNs so it should be safe.
* MODULES.html.sh (func_all_modules): Add ieee754-h.
* config/srclist.txt: Mention ieee754.h in a comment.
* doc/glibc-headers/ieee754.texi (ieee754.h):
Gnulib now has a substitute that should work
except for long double and for non-IEEE platforms.
* lib/ieee754.in.h, m4/ieee754-h.m4, modules/ieee754-h:
* modules/ieee754-h-tests, tests/test-ieee754-h.c: New files.
Werner LEMBERG [Tue, 24 Jul 2018 00:46:14 +0000 (02:46 +0200)]
doc: Avoid some overfull lines in the TeX output.
* doc/glibc-functions/futimesat.texi: Replace a long @code with a
@example.
* doc/pastposix-functions/pthread_attr_getstackaddr.texi: Insert a
newline before the long URL.
* doc/pastposix-functions/pthread_attr_setstackaddr.texi: Likewise.
* doc/relocatable-maint.texi: Use @smallexample instead of @example.
Add line breaks in code snippets.
Paul Eggert [Thu, 5 Jul 2018 16:22:09 +0000 (09:22 -0700)]
renameatu: rename from renameat2
It's looking like Glibc will add a renameat2 function
that is incompatible with Gnulib renameat2; see:
https://sourceware.org/ml/libc-alpha/2018-07/msg00064.html
To help avoid future confusion, rename renameat2 to something else.
Use the name 'renameatu', as the Gnulib function is close to the
Glibc function. Perhaps someday there will also be a renameat2
Gnulib module, which mimicks the future glibc renameat2, but that
can wait as nobody seems to need such a module now.
* NEWS: Mention this.
* lib/renameatu.c: Rename from lib/renameat2.c.
* lib/renameatu.h: Rename from lib/renameat2.h.
* modules/renameat2: Rename from modules/renameatu.
* modules/renameat2-tests: Rename from modules/renameat2-tests.
All uses of "renameat2" in identifiers or file name
changed to "renameatu", except for two instances in
lib/renameatu.c that deal with the Linux kernel's
renameat2 syscall.
Paul Eggert [Thu, 5 Jul 2018 03:42:07 +0000 (20:42 -0700)]
gnulib-tool: minor tweaks for --gnu-make
* gnulib-tool: Do not allow --gnu-make in test modes,
since they all require automake.
(func_emit_lib_Makefile_am): Don’t emit automake comment
if --gnu-make.
Paul Eggert [Thu, 5 Jul 2018 03:18:48 +0000 (20:18 -0700)]
regex: work around conditional-dependencies glitch
* modules/regex (Depends-on): Add langinfo.
Without this change, I had problems building an experimental
version of GNU Emacs. The symptom of the bug was a message
‘./configure: line 12726: test: =: unary operator expected’.
This was due to a line in gl_FUNC_NL_LANGINFO that invokes
‘test $HAVE_LANGINFO_CODESET = 1’ even though HAVE_LANGINFO_CODESET
was unset. Although gl_FUNC_NL_LANGINFO has
‘AC_REQUIRE([gl_LANGINFO_H])’ and gl_LANGINFO_H always sets
HAVE_LANGINFO_CODESET to 0 or 1, gnulib-tool with
--conditional-dependencies sometimes arranges for the
gl_FUNC_NL_LANGINFO code to be executed before the gl_LANGINFO_H
code. Since the regex code includes <langinfo.h> it should be
depending on the langinfo module anyway, and this happens to work
around the bug, so install that as a workaround for now. To
reproduce the original problem, run the following shell script on
the version of Gnulib just before this patch was installed.
rm -fr foo
mkdir foo
cat >foo/configure.ac <<'EOF'
AC_INIT(GNU Emacs, 27.0.50, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/)
gl_EARLY
gl_INIT
AC_OUTPUT
EOF
./gnulib-tool --import --conditional-dependencies --gnu-make --dir foo regex
./gnulib-tool --copy build-aux/install-sh foo/install-sh
./gnulib-tool --copy build-aux/config.sub foo/config.sub
./gnulib-tool --copy build-aux/config.guess foo/config.guess
cd foo
aclocal -I m4
autoconf
./configure --with-included-regex
Paul Eggert [Mon, 2 Jul 2018 01:57:01 +0000 (18:57 -0700)]
wchar: fix bug when checking for ‘inline’
I discovered this when looking into using the regex module
with Emacs.
* m4/wchar_h.m4 (gl_WCHAR_H_INLINE_OK): Fix bug introduced in
2016-08-17T23:09:38Z!skunk@iSKUNK.ORG; the code compiled
conftest1.c and conftest2.c but these files were not created.
As far as I can see, this check never worked and nobody reported
it until now, which is a bit worrisome.
Jim Meyering [Sun, 1 Jul 2018 02:57:07 +0000 (19:57 -0700)]
bootstrap: s/--option val/--option=val/
* build-aux/bootstrap (gnulib_tool_options): Change the
spelling of "--option val" pairs to "--option=val", for
aesthetics, and also so that this file no longer triggers
a common help2man syntax-check warning when copied into
projects like grep, gzip, etc.
Paul Eggert [Sun, 1 Jul 2018 14:08:32 +0000 (07:08 -0700)]
manywarnings: omit -Wswitch-default
This should make things more consistent, as we already ignore
-Wswitch-enum. Problem reported by Reuben Thomas; see:
https://lists.gnu.org/r/bug-gnulib/2018-05/msg00179.html
* build-aux/g++-warning.spec, build-aux/gcc-warning.spec:
Add -Wswitch-default.
* m4/manywarnings-c++.m4 (gl_MANYWARN_ALL_GCC_CXX_IMPL):
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Remove -Wswitch-default.
Paul Eggert [Sun, 1 Jul 2018 13:37:38 +0000 (06:37 -0700)]
regex: revert most trimming
Problems reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2018-07/msg00001.html
* modules/regex (Depends-on): Add lock, memcmp, memmove,
and wctype back in. lock because regex users shouldn’t
need to know that regex needs locking, and the rest because
gnulib-tool should ordinarily ignore them anyway.
Paul Eggert [Sun, 1 Jul 2018 01:47:11 +0000 (18:47 -0700)]
regex: trim module dependencies
* modules/regex (Depends-on): Remove gettext-h and lock,
since the regex code should work OK without these modules,
and Emacs uses it that way. Also remove memcmp, memmove,
and wctype, as these modules are obsolete and should not be
needed any more.
Paul Eggert [Fri, 29 Jun 2018 22:34:57 +0000 (15:34 -0700)]
regex: glibc does not use intprops.h
Maybe we can talk glibc into using intprops.h someday, but
now doesn’t seem to be a good time.
* lib/regcomp.c (TYPE_SIGNED): Remove; regex_internal.h now defines.
* lib/regex_internal.h [_LIBC]: Do not include intprops.h.
(TYPE_SIGNED, INT_ADD_WRAPV): New macros.
Paul Eggert [Thu, 28 Jun 2018 19:23:31 +0000 (12:23 -0700)]
regex: port to recently proposed glibc regex merge
This patch is inspired by Adhemerval Zanella's recent proposal
https://www.sourceware.org/ml/libc-alpha/2018-06/msg00905.html
to merge glibc and Gnulib regex. It aims to simplify the merge on
the glibc side, without keeping Gnulib portable.
* lib/regex.h: Fix a problem with glibc installed-header checking,
as follows:
(_Restrict_): Prefer __restrict if defined or if GCC 2.95 or later.
(_Restrict_arr_): Prefer __restrict_arr if defined,
otherwise prefer _Restrict_ if C99 or GCC 3.1 or later (but not C++).
* lib/regex_internal.c (re_string_realloc_buffers, build_wcs_buffer)
(build_wcs_upper_buffer, build_upper_buffer)
(re_string_translate_buffer, re_string_context_at):
Move decls here from lib/regex_internal.h, for glibc internal tests.
(build_wcs_upper_buffer): Use __wcrtomb, not wcrtomb, fixing
glibc BZ #18496.
* lib/regex_internal.h (lock_fini) [_LIBC]: Cast to 0 to pacify
-Wunused-value.
(bitset_set, bitset_clear, bitset_contain, bitset_empty)
(bitset_set_all, bitset_copy, bitset_not, bitset_merge)
(bitset_mask): Now static inline, and without any __attribute__
((unused)) decoration, for glibc internal tests.
Bruno Haible [Tue, 26 Jun 2018 00:18:40 +0000 (02:18 +0200)]
threadlib: Fix LIBMULTITHREAD on platforms where --as-needed is enabled.
Reported by Erik Auerswald <auerswal@unix-ag.uni-kl.de>
in <https://lists.gnu.org/archive/html/coreutils/2018-06/msg00063.html>.
* m4/threadlib.m4 (gl_THREADLIB_BODY): Check whether the linker supports
--as-needed/--no-as-needed and --push-state/--pop-state. When defining
USE_POSIX_THREADS_WEAK or USE_SOLARIS_THREADS_WEAK or
USE_PTH_THREADS_WEAK, define LIBMULTITHREAD in such a way that -lpthread
/ -lthread / -lpth does not get optimized away by a preceding
--as-needed option.
Jim Meyering [Mon, 25 Jun 2018 15:28:12 +0000 (08:28 -0700)]
acl-internal.h: remove _GL_ATTRIBUTE_CONST on void function
* lib/acl-internal.h (free_permission_context): Remove that
attribute directive. Otherwise, it would provoke this from GCC 9:
lib/acl-internal.h:300:3: error: 'const' attribute on function \
returning 'void' [-Werror=attributes]
Jim Meyering [Mon, 25 Jun 2018 03:47:58 +0000 (20:47 -0700)]
parse-datetime: accommodate gcc-4.8.5
Bruno Haible reported the build failure in
https://lists.gnu.org/r/bug-gnulib/2018-06/msg00066.html
* lib/parse-datetime.y (parse_datetime2): Remove leading "static"
on declaration of new local.
Bruno Haible [Sun, 24 Jun 2018 22:41:03 +0000 (00:41 +0200)]
af_alg: Fix state of stream after sendfile() succeeds.
* lib/af_alg.c (afalg_stream): Invoke fflush and lseek, to ensure that
the stream is correctly positioned afterwards.
* modules/crypto/af_alg (Depends-on): Add fflush.
* tests/test-digest.h (test_digest_on_files): Verify that after the
operation the stream is positioned at end of file.
Jim Meyering [Sun, 24 Jun 2018 23:54:43 +0000 (16:54 -0700)]
canon-host: take GCC9's advice rather than ignoring warning
Pádraig Brady suggested not to ignore this GCC9 advice.
* lib/canon-host.c: Undo preceding change.
* lib/canon-host.h: Instead, declare with _GL_ATTRIBUTE_MALLOC.
Jim Meyering [Sun, 24 Jun 2018 22:58:09 +0000 (15:58 -0700)]
parse-datetime.y: avoid spurious GCC 9 warning
* lib/parse-datetime.y (parse_datetime2): Save RELATIVE_TIME_0 into
a function local prior to the first "goto fail". The prior use would
evoke this:
parse-datetime.y: In function 'parse_datetime2':
parse-datetime.y:1791:19: error: jump skips variable initialization \
[-Werror=jump-misses-init]
parse-datetime.y:2385:2: note: label 'fail' defined here
parse-datetime.y:188:43: note: '({anonymous})' declared here
parse-datetime.y:1841:12: note: in expansion of macro 'RELATIVE_TIME_0'
Jim Meyering [Sun, 24 Jun 2018 18:31:50 +0000 (11:31 -0700)]
manywarnings: accommodate GCC 9.0-pre: remove -Wchkp and -Wabi
* build-aux/gcc-warning.spec: Add them here, each with an explanation.
* m4/manywarnings.m4: Remove them.
Otherwise, building coreutils, I would see this:
cc1: error: deprecated command line option '-Wchkp' [-Werror]
cc1: error: -Wabi won't warn about anything [-Werror=abi]
cc1: note: -Wabi warns about differences from the most up-to-date ABI,\
which is also used by default
cc1: note: use e.g. -Wabi=11 to warn about changes from GCC 7
Pádraig Brady [Sun, 24 Jun 2018 22:15:16 +0000 (15:15 -0700)]
maint: clarify comments about sticky EOF
* lib/af_alg.c: Be more direct that we can't
assume stickiness of EOF for portability reasons.
* lib/md5.c: Clarify that this isn't just a glibc issue.
* lib/sha1.c: Likewise.
* lib/sha256.c: Likewise.
* lib/sha512.c: Likewise.
Pádraig Brady [Sun, 24 Jun 2018 09:09:12 +0000 (02:09 -0700)]
af_alg: disable kernel hash functions by default
All the kernel routines were seen to be significantly slower
with these relatively recent components on an i3-2310M system:
kernel-4.10.6-200.fc25.x86_64
openssl-1.0.2m-1.fc25.x86_64
sha1 was nearly twice as slow in the kernel for example,
compared to the libcrypto routines.
Further considerations why this should not be the default, at:
https://lists.gnu.org/r/coreutils/2018-06/msg00034.html
* m4/af_alg.m4: Require --with-linux-crypto to enable.
* m4/gl-openssl.m4: Tweak accordingly.
Pádraig Brady [Sun, 24 Jun 2018 08:46:10 +0000 (01:46 -0700)]
af_alg: avoid hangs when reading from streams
* lib/af_alg.c (afalg_stream): Don't assume EOF is sticky,
and thus avoid doing a fread() when feof() is set.
* lib/md5.c: Ensure feof() is called before fread().
* lib/sha1.c: Likewise.
* lib/sha256.c: Likewise.
* lib/sha512.c: Likewise.
Pádraig Brady [Sun, 24 Jun 2018 08:29:55 +0000 (01:29 -0700)]
af_alg: fix error handling when hash not returned
* lib/af_alg.c (afalg_stream): Handle the case where we've
successfully written data to the kernel in the read/write loop,
but the kernel doesn't respond with the hash.
Paul Eggert [Sun, 24 Jun 2018 15:50:36 +0000 (08:50 -0700)]
libc-config: merge from glibc
* lib/cdefs.h (__inline, __restrict):
Copy from current glibc. This fixes glibc bug 17721,
which Gnulib had already fixed in a different way.
(__nonnull): Lessen the distance from glibc by using the
glibc definition inside an ‘#ifndef __nonnull’.
(__attribute_nonstring__): New macro, copied from
current glibc.
* lib/libc-config.h (__attribute_nonstring__): New undef.
(__restrict): Remove; workaround no longer needed.
Keep the __inline workaround, though, as it uses HAVE___INLINE to
support more compilers than the glibc __inline can.
Paul Eggert [Thu, 21 Jun 2018 19:28:34 +0000 (12:28 -0700)]
random_r: do not crash if state is unaligned
Problem reported by Bruce Korb in:
https://lists.gnu.org/r/bug-gnulib/2018-06/msg00030.html
I reproduced the crash on 32-bit sparc with Oracle Studio 12.6
with 'cc -O2 -xmemalign=8s'.
* lib/random_r.c: Include string.h, for memcpy.
(get_int32, set_int32): New functions.
(__srandom_r, __initstate_r, __setstate_r, __random_r):
Use them to avoid assumption that state pointer is aligned.
(__random_r): Avoid integer overflow if INT_MAX == UINT32_MAX.
* tests/test-random_r.c (test_failed): New function.
(main): Use it, to test for alignment bugs.
Paul Eggert [Thu, 21 Jun 2018 18:25:02 +0000 (11:25 -0700)]
random, random_r: merge from glibc
* lib/random.c, lib/random_r.c:
Include libc-config.h if !_LIBC, not config.h unilaterally.
* lib/random.c:
Do not include stdint.h or time.h; not needed.
Include libc-lock.h if _LIBC, and define substitute macros otherwise.
(unsafe_state): Rename from generator. All uses changed.
Use C99-style initializers.
(__random, __srandom, __initstate, __setstate): Rename from
non-underscored version, but define it to non-underscored version
on Gnulib. Add a lock.
* lib/random_r.c (__srandom_r, __initstate_r, __setstate_r, __random_r):
Likewise.
Do not include <stdint.h>; not needed since stdlib.h defines int32_t.
(weak_alias, __set_errno) [!_LIBC]: Remove; now done by libc-config.
(__srandom_r): Use int32_t instead of long int where int32_t will do.
(__random_r): Use uint32 to fix glibc bug 17343.
* modules/random, modules/random_r (Depends-on): Add libc-config.
Depend on stdint only if $HAVE_RANDOM = 0.
Bruno Haible [Sun, 17 Jun 2018 21:12:54 +0000 (23:12 +0200)]
gettext po infrastructure: Update from current gettext git.
Reported by Akim Demaille <akim@lrde.epita.fr>.
* build-aux/po/Makefile.in.in: Update from current gettext git.
* build-aux/po/remove-potcdate.sin: Likewise.
* config/srclist.txt: Temporarily disable sync for these files.
Paul Eggert [Mon, 4 Jun 2018 01:02:10 +0000 (18:02 -0700)]
Port crypto/af_alg to GCC 4.8.4
Problem reported by Peter Simons in:
https://lists.gnu.org/r/bug-gnulib/2018-06/msg00002.html
* modules/crypto/af_alg (Depends-on): Add c99 if USE_AF_ALG.
Colin Watson [Sun, 27 May 2018 20:07:58 +0000 (22:07 +0200)]
bootstrap: allow non-submodule control of gnulib
Some projects prefer to avoid git submodules for various reasons (they
have rather strange UI), but at present they're the only way to pin a
particular gnulib commit. Add a couple of extra variables which can be
set in bootstrap.conf to control this separately.
* build-aux/bootstrap: Honour GNULIB_URL and GNULIB_REVISION in
bootstrap.conf when fetching gnulib using "git clone" or via
GNULIB_SRCDIR.
Paul Eggert [Mon, 21 May 2018 17:32:25 +0000 (10:32 -0700)]
crypto: omit stream ops Emacs doesn’t need
* lib/md5.c (md5_stream):
* lib/sha1.c (sha1_stream):
* lib/sha256.c (shaxxx_stream, sha256_stream, sha224_stream):
* lib/sha512.c (shaxxx_stream, sha512_stream, sha384_stream):
Compile stream functions only if GL_COMPILE_CRYPTO_STREAM is
defined. Emacs needs this, as it does not use the stream
operations and doesn’t need all the af_alg stuff we’ve recently
added. Perhaps a similar change is needed to the other crypto
modules, but this patch changes only those needed for Emacs.
* modules/crypto/md5-buffer, modules/crypto/sha1-buffer:
* modules/crypto/sha256-buffer, modules/crypto/sha512-buffer:
New modules, used by Emacs.
* modules/crypto/md5, modules/crypto/sha1, modules/crypto/sha256:
* modules/crypto/sha512: Rewrite to depend on the new modules.
Pádraig Brady [Mon, 14 May 2018 01:42:37 +0000 (18:42 -0700)]
fts: avoid a memory leak edge case
* lib/fts.c (fts_open): Set an appropriate fts_level
so that an immediate fts_close() will free the allocation.
* tests/test-fts.c (fts_dealloc): Add a test case which
will trigger under valgrind or address sanitizer.
Fixes https://bugs.gnu.org/31439
Bruno Haible [Sun, 20 May 2018 10:59:01 +0000 (12:59 +0200)]
localcharset: Optimize.
* lib/localcharset.c (alias_table): Comment out no-op mappings for
platforms where these don't matter. This reduces the table size,
which in turn reduces the lookup time.