]> Savannah Git Hosting - gnulib.git/log
gnulib.git
6 years agoparse-datetime.y: avoid spurious GCC 9 warning
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'

6 years agocanon-host.c: avoid spurious GCC 9 warning
Jim Meyering [Sun, 24 Jun 2018 18:51:48 +0000 (11:51 -0700)]
canon-host.c: avoid spurious GCC 9 warning

* lib/canon-host.c: Suppress GCC9's -Wsuggest-attribute=malloc.

6 years agomanywarnings: accommodate GCC 9.0-pre: remove -Wchkp and -Wabi
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

6 years agoaf_alg tests: Add another test.
Bruno Haible [Sun, 24 Jun 2018 23:02:39 +0000 (01:02 +0200)]
af_alg tests: Add another test.

* tests/test-digest.h (test_digest_on_files): Also check a large file
with a skipped header.
* tests/test-md5.c: Include macros.h.
* tests/test-sha1.c: Likewise.
* tests/test-sha256.c: Likewise.
* tests/test-sha512.c: Likewise.
* modules/crypto/md5-tests (Files): Add tests/macros.h.
* modules/crypto/sha1-tests (Files): Likewise.
* modules/crypto/sha256-tests (Files): Likewise.
* modules/crypto/sha512-tests (Files): Likewise.

6 years agomaint: clarify comments about sticky EOF
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.

6 years agoaf_alg: Comment and style improvements.
Bruno Haible [Sun, 24 Jun 2018 22:25:31 +0000 (00:25 +0200)]
af_alg: Comment and style improvements.

* lib/af_alg.c (alg_socket): Use 'size_t' as index into a string.
(afalg_buffer, afalg_stream): Improve comments.

6 years agoFix order of most recent ChangeLog entries.
Bruno Haible [Sun, 24 Jun 2018 21:38:32 +0000 (23:38 +0200)]
Fix order of most recent ChangeLog entries.

6 years agoaf_alg: disable kernel hash functions by default
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.

6 years agoaf_alg: avoid hangs when reading from streams
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.

6 years agoaf_alg: fix error handling when hash not returned
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.

6 years agolibc-config: merge from glibc
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.

6 years agombrtowc, wcwidth: Fix MT-safety bug (regression from 2018-06-23).
Bruno Haible [Sun, 24 Jun 2018 14:19:31 +0000 (16:19 +0200)]
mbrtowc, wcwidth: Fix MT-safety bug (regression from 2018-06-23).

* lib/mbrtowc.c (enc_t): New enum type.
(locale_enc, locale_enc_cached): New functions.
(mbrtowc): Eliminate static variables. Use locale_enc_cached instead.
* lib/wcwidth.c (is_locale_utf8, is_locale_utf8_cached): New functions.
(wcwidth): Eliminate static variables. Use is_locale_utf8_cached
instead.
* m4/mbrtowc.m4 (gl_PREREQ_MBRTOWC): Require AC_C_INLINE.
* m4/wcwidth.m4 (gl_PREREQ_WCWIDTH): New macro.
* modules/wcwidth (configure.ac): Invoke it.

6 years agowchar-single: Fix test failure in wcwidth tests.
Bruno Haible [Sun, 24 Jun 2018 14:10:16 +0000 (16:10 +0200)]
wchar-single: Fix test failure in wcwidth tests.

* tests/test-wcwidth.c (main): If the wchar-single module is present,
skip the tests in the C locale.

6 years agocrypto: mention --without-linux-crypto in --with-openssl --help
Pádraig Brady [Sun, 24 Jun 2018 04:02:36 +0000 (21:02 -0700)]
crypto: mention --without-linux-crypto in --with-openssl --help

* m4/gl-openssl.m4 (gl_CRYPTO_CHECK): Mention that linux crypto
routines take precedence in --with-openssl help output.

6 years agowchar-single: a new module to enable optimizations in wchar replacements
Pádraig Brady [Mon, 21 May 2018 05:11:12 +0000 (22:11 -0700)]
wchar-single: a new module to enable optimizations in wchar replacements

* lib/mbrtowc.c (mbrtowc): Only check locale_charset() once if
GNULIB_WCHAR_SINGLE is enabled.
* lib/wcwidth.c (wcwidth): Likewise.

6 years agolibc-config: Fix conflict with FreeBSD include files.
Bruno Haible [Sat, 23 Jun 2018 12:43:56 +0000 (14:43 +0200)]
libc-config: Fix conflict with FreeBSD include files.

* lib/cdefs.h (__nonnull): Remove definition.
* lib/libc-config.h (__nonnull): Remove undefinition.

6 years agorandom_r: do not crash if state is unaligned
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.

