]> Savannah Git Hosting - gnulib.git/log
gnulib.git
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.

6 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.

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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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>.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

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

6 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.

6 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.

6 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.

6 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().

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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

7 years agoaf_alg: Improve comments.
Bruno Haible [Sun, 6 May 2018 00:39:38 +0000 (02:39 +0200)]
af_alg: Improve comments.

* lib/af_alg.c (afalg_stream): Improve comment about kernel bug.

7 years agoaf_alg: New module.
Bruno Haible [Sat, 5 May 2018 18:27:33 +0000 (20:27 +0200)]
af_alg: New module.

* lib/af_alg.h: Test HAVE_* macro through '#if', not '#ifdef'.
* lib/af_alg.c: Include "af_alg.h" before the other header files.
* lib/md5.c: Include "af_alg.h" unconditionally.
(md5_stream): Invoke afalg_stream unconditionally.
* lib/sha1.c: Include "af_alg.h" unconditionally.
(sha1_stream): Invoke afalg_stream unconditionally.
* lib/sha256.c: Include "af_alg.h" unconditionally.
(sha256_stream, sha224_stream): Invoke afalg_stream unconditionally.
* lib/sha512.c: Include "af_alg.h" unconditionally.
(sha512_stream, sha384_stream): Invoke afalg_stream unconditionally.
* m4/af_alg.m4: Renamed from m4/linux-if-alg.m4.
(gl_AF_ALG): Renamed from gl_LINUX_IF_ALG_H.
* modules/crypto/af_alg: New file.
* modules/crypto/md5 (Files): Remove files that are now in the
'crypto/af_alg' module.
(Depends-on): Add crypto/af_alg.
(configure.ac): Remove gl_LINUX_IF_ALG_H invocation.
(Makefile.am): Don't mention af_alg.c here.
* modules/crypto/sha1 (Files): Remove files that are now in the
'crypto/af_alg' module.
(Depends-on): Add crypto/af_alg.
(configure.ac): Remove gl_LINUX_IF_ALG_H invocation.
(Makefile.am): Don't mention af_alg.c here.
* modules/crypto/sha256 (Files): Remove files that are now in the
'crypto/af_alg' module.
(Depends-on): Add crypto/af_alg.
(configure.ac): Remove gl_LINUX_IF_ALG_H invocation.
(Makefile.am): Don't mention af_alg.c here.
* modules/crypto/sha512 (Files): Remove files that are now in the
'crypto/af_alg' module.
(Depends-on): Add crypto/af_alg.
(configure.ac): Remove gl_LINUX_IF_ALG_H invocation.
(Makefile.am): Don't mention af_alg.c here.

7 years agoFix order of most recent ChangeLog entries.
Bruno Haible [Sat, 5 May 2018 18:32:55 +0000 (20:32 +0200)]
Fix order of most recent ChangeLog entries.

7 years agocrypto tests: pacify GCC
Paul Eggert [Sat, 5 May 2018 18:08:08 +0000 (11:08 -0700)]
crypto tests: pacify GCC

* tests/test-digest.h (test_digest_on_files):
Don’t assume digest size fits in int (!).

7 years agoaf_alg: minor style improvements
Paul Eggert [Sat, 5 May 2018 18:08:08 +0000 (11:08 -0700)]
af_alg: minor style improvements

* lib/af_alg.c (afalg_stream): Prefer C99 style
decl-after-statement, since we’re already assuming C99.  Clarify
by strengthening the bind test and omit unnecessary assignment.

7 years agoaf_alg: Fix bug on empty files.
Bruno Haible [Sat, 5 May 2018 18:02:58 +0000 (20:02 +0200)]
af_alg: Fix bug on empty files.

* lib/af_alg.c (afalg_stream): Ignore the kernel's result if the input
stream is empty.

7 years agosys-limits.h: new file for crypto and safe I/O
Paul Eggert [Sat, 5 May 2018 17:27:38 +0000 (10:27 -0700)]
sys-limits.h: new file for crypto and safe I/O

* lib/af_alg.c: Include sys-limits.h.
(MAX_RW_COUNT): Remove.  Use replaced by SYS_BUFSIZE_MAX.
(afalg_stream): Also reject negative sizes for sendfile; they
should not happen and the code is a bit cleaner and faster this way.
* lib/safe-read.c: Include sys-limits.h.
(BUGGY_READ_MAXIMUM): Remove.  All uses replaced by SYS_BUFSIZE_MAX.
* lib/sys-limits.h: New file, with values and commentary derived
from the old safe-read.c and from GNU Emacs sysdep.c.
* modules/crypto/md5, modules/crypto/sha1, modules/crypto/sha256:
* modules/crypto/sha512, modules/safe-read, modules/safe-write:
Add lib/sys-limits.h to Files section.

7 years agoaf_alg: Improve function signature.
Bruno Haible [Sat, 5 May 2018 16:13:16 +0000 (18:13 +0200)]
af_alg: Improve function signature.

* lib/af_alg.h (afalg_stream): Swap second and third argument.
* lib/af_alg.c (afalg_stream): Likewise.
* lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c: Callers changed.

7 years agocrypto/{md5,sha1,sha256,sha512}: Fix compilation error (S_TYPEISTMO).
Bruno Haible [Sat, 5 May 2018 16:09:40 +0000 (18:09 +0200)]
crypto/{md5,sha1,sha256,sha512}: Fix compilation error (S_TYPEISTMO).

* modules/crypto/md5 (Depends-on): Add '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}: Fix module description.
Bruno Haible [Sat, 5 May 2018 16:04:43 +0000 (18:04 +0200)]
crypto/{md5,sha1,sha256,sha512}: Fix module description.

* modules/crypto/md5 (Depends-on): Add 'sys_socket'.
* modules/crypto/sha1 (Depends-on): Likewise.
* modules/crypto/sha256 (Depends-on): Likewise.
* modules/crypto/sha512 (Depends-on): Likewise.

7 years agoaf_alg: Add documentation.
Bruno Haible [Sat, 5 May 2018 15:50:51 +0000 (17:50 +0200)]
af_alg: Add documentation.

* lib/af_alg.h: Add comments.

7 years agosha512: Add tests.
Bruno Haible [Sat, 5 May 2018 15:42:46 +0000 (17:42 +0200)]
sha512: Add tests.

* tests/test-sha512.c: New file.
* modules/crypto/sha512-tests: New file.

7 years agosha256: Add tests.
Bruno Haible [Sat, 5 May 2018 15:41:35 +0000 (17:41 +0200)]
sha256: Add tests.

* tests/test-sha256.c: New file.
* modules/crypto/sha256-tests: New file.

7 years agosha1 tests: Add test for sha1_stream.
Bruno Haible [Sat, 5 May 2018 15:39:57 +0000 (17:39 +0200)]
sha1 tests: Add test for sha1_stream.

* tests/test-sha1.c: Include test-digest.h.
(main): Invoke test_digest_on_files on 'sha1_stream'.
* modules/crypto/sha1-tests (Files): Add tests/test-digest.h.

7 years agomd5 tests: Add test for md5_stream.
Bruno Haible [Sat, 5 May 2018 15:38:39 +0000 (17:38 +0200)]
md5 tests: Add test for md5_stream.

* tests/test-digest.h: New file.
* tests/test-md5.c: Include test-digest.h.
(main): Invoke test_digest_on_files on 'md5_stream'.
* modules/crypto/md5-tests (Files): Add tests/test-digest.h.

7 years agoautoupdate
Karl Berry [Sat, 5 May 2018 15:18:49 +0000 (08:18 -0700)]
autoupdate

7 years agomd5sum: use kernel crypto API
Matteo Croce [Sat, 28 Apr 2018 13:32:58 +0000 (15:32 +0200)]
md5sum: use kernel crypto API

Use AF_ALG for md5 too

Signed-off-by: Matteo Croce <mcroce@redhat.com>
7 years agosha512sum: use kernel crypto API
Matteo Croce [Sat, 28 Apr 2018 13:32:57 +0000 (15:32 +0200)]
sha512sum: use kernel crypto API

Use AF_ALG for sha384 and sha512 too

Signed-off-by: Matteo Croce <mcroce@redhat.com>
7 years agosha256sum: use kernel crypto API
Matteo Croce [Sat, 28 Apr 2018 13:32:56 +0000 (15:32 +0200)]
sha256sum: use kernel crypto API

Use AF_ALG for sha224 and sha256 too

Signed-off-by: Matteo Croce <mcroce@redhat.com>
7 years agosha1sum: use AF_ALG when available
Matteo Croce [Sat, 28 Apr 2018 13:32:55 +0000 (15:32 +0200)]
sha1sum: use AF_ALG when available

Linux supports accessing kernel crypto API via AF_ALG since
version 2.6.38. Coreutils uses libcrypto when available and fallbacks to
generic C implementation of various hashing functions.

Add a generic afalg_stream() function which uses AF_ALG to calculate the
hash of a stream and use sendfile() when possible (regular file with size
less or equal than 0x7ffff000 (2,147,479,552) bytes, AKA MAX_RW_COUNT).

Use afalg_stream() only in sha1sum for now, but other hashes are possible.
The speed gain really depends on the CPU type, on systems which doesn't use
libcrypto ranges from ~10% to 320%.

This is a test on a Intel(R) Xeon(R) CPU E3-1265L V2 and Debian stretch:

    $ truncate -s 2GB 2g.bin
    $ time sha1sum 2g.bin
    752ef2367f479e79e4f0cded9c270c2890506ab0  2g.bin

    real    0m4.829s
    user    0m4.437s
    sys     0m0.391s
    $ time ./sha1sum-afalg 2g.bin
    752ef2367f479e79e4f0cded9c270c2890506ab0  2g.bin

    real    0m3.164s
    user    0m0.000s
    sys     0m3.162s

Signed-off-by: Matteo Croce <mcroce@redhat.com>
7 years agoall: Replace more http URLs by https URLs.
Bruno Haible [Sat, 5 May 2018 10:23:02 +0000 (12:23 +0200)]
all: Replace more http URLs by https URLs.

* lib/localename.c: Use https: URL.
* lib/timespec.h: Likewise.

7 years agomaint: port more modules to GCC 8
Paul Eggert [Fri, 4 May 2018 00:38:50 +0000 (17:38 -0700)]
maint: port more modules to GCC 8

* lib/dirname.h (base_name):
* lib/exclude.h (new_exclude):
* lib/xstrndup.h (xstrndup):
Add malloc attribute.
* lib/readutmp.c: Pacify GCC 8 about safe use of strncpy.
* lib/sig-handler.h (get_handler) [SA_SIGINFO]: Simplify.
This pacifies GCC 8.
* m4/gnulib-common.m4 (gl_COMMON_BODY):
Define _GL_ATTRIBUTE_MALLOC here.  All other definitions removed.