6 years agorandom_r: omit unnecessary include
Paul Eggert [Thu, 21 Jun 2018 18:25:53 +0000 (11:25 -0700)]
random_r: omit unnecessary include

* lib/random_r.c: Do not include limits.h.

6 years agorandom, random_r: merge from glibc
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.

6 years agoREADME-release: also run any check-very-expensive tests
Jim Meyering [Tue, 19 Jun 2018 22:47:53 +0000 (15:47 -0700)]
README-release: also run any check-very-expensive tests

* top/README-release: Adjust instructions so they run the
check-very-expensive tests when there is such a target.

6 years agotypo
Karl Berry [Tue, 19 Jun 2018 15:58:15 +0000 (08:58 -0700)]
typo

6 years agopthread_rwlock_rdlock: Add comments regarding glibc behaviour.
Bruno Haible [Mon, 18 Jun 2018 16:16:34 +0000 (18:16 +0200)]
pthread_rwlock_rdlock: Add comments regarding glibc behaviour.

* m4/pthread_rwlock_rdlock.m4: Add comment.
* doc/posix-functions/pthread_rwlock_rdlock.texi: Mention that rwlocks
are reader-preferring in glibc.
* doc/posix-functions/pthread_rwlock_tryrdlock.texi: Likwise.
* doc/posix-functions/pthread_rwlock_timedrdlock.texi: Likewise.

6 years agocrypto: use byteswap
Paul Eggert [Sun, 17 Jun 2018 21:35:37 +0000 (14:35 -0700)]
crypto: use byteswap

* lib/md4.c, lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c:
* lib/sm3.c: Include <byteswap.h>.
(SWAP): Use its macros rather than reinventing the wheel.
* modules/crypto/md4, modules/crypto/md5-buffer:
* modules/crypto/sha1-buffer, modules/crypto/sha256-buffer:
* modules/crypto/sha512-buffer, modules/crypto/sm3:
(Depends-on): Add byteswap.

6 years agogendocs.sh: fix support for legacy --texi2html
Pádraig Brady [Sun, 17 Jun 2018 21:26:28 +0000 (14:26 -0700)]
gendocs.sh: fix support for legacy --texi2html

* build-aux/gendocs.sh: Restrict use of TOP_NODE_UP_URL
to the default makeinfo invocation.
Reported by Bruce Korb

6 years agogettext po infrastructure: Update from current gettext git.
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.

6 years agogetloadavg: Return 0 on Windows without Cygwin.
Bruno Haible [Sun, 17 Jun 2018 20:29:54 +0000 (22:29 +0200)]
getloadavg: Return 0 on Windows without Cygwin.

* lib/getloadavg.c: Don't assume that the symbol WINDOWS32 is defined.

6 years agogetloadavg: Allow building on Windows without Cygwin
Paul Smith [Sun, 17 Jun 2018 18:22:18 +0000 (11:22 -0700)]
getloadavg: Allow building on Windows without Cygwin

* lib/getloadavg.c: Reinstate ifdef for HAVE_UNISTD_H.
* m4/getloadavg.m4: Check for unistd.h.

6 years agoPort crypto/af_alg to GCC 4.8.4
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.

6 years agoautoupdate
Karl Berry [Sun, 3 Jun 2018 15:42:45 +0000 (08:42 -0700)]
autoupdate

6 years agobootstrap: document source fetching in --help
Colin Watson [Sun, 27 May 2018 20:13:41 +0000 (22:13 +0200)]
bootstrap: document source fetching in --help

There are many possibilities for how Gnulib sources are fetched, and
they're rather hard to figure out without reading the code.

* build-aux/bootstrap (usage): Document how Gnulib sources are fetched.

6 years agobootstrap: allow non-submodule control of gnulib
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.

6 years agoautoupdate
Karl Berry [Thu, 24 May 2018 15:46:18 +0000 (08:46 -0700)]
autoupdate

6 years agoautoupdate
Karl Berry [Wed, 23 May 2018 17:15:24 +0000 (10:15 -0700)]
autoupdate

6 years agocrypto: omit stream ops Emacs doesn’t need
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.

6 years agofts: avoid a memory leak edge case
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

6 years agowcwidth tests: Fix link error.
Bruno Haible [Mon, 21 May 2018 00:42:01 +0000 (02:42 +0200)]
wcwidth tests: Fix link error.

* modules/wcwidth-tests (Makefile.am): Link test-wcwidth against
$(LIBUNISTRING).

6 years agoautoupdate
Karl Berry [Sun, 20 May 2018 13:49:39 +0000 (06:49 -0700)]
autoupdate

6 years agoregex: Fix "error: possibly undefined macro: gl_GLIBC21".
Bruno Haible [Sun, 20 May 2018 12:02:19 +0000 (14:02 +0200)]
regex: Fix "error: possibly undefined macro: gl_GLIBC21".

* modules/regex (Files): Add m4/glibc21.m4.

6 years agolocalcharset: Optimize.
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.

6 years agolocalcharset: Map the locale encodings found in newer OSes.
Bruno Haible [Sat, 19 May 2018 23:37:22 +0000 (01:37 +0200)]
localcharset: Map the locale encodings found in newer OSes.

* lib/localcharset.c (alias_table): Add mapping for locale encodings
found in FreeBSD 11, NetBSD 7, Solaris 10, Openindiana, HP-UX 11.31,
IRIX 6.5, Minix 3.3.
* lib/localcharset.h: Update comments accordingly. Also for Cygwin 2.9.

6 years agolocalcharset: Move mapping tables into the code.
Bruno Haible [Sat, 19 May 2018 15:17:32 +0000 (17:17 +0200)]
localcharset: Move mapping tables into the code.

* lib/localcharset.h: Document the GNU canonical names for character
encodings here.
* lib/localcharset.c: Don't include <fcntl.h>, <unistd.h>,
relocatable.h, configmake.h.
(O_NOFOLLOW, ISSLASH, DIRECTORY_SEPARATOR, getc, volatile): Remove
macros.
(charset_aliases): Remove variable.
(get_charset_aliases): Remove function.
(struct table_entry): New type.
(alias_table, locale_table): New constants.
(locale_charset): Use the alias_table or locale_table to get the
canonicalized encoding name.
* lib/config.charset: Remove file.
* lib/ref-add.sin: Remove file.
* lib/ref-del.sin: Remove file.
* m4/localcharset.m4 (gl_LOCALCHARSET): Don't require gl_FCNTL_O_FLAGS,
AC_CANONICAL_HOST, gl_GLIBC21. Don't check for getc_unlocked.
* modules/localcharset (Notice): Remove.
(Files): Remove config.charset, ref-add.sin, ref-del.sin, fcntl-o.m4,
glibc21.m4.
(Depends-on): Remove configmake.
(configure.ac): Define LOCALCHARSET_TESTS_ENVIRONMENT to empty.
(Makefile.am): Simplify.
* build-aux/prefix-gnulib-mk: Remove special code for the removed files.

6 years agolocalcharset: Add a manual test.
Bruno Haible [Sat, 19 May 2018 15:07:34 +0000 (17:07 +0200)]
localcharset: Add a manual test.

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

6 years agolocalcharset: Remove support for obsolete platforms.
Bruno Haible [Sat, 19 May 2018 23:19:30 +0000 (01:19 +0200)]
localcharset: Remove support for obsolete platforms.

* lib/config.charset: Remove support for Linux/libc5, glibc-2.0.x, and
Mac OS X 10.2. Comment out dubious entry for Solaris.

6 years agognupload: adjust comment
Jim Meyering [Sat, 19 May 2018 19:01:06 +0000 (12:01 -0700)]
gnupload: adjust comment

* build-aux/gnupload: Add FIXME-2020 comment, to make it slightly
more likely we'll remove the just-added code in a year or two.

6 years agoautoupdate
Karl Berry [Sat, 19 May 2018 14:08:12 +0000 (07:08 -0700)]
autoupdate

6 years agognupload: Fix "gpg-agent is not available in this session" error.
Bruno Haible [Sat, 19 May 2018 11:00:16 +0000 (13:00 +0200)]
gnupload: Fix "gpg-agent is not available in this session" error.

* build-aux/gnupload (GPG): Pick the right GNUPG executable to use.

7 years agocrypto/af_alg: fix --help
Paul Eggert [Wed, 16 May 2018 19:02:41 +0000 (12:02 -0700)]
crypto/af_alg: fix --help

* m4/af_alg.m4: Avoid spurious newline in --help output.

7 years agoautoupdate
Karl Berry [Mon, 14 May 2018 14:54:47 +0000 (07:54 -0700)]
autoupdate

7 years agonl_langinfo: Fix compilation error on Android.
Bruno Haible [Mon, 14 May 2018 01:02:29 +0000 (03:02 +0200)]
nl_langinfo: Fix compilation error on Android.

* lib/nl_langinfo.c (nl_langinfo): Define values for the items GROUPING,
INT_CURR_SYMBOL, etc. only if these items are defined.

7 years agotruncate: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 23:48:22 +0000 (01:48 +0200)]
truncate: Fix compilation error on Android.

* m4/truncate.m4 (gl_FUNC_TRUNCATE): Test also whether 'truncate' is
declared. Set HAVE_DECL_TRUNCATE, not HAVE_TRUNCATE.
* lib/unistd.in.h (truncate): Test HAVE_DECL_TRUNCATE, not
HAVE_TRUNCATE.
* modules/truncate: Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_DECL_TRUNCATE,
not HAVE_TRUNCATE.
* modules/unistd (Makefile.am): Substitute HAVE_DECL_TRUNCATE, not
HAVE_TRUNCATE.
* doc/posix-functions/truncate.texi: Mention the issue.

7 years agopthread: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 23:02:02 +0000 (01:02 +0200)]
pthread: Fix compilation error on Android.

* lib/pthread.in.h: Use _GL_ALREADY_INCLUDING_PTHREAD_H to shortcut
recursive inclusion of this file.

7 years agoposix_spawn: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 22:27:43 +0000 (00:27 +0200)]
posix_spawn: Fix compilation error on Android.

* lib/spawn.in.h (posix_spawnattr_t): Consider also the case
HAVE_POSIX_SPAWNATTR_T = 1 && HAVE_POSIX_SPAWN = 0.
(posix_spawn_file_actions_t): Consider also the case
HAVE_POSIX_SPAWN_FILE_ACTIONS_T = 1 && HAVE_POSIX_SPAWN = 0.

7 years agotsearch: Move from K&R C to ANSI C.
Bruno Haible [Sun, 13 May 2018 22:04:54 +0000 (00:04 +0200)]
tsearch: Move from K&R C to ANSI C.

* lib/tsearch.c (tfind): Convert definition to ANSI C.

7 years agotsearch: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 22:02:48 +0000 (00:02 +0200)]
tsearch: Fix compilation error on Android.

* lib/search.in.h (twalk): Declare when HAVE_TWALK, not HAVE_TSEARCH,
is 0.
(GNULIB_defined_tsearch, GNULIB_defined_twalk): New macros.
* lib/tsearch.c (tsearch, tfind, tdelete): Define only if
GNULIB_defined_tsearch is true.
(twalk): Define only if GNULIB_defined_twalk is true.
* modules/tsearch (configure.ac): Compile tsearch.c also if HAVE_TWALK
is 0.
* m4/tsearch.m4 (gl_FUNC_TSEARCH): Set HAVE_TWALK.
* m4/search_h.m4 (gl_SEARCH_H_DEFAULTS): Initialize HAVE_TWALK.
* modules/search (Makefile.am): Substitute HAVE_TWALK.

7 years agoimaxdiv: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 21:23:47 +0000 (23:23 +0200)]
imaxdiv: Fix compilation error on Android.

* m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Set HAVE_IMAXDIV_T to 0 if imaxdiv_t
is not defined.
* lib/inttypes.in.h (imaxdiv_t): Define if HAVE_IMAXDIV_T, not
HAVE_DECL_IMAXDIV, is 0.
* m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Initialize HAVE_IMAXDIV_T.
* modules/inttypes-incomplete (Makefile.am): Substitute HAVE_IMAXDIV_T.

7 years agoSupport selective inclusion mechanism of recent mingw.org header files.
Bruno Haible [Sun, 13 May 2018 20:20:13 +0000 (22:20 +0200)]
Support selective inclusion mechanism of recent mingw.org header files.

Reported by Eli Zaretskii <eliz@gnu.org>.

* lib/sys_types.in.h: On mingw, when __need_off_t, __need___off64_t,
__need_ssize_t, or __need_time_t is defined, just include the system's
<sys/types.h>.
* lib/locale.in.h: On mingw, when __need_locale_t is defined, just
include the system's <locale.h>.

7 years agoAvoid compilation error due to 'mmap' on Android.
Bruno Haible [Sun, 13 May 2018 19:33:48 +0000 (21:33 +0200)]
Avoid compilation error due to 'mmap' on Android.

* lib/vma-iter.c (_FILE_OFFSET_BITS): Undefine on Android.
* lib/get-rusage-as.c (_FILE_OFFSET_BITS): Likewise.
* tests/zerosize-ptr.h (_FILE_OFFSET_BITS, __USE_FILE_OFFSET64):
Undefine on Android.

7 years agoAdd cross-compilation guesses for Linux systems without glibc.
Bruno Haible [Sun, 13 May 2018 18:25:13 +0000 (20:25 +0200)]
Add cross-compilation guesses for Linux systems without glibc.

* m4/chown.m4 (AC_FUNC_CHOWN): Add cross-compilation guess for Linux.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Likewise.
* m4/link.m4 (gl_FUNC_LINK): Likewise.
* m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
* m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Likewise.
* m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise.
* m4/mkfifo.m4 (gl_FUNC_MKFIFO): Likewise.
* m4/mknod.m4 (gl_FUNC_MKNOD): Likewise.
* m4/pselect.m4 (gl_FUNC_PSELECT): Likewise.
* m4/readlink.m4 (gl_FUNC_READLINK): Likewise.
* m4/rename.m4 (gl_FUNC_RENAME): Likewise.
* m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
* m4/select.m4 (gl_FUNC_SELECT): Likewise.
* m4/stat.m4 (gl_FUNC_STAT): Likewise.
* m4/symlink.m4 (gl_FUNC_SYMLINK): Likewise.
* m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Likewise.
* m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
* m4/utimens.m4 (gl_UTIMENS): Likewise.

7 years agogetpagesize: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 16:28:35 +0000 (18:28 +0200)]
getpagesize: Fix compilation error on Android.

* m4/getpagesize.m4 (gl_CHECK_FUNC_GETPAGESIZE): New macro.
(gl_FUNC_GETPAGESIZE): Invoke it instead of AC_CHECK_FUNC.
* m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Don't invoke
AC_CHECK_FUNC. Instead, invoke gl_CHECK_FUNC_GETPAGESIZE and define
HAVE_GETPAGESIZE accordingly.
* modules/getcwd (Files): Add m4/getpagesize.m4.

7 years agotcgetsid: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 14:45:11 +0000 (16:45 +0200)]
tcgetsid: Fix compilation error on Android.

* m4/tcgetsid.m4 (gl_FUNC_TCGETSID): Use AC_LINK_IFELSE instead of
AC_CHECK_FUNC.

7 years agogetpass: Fix configure test for Android.
Bruno Haible [Sun, 13 May 2018 14:25:20 +0000 (16:25 +0200)]
getpass: Fix configure test for Android.

* m4/getpass.m4 (gl_PREREQ_GETPASS): Use AC_LINK_IFELSE instead of
AC_CHECK_FUNC.

7 years agoffs: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 14:13:27 +0000 (16:13 +0200)]
ffs: Fix compilation error on Android.

* m4/ffs.m4 (gl_FUNC_FFS): Use AC_LINK_IFELSE instead of AC_CHECK_FUNC.

7 years agomkfifo: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 14:08:56 +0000 (16:08 +0200)]
mkfifo: Fix compilation error on Android.

* m4/mkfifo.m4 (gl_FUNC_MKFIFO): Use AC_LINK_IFELSE instead of
AC_CHECK_FUNC.

7 years agoc-strtod: Fix configure test for Android.
Bruno Haible [Sun, 13 May 2018 14:03:03 +0000 (16:03 +0200)]
c-strtod: Fix configure test for Android.

* m4/c-strtod.m4 (gl_C_STRTOD): Use AC_LINK_IFELSE instead of
AC_CHECK_FUNC.

7 years agorandom: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 13:49:40 +0000 (15:49 +0200)]
random: Fix compilation error on Android.

* m4/random.m4 (gl_FUNC_RANDOM): Use AC_LINK_IFELSE instead of
AC_CHECK_FUNC.

7 years agograntpt: Fix compilation error on Android.
Bruno Haible [Sun, 13 May 2018 13:31:48 +0000 (15:31 +0200)]
grantpt: Fix compilation error on Android.

* m4/grantpt.m4 (gl_FUNC_GRANTPT): Use AC_LINK_IFELSE instead of
AC_CHECK_FUNC.

7 years agostdioext: Fix compilation errors with newer Android headers.
Bruno Haible [Sat, 12 May 2018 18:58:58 +0000 (20:58 +0200)]
stdioext: Fix compilation errors with newer Android headers.

* lib/stdio-impl.h (fp_, fp_ub): Define differently for Android.
(__SLBF, __SNBF, __SRD, __SWR, __SRW, __SEOF, __SERR, __SOFF): Define
fallbacks for Android.
* lib/fpending.c: Update comments.
* lib/fpurge.c: Likewise.
* lib/freadable.h: Likewise.
* lib/freadable.c: Likewise.
* lib/freadahead.c: Likewise.
* lib/freading.h: Likewise.
* lib/freadptr.c: Likewise.
* lib/fseterr.c: Likewise.
* lib/fwritable.h: Likewise.
* lib/fwritable.c: Likewise.
* lib/fwriting.h: Likewise.
* lib/fwriting.c: Likewise.

7 years agodoc: Add info about Android versions 2.0 to 8.1.
Bruno Haible [Sun, 13 May 2018 11:44:57 +0000 (13:44 +0200)]
doc: Add info about Android versions 2.0 to 8.1.

* doc/**/*.texi: Add info about functions in all released versions of
Bionic.

7 years agoautoupdate
Karl Berry [Sat, 12 May 2018 20:31:23 +0000 (13:31 -0700)]
autoupdate

7 years agofseeko: On mingw, don't use the hidden function _fseeki64.
Bruno Haible [Sat, 12 May 2018 18:37:47 +0000 (20:37 +0200)]
fseeko: On mingw, don't use the hidden function _fseeki64.

Reported by Eli Zaretskii <eliz@gnu.org>.

* m4/fseeko.m4 (gl_PREREQ_FSEEKO): Test whether _fseeki64 is declared.
* lib/fseeko.c (fseeko): Use _fseeki64 only if it is declared.

7 years agoglob: Choose 'dirent_type' in a way that works better on mingw.
Bruno Haible [Sat, 12 May 2018 15:12:33 +0000 (17:12 +0200)]
glob: Choose 'dirent_type' in a way that works better on mingw.

Reported and suggested by Eli Zaretskii <eliz@gnu.org>.

* lib/glob.c (dirent_type): Define as uint_fast32_t.

7 years agoexecute, spawn-pipe: Avoid warning about redefining 'close'.
Bruno Haible [Sat, 12 May 2018 11:32:52 +0000 (13:32 +0200)]
execute, spawn-pipe: Avoid warning about redefining 'close'.

Reported by Eli Zaretskii <eliz@gnu.org>.

* lib/execute.c: Undefine 'close' before redefining it.
* lib/spawn-pipe.c: Likewise.

7 years agonanosleep: Avoid test failure on mingw when it has nanosleep.
Bruno Haible [Sat, 12 May 2018 11:27:04 +0000 (13:27 +0200)]
nanosleep: Avoid test failure on mingw when it has nanosleep.

Reported by Eli Zaretskii <eliz@gnu.org>.

* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Check whether alarm() exists.
If it does not exist, use a simpler test program that does not call
alarm().

7 years agoautoupdate
Karl Berry [Fri, 11 May 2018 14:39:50 +0000 (07:39 -0700)]
autoupdate

7 years agolock, cond, thread, tls: Use a different symbol as libpthread witness.
Bruno Haible [Fri, 11 May 2018 00:07:00 +0000 (02:07 +0200)]
lock, cond, thread, tls: Use a different symbol as libpthread witness.

Reported by Devin Hussey <husseydevin@gmail.com>.
Based on a patch by Paul Eggert.

* lib/glthread/lock.h (pthread_in_use): Use 'pthread_mutexattr_gettype'
as witness of libpthread.
* lib/glthread/cond.h (pthread_in_use): Likewise.
* lib/glthread/thread.h (pthread_in_use): Likewise.
* lib/glthread/tls.h (pthread_in_use): Likewise.

7 years agocond tests: Fix compilation error on Solaris.
Bruno Haible [Thu, 10 May 2018 22:36:14 +0000 (00:36 +0200)]
cond tests: Fix compilation error on Solaris.

* tests/test-cond.c: Include <unistd.h> before defining 'yield' as a
macro.

7 years agodoc: Add partial info about Android 4.3.
Bruno Haible [Thu, 10 May 2018 18:52:50 +0000 (20:52 +0200)]
doc: Add partial info about Android 4.3.

* doc/*-functions/*.texi: Add info about functions that were added
to Bionic between Android 4.3 and Android 9.0.

7 years agodoc: More tweaks for Android 9.0.
Bruno Haible [Thu, 10 May 2018 18:43:28 +0000 (20:43 +0200)]
doc: More tweaks for Android 9.0.

7 years agodoc: Add info about Android 9.0.
Bruno Haible [Thu, 10 May 2018 16:16:59 +0000 (18:16 +0200)]
doc: Add info about Android 9.0.

* doc/**/*.texi: Add info about functions and headers in Bionic from
Android 9.0.

7 years agopthread: document Android limits
Paul Eggert [Thu, 10 May 2018 07:59:12 +0000 (00:59 -0700)]
pthread: document Android limits

Problem reported by Devin Hussey in:
https://lists.gnu.org/r/bug-gnulib/2018-05/msg00062.html

7 years agoaf_alg: fix my typo in afalg_buffer
Paul Eggert [Thu, 10 May 2018 01:28:04 +0000 (18:28 -0700)]
af_alg: fix my typo in afalg_buffer

* lib/af_alg.c (afalg_buffer): Fix typo I recently introduced.
(afalg_stream): Simplify and avoid the need for a runtime test
at the end.

7 years agoaf_alg: recover better from crypto failures
Paul Eggert [Thu, 10 May 2018 01:07:29 +0000 (18:07 -0700)]
af_alg: recover better from crypto failures

* lib/af_alg.c (afalg_stream): Recover from crypto failures if the
input stream is seekable, by repositioning the stream back to
where it was, possibly by just calling sendfile with an offset
arg.  This lets us return -EAFNOSUPPORT instead of -EIO in some
cases, which lets our callers try again with user-mode code.
* modules/crypto/af_alg (Depends-on): Depend on fseeko and ftello
instead of on fflush and lseek.

7 years agoaf_alg: distiguish I/O errors better
Paul Eggert [Wed, 9 May 2018 19:04:37 +0000 (12:04 -0700)]
af_alg: distiguish I/O errors better

* lib/af_alg.c (afalg_buffer, afalg_stream): Return -EAFNOSUPPORT,
not -EIO, if it’s OK for the caller to try again with user-mode code.
(afalg_stream) [!_WIN32 || __CYGWIN__]: Return -EIO (not possibly
some other error number) if fflush fails, as the caller should not
try again that case.

7 years agoaf_alg: avoid gotos
Paul Eggert [Wed, 9 May 2018 18:53:03 +0000 (11:53 -0700)]
af_alg: avoid gotos

* lib/af_alg.c (afalg_buffer, afalg_stream): Rewrite to avoid
gotos, as they were a source of unreliability and made the code a
bit harder to follow.

7 years agoaf_alg: don’t leak file descriptors into children
Paul Eggert [Wed, 9 May 2018 18:34:28 +0000 (11:34 -0700)]
af_alg: don’t leak file descriptors into children

* lib/af_alg.c (alg_socket): Use SOCK_CLOEXEC when creating sockets.
This code should be compiled only on recent GNU/Linux platforms
so we shouldn’t have to also depend on the accept4 module.

7 years agoaf_alg: coalesce socket creation
Paul Eggert [Wed, 9 May 2018 18:16:59 +0000 (11:16 -0700)]
af_alg: coalesce socket creation

* lib/af_alg.c (alg_socket): New function.
(afalg_buffer, afalg_stream): Use it.  This avoids some
code duplication and gotos.

7 years agoaf_alg: fix file descriptor leak
Paul Eggert [Wed, 9 May 2018 18:05:12 +0000 (11:05 -0700)]
af_alg: fix file descriptor leak

* lib/af_alg.c (afalg_stream): Close leak.

7 years agoaf_alg: Pacify --enable-gcc-warnings on GCC 8
Paul Eggert [Wed, 9 May 2018 17:38:17 +0000 (10:38 -0700)]
af_alg: Pacify --enable-gcc-warnings on GCC 8

* lib/af_alg.c (afalg_buffer, afalg_stream): Reorder local decls
and checking to pacify gcc -Wjump-misses-init on GCC 8.

7 years agoaf_alg: Pacify --enable-gcc-warnings
Paul Eggert [Mon, 7 May 2018 07:25:57 +0000 (00:25 -0700)]
af_alg: Pacify --enable-gcc-warnings

Problem reported by Assaf Gordon in:
https://lists.gnu.org/r/bug-gnulib/2018-05/msg00041.html
* lib/af_alg.c (afalg_buffer): Move local decls to pacify
gcc -Wjump-misses-init.
* lib/sha512.c (shaxxx_stream): Now static.

7 years agoautoupdate
Karl Berry [Sun, 6 May 2018 16:05:42 +0000 (09:05 -0700)]
autoupdate

7 years agoaf_alg: Add ability to use Linux kernel crypto API on data in memory.
Bruno Haible [Sun, 6 May 2018 15:04:25 +0000 (17:04 +0200)]
af_alg: Add ability to use Linux kernel crypto API on data in memory.

* lib/af_alg.h (afalg_buffer): New declaration.
* lib/af_alg.c (afalg_buffer): New function.

7 years agoaf_alg: Avoid warnings.
Bruno Haible [Sun, 6 May 2018 15:00:56 +0000 (17:00 +0200)]
af_alg: Avoid warnings.

* lib/af_alg.h (afalg_stream): Mark fallback declaration as inline.
* m4/af_alg.m4 (gl_AF_ALG): Require AC_C_INLINE.

7 years agocrypto/{md5,sha1,sha256,sha512} tests: Add benchmarks.
Bruno Haible [Sun, 6 May 2018 14:46:57 +0000 (16:46 +0200)]
crypto/{md5,sha1,sha256,sha512} tests: Add benchmarks.

* tests/bench-digest.h: New file.
* tests/bench-md5.c: New file.
* tests/bench-sha1.c: New file.
* tests/bench-sha224.c: New file.
* tests/bench-sha256.c: New file.
* tests/bench-sha384.c: New file.
* tests/bench-sha512.c: New file.
* modules/crypto/md5-tests (Files): Add tests/bench-md5.c,
tests/bench-digest.h.
(Depends-on): Add getrusage, gettimeofday.
(Makefile.am): Add variables to build bench-md5.
* modules/crypto/sha1-tests (Files): Add tests/bench-sha1.c,
tests/bench-digest.h.
(Depends-on): Add getrusage, gettimeofday.
(Makefile.am): Add variables to build bench-sha1.
* modules/crypto/sha256-tests (Files): Add tests/bench-sha224.c,
tests/bench-sha256.c, tests/bench-digest.h.
(Depends-on): Add getrusage, gettimeofday.
(Makefile.am): Add variables to build bench-sha224, bench-sha256.
* modules/crypto/sha512-tests (Files): Add tests/bench-sha384.c,
tests/bench-sha512.c, tests/bench-digest.h.
(Depends-on): Add getrusage, gettimeofday.
(Makefile.am): Add variables to build bench-sha384, bench-sha512.

7 years agoaf_alg: Fix a resource leak.
Bruno Haible [Sun, 6 May 2018 13:19:44 +0000 (15:19 +0200)]
af_alg: Fix a resource leak.

* lib/af_alg.c (afalg_stream): Close socket before returning -EINVAL.
New local variable 'result'.

7 years agoaf_alg: Fix bug with streams that are not at position 0.
Bruno Haible [Sun, 6 May 2018 11:30:24 +0000 (13:30 +0200)]
af_alg: Fix bug with streams that are not at position 0.

* lib/af_alg.c (afalg_stream): Before sendfile, invoke fflush. Don't
assume that the stream is positioned at position 0.
* lib/af_alg.h (afalg_stream): Mention restriction regarding the state
of the stream.
* lib/md5.h (md5_stream): Likewise.
* lib/sha1.h (sha1_stream): Likewise.
* lib/sha256.h (sha256_stream, sha224_stream): Likewise.
* lib/sha512.h (sha512_stream, sha384_stream): Likewise.
* modules/crypto/af_alg (Depends-on): Add fflush, lseek.

7 years agocrypto/{md5,sha1,sha256,sha512} tests: Enhance test.
Bruno Haible [Sun, 6 May 2018 11:11:06 +0000 (13:11 +0200)]
crypto/{md5,sha1,sha256,sha512} tests: Enhance test.

* tests/test-digest.h (test_digest_on_files): Add a test with a FILE
stream that is not positioned at the beginning.

7 years agoaf_alg: Add configure option to enable/disable use of Linux crypto API.
Bruno Haible [Sun, 6 May 2018 10:23:55 +0000 (12:23 +0200)]
af_alg: Add configure option to enable/disable use of Linux crypto API.

Suggested by Assaf Gordon <assafgordon@gmail.com>.

* m4/af_alg.m4 (gl_AF_ALG): Add AC_ARG_WITH invocation. Define C macro
USE_LINUX_CRYPTO_API.
* lib/af_alg.h: Test USE_LINUX_CRYPTO_API, not HAVE_LINUX_IF_ALG_H.
* lib/af_alg.c: Likewise.

7 years agoFollowup to 'af_alg: New module.'.
Bruno Haible [Sun, 6 May 2018 09:55:55 +0000 (11:55 +0200)]
Followup to 'af_alg: New module.'.

* modules/crypto/md5 (Depends-on): Remove sys_socket, sys_stat.
* modules/crypto/sha1 (Depends-on): Likewise.
* modules/crypto/sha256 (Depends-on): Likewise.
* modules/crypto/sha512 (Depends-on): Likewise.

7 years agocrypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert [Sun, 6 May 2018 02:39:37 +0000 (19:39 -0700)]
crypto/{md5,sha1,sha256,sha512}: simplify

* lib/md5.c (md5_stream):
* lib/sha1.c (sha1_stream):
* lib/sha256.c (shaxxx_stream):
Simplify, partly by assuming C99.
* lib/sha256.c (shaxxx_stream):
New function, which implements both sha256 and sha224.
Simplify, partly by assuming C99.
(sha256_stream, sha224_stream):
Use it to avoid code duplication, removing a FIXME.
* lib/sha512.c (shaxxx_stream, sha512_stream, sha384_stream):
Likewise.

7 years agoaf_alg: Improve comments.
Paul Eggert [Sun, 6 May 2018 01:46:01 +0000 (18:46 -0700)]
af_alg: Improve comments.

* lib/af_alg.h: Use imperatives and tighten up wording.