]> Savannah Git Hosting - gnulib.git/log
gnulib.git
6 years agofts: remove FTS_NOATIME
Bernhard Voelker [Mon, 8 Oct 2018 23:45:36 +0000 (16:45 -0700)]
fts: remove FTS_NOATIME

This reverts commit da4d6974013c822af1498941e32db774b2031765.
We cannot guarantee that O_NOATIME works: e.g. openat fails
with EPERM if the effective user ID of the caller does not match
the owner of the file and the caller is not privileged.
Downstream findutils has never picked up FTS_NOATIME.  Discussed at
<https://lists.gnu.org/r/bug-gnulib/2018-09/msg00122.html>.
* lib/fts_.h (FTS_NOATIME): Remove bit flag.
(FTS_OPTIONMASK): Adjust.
* lib/fts.c (diropen, fts_open, fts_build): Likewise.
(fd_ring_check): Likewise.

6 years agocsharpcomp*, csharpexec*: Remove support for pnet.
Bruno Haible [Mon, 8 Oct 2018 23:44:07 +0000 (01:44 +0200)]
csharpcomp*, csharpexec*: Remove support for pnet.

* m4/csharpcomp.m4 (gt_CSHARPCOMP): Don't test for cscc. Don't set
HAVE_CSCC.
* build-aux/csharpcomp.sh.in (options_cscc): Remove variable.
Don't test HAVE_CSCC.
* lib/csharpcomp.c (compile_csharp_using_pnet): Remove function.
(compile_csharp_class): Don't invoke it.
* m4/csharpexec.m4 (gt_CSHARPEXEC): Don't test for ilrun. Don't set
HAVE_ILRUN.
* build-aux/csharpexec.sh.in (options_ilrun): Remove variable.
Don't test HAVE_ILRUN.
* lib/csharpexec.c (execute_csharp_using_pnet): Remove function.
(execute_csharp_program): Don't invoke it.
* m4/csharp.m4 (gt_CSHARP_CHOICE): Don't recognize --enable-csharp=pnet
any more.

6 years agoautoupdate
Paul Eggert [Mon, 8 Oct 2018 18:32:09 +0000 (11:32 -0700)]
autoupdate

6 years agorenameatu: prefer renameat2 to syscall
Andreas Henriksson [Sun, 7 Oct 2018 22:01:07 +0000 (15:01 -0700)]
renameatu: prefer renameat2 to syscall

* lib/renameatu.c (renameatu) [HAVE_RENAMEAT2]:
Use renameat2 instead of syscall (Bug#32796).
* m4/renameat.m4 (gl_FUNC_RENAMEAT): Check for renameat2.

6 years agobootstrap, gnulib-tool: use https instead of insecure rsync
Benno Schulenberg [Sun, 7 Oct 2018 16:20:44 +0000 (18:20 +0200)]
bootstrap, gnulib-tool: use https instead of insecure rsync

The rsync command does not do any authentication and thus allows
man-in-the-middle attacks.  Better use wget over https, although
this is slower.

* build-aux/bootstrap (download_po_files, po_download_command_format):
Don't try using rsync; always use wget over https to fetch PO files.
* gnulib-tool (func_import): Likewise.
* pygnulib/GLImport.py (GLImport.execute): Likewise.

6 years agoAdd ChangeLog entry for last commit.
Benno Schulenberg [Sun, 7 Oct 2018 17:19:30 +0000 (19:19 +0200)]
Add ChangeLog entry for last commit.

6 years agobootstrap, gnulib-tool: correct the translations wget command
Benno Schulenberg [Sun, 7 Oct 2018 16:20:43 +0000 (18:20 +0200)]
bootstrap, gnulib-tool: correct the translations wget command

Using the -np (--no-parent) option doesn't prevent wget from
traversing the given URL to a default depth of 5, and since
the domain directory contains a href="/latest/" link, this
means that wget searches through all domains anyway and will
also download PO files that are meant for other packages.
When getting the PO files for the nano domain, for example,
you will end up with af.po and ast.po (and many others) too,
but there are no African nor Asturian translations for nano.

So, use the --level option instead, to stop wget from looking
any further than the given URL.

* build-aux/bootstrap (po_download_command_format2): Restrict
recursion to a single level.
* gnulib-tool (func_import): Likewise.
* pygnulib/GLImport.py (GLImport.execute): Likewise.

6 years agodoc: the gnulib snapshots are not maintained
Akim Demaille [Sun, 7 Oct 2018 07:33:21 +0000 (09:33 +0200)]
doc: the gnulib snapshots are not maintained

* doc/gnulib-intro.texi (Steady Development): Don't mention them.

6 years agotimevar: add to lib_SOURCES
Akim Demaille [Sat, 6 Oct 2018 10:16:12 +0000 (12:16 +0200)]
timevar: add to lib_SOURCES

* modules/timevar (lib_SOURCES): Add timevar.c and timevar.def.

6 years agodirent: Update documentation.
Bruno Haible [Sun, 7 Oct 2018 09:04:50 +0000 (11:04 +0200)]
dirent: Update documentation.

* doc/posix-headers/dirent.texi: The MSVC issue is fixed by Gnulib.

6 years agostrpbrk: Make it possible to namespace the defined symbol.
Bruno Haible [Fri, 5 Oct 2018 19:54:56 +0000 (21:54 +0200)]
strpbrk: Make it possible to namespace the defined symbol.

* lib/strpbrk.c (strpbrk): Don't undefine outside of glibc.

6 years agostrcspn: Make it possible to namespace the defined symbol.
Bruno Haible [Fri, 5 Oct 2018 19:54:14 +0000 (21:54 +0200)]
strcspn: Make it possible to namespace the defined symbol.

* lib/strcspn.c (strcspn): Don't undefine outside of glibc.

6 years agoraise: Make it possible to namespace the defined symbol.
Bruno Haible [Fri, 5 Oct 2018 19:53:24 +0000 (21:53 +0200)]
raise: Make it possible to namespace the defined symbol.

* lib/raise.c (raise): Undefine only after the replacement function has
been defined.
(raise): Renamed from rpl_raise.
(raise_nothrow): Move to the end of the compilation unit.

6 years agomemcmp: Make it possible to namespace the defined symbol.
Bruno Haible [Fri, 5 Oct 2018 19:50:47 +0000 (21:50 +0200)]
memcmp: Make it possible to namespace the defined symbol.

* lib/memcmp.c (memcmp): Don't undefine outside of glibc.

6 years agoexplicit_bzero: Make it possible to namespace the defined symbol.
Bruno Haible [Fri, 5 Oct 2018 19:49:39 +0000 (21:49 +0200)]
explicit_bzero: Make it possible to namespace the defined symbol.

* lib/explicit_bzero.c (explicit_bzero): Don't undefine outside of
glibc.

6 years agomkdir-p: Depend on 'mkdir'.
Bruno Haible [Fri, 5 Oct 2018 16:42:44 +0000 (18:42 +0200)]
mkdir-p: Depend on 'mkdir'.

* modules/mkdir-p (Depends-on): Add 'mkdir'.

6 years agotempname: Depend on 'mkdir'.
Bruno Haible [Fri, 5 Oct 2018 16:37:31 +0000 (18:37 +0200)]
tempname: Depend on 'mkdir'.

Reported by Maarten Bosmans <mkbosmans@gmail.com>
at <https://savannah.gnu.org/bugs/?33379>.

* modules/tempname (Depends-on): Add 'mkdir'.

6 years agotimevar: rely on gnulib modules for time portability.
Akim Demaille [Tue, 2 Oct 2018 04:19:19 +0000 (06:19 +0200)]
timevar: rely on gnulib modules for time portability.

* modules/timevar (Depends-on): Add sys_time, sys_times, and times.
* m4/timevar.m4: Don't check for clock_t and struct tms,
guaranteed by gnulib.
* lib/timevar.h: Use extern "C" protection.
Include <stdio.h> for FILE.
* lib/timevar.c: Include sys/time.h, sys/times.h unconditionally,
they are guaranteed by gnulib.
Remove uses of clock as (now useless) fallback.

6 years agosh-filename: New module.
Bruno Haible [Thu, 4 Oct 2018 23:38:46 +0000 (01:38 +0200)]
sh-filename: New module.

* m4/sh-filename.m4: New file.
* modules/sh-filename: New file.
* lib/spawni.c (_PATH_BSHELL): Use BOURNE_SHELL instead of hardcoding
"/bin/sh".
* tests/test-posix_spawn1.c (main): Likewise.
* tests/test-posix_spawn2.c (main): Likewise.
* lib/javacomp.c (compile_using_envjavac, is_envjavac_gcj,
is_envjavac_gcj43): Likewise.
* lib/javaexec.c (execute_java_class): Likewise.
* modules/posix_spawn-internal (Depends-on): Add sh-filename.
* modules/posix_spawnp-tests (Depends-on): Likewise.
* modules/javacomp (Depends-on): Likewise.
* modules/javaexec (Depends-on): Likewise.

6 years agofcntl: Make it possible to namespace the defined symbol, part 2.
Bruno Haible [Thu, 4 Oct 2018 23:16:56 +0000 (01:16 +0200)]
fcntl: Make it possible to namespace the defined symbol, part 2.

* lib/fcntl.c: Fix syntax errors in last commit.

6 years agospawn-pipe tests: Avoid test failure on native Windows.
Bruno Haible [Thu, 4 Oct 2018 22:27:25 +0000 (00:27 +0200)]
spawn-pipe tests: Avoid test failure on native Windows.

* tests/test-spawn-pipe-child.c (main): On native Windows, don't expect
that fd 2 is closed.

6 years agofcntl: Make it possible to namespace the defined symbol.
Bruno Haible [Thu, 4 Oct 2018 22:22:57 +0000 (00:22 +0200)]
fcntl: Make it possible to namespace the defined symbol.

* lib/fcntl.c (fcntl): Undefine only after the replacement function has
been defined.
(fcntl): Renamed from rpl_fcntl.
(rpl_fcntl_DUPFD, rpl_fcntl_DUPFD_CLOEXEC): New functions, extracted
from fcntl.
(klibc_fcntl): Move to the end of the compilation unit.

6 years agovasnprintf tests: Avoid test failure on HP-UX/hppa and IRIX.
Bruno Haible [Wed, 3 Oct 2018 00:56:57 +0000 (02:56 +0200)]
vasnprintf tests: Avoid test failure on HP-UX/hppa and IRIX.

* tests/test-vasnprintf.c (test_function): Change the test added on
2018-09-23 to check only the 18 most significant digits.

6 years agovasnprintf tests: Avoid test failure on Cygwin.
Bruno Haible [Tue, 2 Oct 2018 08:50:42 +0000 (10:50 +0200)]
vasnprintf tests: Avoid test failure on Cygwin.

* tests/test-vasnprintf.c (test_function): Change the test added on
2018-09-23 to check only the 42 most significant digits.

6 years agomkostemp, mkostemps: Update documentation.
Bruno Haible [Mon, 1 Oct 2018 23:17:34 +0000 (01:17 +0200)]
mkostemp, mkostemps: Update documentation.

* doc/glibc-functions/mkostemp.texi: Mention the Mac OS X issue.
* doc/glibc-functions/mkostemps.texi: Likewise.

6 years agomkostemp, mkostemps: Fix compilation error in C++ mode on Mac OS X.
Tom Tromey [Mon, 1 Oct 2018 20:57:45 +0000 (14:57 -0600)]
mkostemp, mkostemps: Fix compilation error in C++ mode on Mac OS X.

Attempting to use the mkostemp module in gdb caused a build failure
when using the C++ namespace feature, because mkostemp was not
declared.  On OS X, mkostemp is declared in unistd.h, so this patch
extends the existing special case in stdlib.in.h to cover mkostemp and
mkostemps.

* lib/stdlib.in.h: Include <unistd.h> for mkostemp and mkostemps
on OS X.

6 years agohmac-*: refactor to remove repetitive code
Pádraig Brady [Sun, 30 Sep 2018 05:20:17 +0000 (22:20 -0700)]
hmac-*: refactor to remove repetitive code

A net removal of 240 lines.

* lib/hmac.c: A new parameterized single implementation.
* lib/hmac-md5.c: Define parameters and include implementation.
* lib/hmac-sha1.c: Likewise.
* lib/hmac-sha256.c: Likewise.
* lib/hmac-sha512.c: Likewise.
* modules/crypto/hmac-md5: Reference the new implementation file.
* modules/crypto/hmac-sha1: Likewise.
* modules/crypto/hmac-sha256: Likewise.
* modules/crypto/hmac-sha512: Likewise.
* tests/test-hmac-md5.c: Refactor common code to a single function.
* tests/test-hmac-sha1.c: Likewise.
* tests/test-hmac-sha256.c: Likewise.
* tests/test-hmac-sha512.c: Likewise.

6 years agohmac-sha512: fix hash for keys > blocksize (128 bytes)
Zhang Qing [Sun, 30 Sep 2018 02:57:56 +0000 (19:57 -0700)]
hmac-sha512: fix hash for keys > blocksize (128 bytes)

* lib/hmac-sha512.c (hmac_sha512): Set the computed/shortened
key length to that output by sha512, not the blocksize.
Otherwise uninitialized data from the stack
is used when computing the hash.
* tests/test-hmac-sha512.c: Add a shortened key test case.
Reported at https://github.com/coreutils/gnulib/pull/5

6 years agovasnprintf: Avoid warnings from GCC's -Wsign-compare.
Bruno Haible [Sun, 30 Sep 2018 21:16:45 +0000 (23:16 +0200)]
vasnprintf: Avoid warnings from GCC's -Wsign-compare.

Reported by Bjarni Ingi Gislason <bjarniig@rhi.hi.is> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00105.html>.

* lib/vasnprintf.c (VASNPRINTF): Cast 'count' from 'int' to
'unsigned int' before comparison with an unsigned value.

6 years agograntpt: Remove unnecessary dependency.
Bruno Haible [Sun, 30 Sep 2018 17:50:34 +0000 (19:50 +0200)]
grantpt: Remove unnecessary dependency.

* modules/grantpt (Depends-on): Remove 'builtin-expect'.

6 years agotimevar: Small tweaks.
Bruno Haible [Sun, 30 Sep 2018 17:36:29 +0000 (19:36 +0200)]
timevar: Small tweaks.

* lib/timevar.h: Fix comments. Add parameter names to function
declarations.
* lib/timevar.c: Include timevar.h immediately after config.h.
* lib/timevar.def: Fix comments.
* modules/timevar (Maintainer): List Akim Demaille.

6 years agotimevar: Include documentation in gnulib manual.
Bruno Haible [Sun, 30 Sep 2018 17:27:56 +0000 (19:27 +0200)]
timevar: Include documentation in gnulib manual.

* doc/timevar.texi: Change node and section name to 'Profiling of
program phases'.
In the code snippets, tweak the #includes and use GNU coding style.
* doc/gnulib.texi: Include timevar.texi.

6 years agotimevar: import from Bison.
Akim Demaille [Thu, 27 Sep 2018 16:20:29 +0000 (18:20 +0200)]
timevar: import from Bison.

* m4/timevar.m4, modules/timevar, lib/timevar.h, lib/timevar.c:
New files.
* lib/timevar.def: New file.
* doc/timevar.texi: New file.

6 years agojavacomp-script, javacomp: Add preliminary support for Java 12..17.
Bruno Haible [Wed, 26 Sep 2018 20:14:07 +0000 (22:14 +0200)]
javacomp-script, javacomp: Add preliminary support for Java 12..17.

* m4/javacomp.m4 (gt_JAVACOMP): Treat Java versions 12..17 like 11.
* lib/javacomp.c (default_target_version): Likewise.

6 years agojavacomp-script, javacomp: Add support for Java 11.
Bruno Haible [Wed, 26 Sep 2018 09:21:30 +0000 (11:21 +0200)]
javacomp-script, javacomp: Add support for Java 11.

* m4/javacomp.m4 (gt_JAVACOMP): Accept source-version 11 and
target-version 11.
* lib/javaversion.h: Update comments.
* lib/javacomp.c (default_target_version, SOURCE_VERSION_BOUND,
source_version_index, get_goodcode_snippet, get_failcode_snippet,
TARGET_VERSION_BOUND, target_version_index,
corresponding_classfile_version): Accept source_version 11 and
target_version 11.
* lib/javacomp.h: Update comments accordingly.

6 years agovasnprintf: Fix heap memory overrun bug.
Bruno Haible [Sun, 23 Sep 2018 12:13:52 +0000 (14:13 +0200)]
vasnprintf: Fix heap memory overrun bug.

Reported by Ben Pfaff <blp@cs.stanford.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00107.html>.

* lib/vasnprintf.c (convert_to_decimal): Allocate one more byte of
memory.
* tests/test-vasnprintf.c (test_function): Add another test.

6 years agoautoupdate
Karl Berry [Sat, 22 Sep 2018 15:45:27 +0000 (08:45 -0700)]
autoupdate

6 years agomaint: mktime.c now shared with glibc
Paul Eggert [Thu, 20 Sep 2018 03:59:26 +0000 (20:59 -0700)]
maint: mktime.c now shared with glibc

* config/srclist.txt: intprops.h, timegm.c and mktime.c
are now the same in Gnulib and glibc.

6 years agomktime: fix _LIBC typo
Paul Eggert [Wed, 19 Sep 2018 21:26:49 +0000 (14:26 -0700)]
mktime: fix _LIBC typo

* lib/mktime.c (mktime): Fix typo (misspelled "_LIBC").

6 years agodfa: optimization for state merge
Norihiro Tanaka [Wed, 19 Sep 2018 15:35:49 +0000 (08:35 -0700)]
dfa: optimization for state merge

* lib/dfa.c (merge2): New function.
(merge_nfa_state): Use it.

6 years agodfa: trivial comment fix: s/is/if/
Jim Meyering [Wed, 19 Sep 2018 04:26:01 +0000 (21:26 -0700)]
dfa: trivial comment fix: s/is/if/

* lib/dfa.c (maybe_disable_superset_dfa): Fix comment typo.

6 years agodfa: use more-informative function name
Paul Eggert [Wed, 19 Sep 2018 02:12:06 +0000 (19:12 -0700)]
dfa: use more-informative function name

* lib/dfa.c (maybe_disable_superset_dfa):
Rename from dfautf8noss.  Use change.

6 years agodfa: tweak allocation performance
Paul Eggert [Wed, 19 Sep 2018 02:05:26 +0000 (19:05 -0700)]
dfa: tweak allocation performance

* lib/dfa.c (merge_nfa_state, dfaoptimize):
Prefer ptrdiff_t for indexes some more.
Use char for flags, as it’s wide enough.
Allocate queue and flags together, with one malloc call.
No need to use xnmalloc since the multiplication and
addition cannot overflow (it’s already been checked by
earlier allocation).  Prefer memset to open-coding.

6 years agodfa: prune states as we go
Paul Eggert [Wed, 19 Sep 2018 01:24:27 +0000 (18:24 -0700)]
dfa: prune states as we go

* lib/dfa.c (prune): Remove.
(merge_nfa_state): Prune as we go instead of at the end.
Prefer ptrdiff_t for indexes, as this helps the compiler a bit.
Simplify constraint checking a bit.

6 years agodfa: reorder enum for efficiency
Paul Eggert [Tue, 18 Sep 2018 22:25:51 +0000 (15:25 -0700)]
dfa: reorder enum for efficiency

* lib/dfa.c (END): Now -1 again.  Reorder other elements
of the enumeration to make it easier for GCC to generate
efficient code by using fewer comparisons to check for
ranges of values.
(atom): Take advantage of the reordering.

6 years agodfa: optimize alternation in NFA
Norihiro Tanaka [Tue, 18 Sep 2018 17:07:23 +0000 (10:07 -0700)]
dfa: optimize alternation in NFA

Even when similar states exist in alternation, the DFA treats them
as separate items, which may complicate the transition in NFA and
cause slowdown.  This change assembles the states into one.  For
example, ab|ac is changed into a(b|c).  This change speeds-up
matching for many branched patterns.  For example, grep speeds up
more than 30× in:

  seq 10000 | sed 's/$/ abcdefghijklmnopqrstuvwxyz/; s/$/./' >in
  time -p env LC_ALL=C grep -vf in in

* lib/dfa.c (prune): New function.
(merge_nfa_state): New function.  It merges similar NFA states.
(dfaoptimize): New function.  It seeks merged and removed nodes.
(dfaanalyze): Call new function.
(dfautf8noss): Change name from dfaoptimize because of addition of new
function.
(dfacomp): Update caller.

6 years agodfa: simplify initial state
Norihiro Tanaka [Tue, 18 Sep 2018 16:58:22 +0000 (09:58 -0700)]
dfa: simplify initial state

Simplifying the initial state enables easier optimization of the NFA.
* lib/dfa.c (enum token): Add new element BEG.
(prtok): Adjust due to adding element BEG.
(dfaparse): Put BEG at a head of tokens.
(state_index): Adjust due to adding element BEG.
(dfaanalyze): Concatenate BEG to other tokens, and simplify to
build initial state.
(dfamust): Adjust due to adding element BEG.  DFAMUST ignores it.

6 years agofile-has-acl: Fix test failure on Cygwin 2.9.
Bruno Haible [Tue, 18 Sep 2018 20:58:23 +0000 (22:58 +0200)]
file-has-acl: Fix test failure on Cygwin 2.9.

* m4/acl.m4 (gl_FUNC_ACL): Update comments regarding Cygwin.
* lib/acl-internal.h: Likewise.
(HAVE_ACL_EXTENDED_FILE): Undefine on Cygwin.
* lib/acl-internal.c: Update comments regarding Cygwin.
* lib/acl_entries.c: Likewise.
* lib/file-has-acl.c: Likewise.
(file_has_acl): For Cygwin, use a different way to determine whether
the "default" ACL of a directory is nontrivial.
* lib/get-permissions.c: Update comments regarding Cygwin.
* lib/set-permissions.c: Likewise.

6 years agostat-time tests: Fix test failure on Cygwin.
Bruno Haible [Tue, 18 Sep 2018 19:27:15 +0000 (21:27 +0200)]
stat-time tests: Fix test failure on Cygwin.

* tests/nap.h (nap_get_stat): Treat Cygwin like native Windows.

6 years agodoc: fix typo
Paul Eggert [Tue, 18 Sep 2018 19:27:10 +0000 (12:27 -0700)]
doc: fix typo

6 years agodoc: OS X 10.11 lacked ns time functions
Paul Eggert [Tue, 18 Sep 2018 19:19:02 +0000 (12:19 -0700)]
doc: OS X 10.11 lacked ns time functions

According to <https://github.com/zeromq/libzmq/issues/2175>,
nanosecond-resolution timestamp functions were introduced
in macOS 10.12, so document the last version (OS X 10.11)
where they were absent.

6 years agogettime: nanotime never existed
Paul Eggert [Tue, 18 Sep 2018 19:19:02 +0000 (12:19 -0700)]
gettime: nanotime never existed

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2018-09/msg00082.html
* lib/gettime.c (gettime) [HAVE_NANOTIME]: Remove unused code.
* m4/gettime.m4 (gl_GETTIME): Don’t check for nanotime.

6 years agodoc: Update statement about target platforms.
Bruno Haible [Tue, 18 Sep 2018 19:04:48 +0000 (21:04 +0200)]
doc: Update statement about target platforms.

Reported by Simon Sobisch.

* doc/gnulib-intro.texi (Target Platforms): Update. Mention
restrictions on MSVC versions.

6 years agoposix_spawn tests: Fix link error on 64-bit Cygwin.
Bruno Haible [Tue, 18 Sep 2018 18:18:38 +0000 (20:18 +0200)]
posix_spawn tests: Fix link error on 64-bit Cygwin.

* tests/test-posix_spawn1.c (environ): Remove declaration.
* tests/test-posix_spawn2.c (environ): Likewise.
* tests/test-posix_spawn3.c (environ): Likewise.
* tests/test-posix_spawn4.c (environ): Likewise.
* modules/posix_spawn-tests (Depends-on): Add 'environ'.
* modules/posix_spawnp-tests (Depends-on): Likewise.

6 years agotimespec: new function current_timespec
Paul Eggert [Sun, 16 Sep 2018 21:41:36 +0000 (14:41 -0700)]
timespec: new function current_timespec

* lib/gettime.c (gettime): Prefer clock_gettime to nanotime,
and don’t worry about it failing on a CLOCK_REALTIME arg.
POSIX requires it to succeed and I don’t know of any
counterexamples where the fallbacks would work.
(current_timespec): New function, taken from Emacs.  It is more
convenient than gettime, and can help register allocation.
* lib/timespec.h: Include arg-nonnull.h.
(current_timespec): New declaration.
(gettime, settime): Declare args to be nonnull.
* modules/timespec (Depends-on): Add snippet/arg-nonnull.

6 years agosetlocale: Improve locale handling on macOS 10.12 or newer.
Bruno Haible [Sun, 16 Sep 2018 17:12:44 +0000 (19:12 +0200)]
setlocale: Improve locale handling on macOS 10.12 or newer.

* lib/setlocale.c: Include header files for CoreFoundation. Declare
gl_locale_name_canonicalize.
(libintl_setlocale): Try harder to set a locale for categories LC_CTYPE
and LC_MESSAGES.
* m4/setlocale.m4 (gl_PREREQ_SETLOCALE): Add comment.

6 years agoUpdate list of locale names with scripts on macOS.
Bruno Haible [Sun, 16 Sep 2018 15:14:12 +0000 (17:14 +0200)]
Update list of locale names with scripts on macOS.

* lib/localename.c (gl_locale_name_canonicalize): Update tables to
match Mac OS X 10.13 and recent glibc.

6 years agogettext: Use newer macOS APIs when possible.
Bruno Haible [Sun, 16 Sep 2018 15:08:04 +0000 (17:08 +0200)]
gettext: Use newer macOS APIs when possible.

* m4/intlmacosx.m4 (gt_INTL_MACOSX): Fix variable name.

6 years agogettext: Use newer macOS APIs when possible.
Bruno Haible [Sun, 16 Sep 2018 12:45:15 +0000 (14:45 +0200)]
gettext: Use newer macOS APIs when possible.

* m4/intlmacosx.m4 (gt_INTL_MACOSX): Check for
CFLocaleCopyPreferredLanguages.

6 years agolocalename: Revisit macOS specific code.
Bruno Haible [Sun, 16 Sep 2018 12:42:55 +0000 (14:42 +0200)]
localename: Revisit macOS specific code.

* lib/localename.c (gl_locale_name_default): Reduce code duplication.
Fix comments about Mac OS X versions.

6 years agosetlocale: Improve support for locales not supported by libc.
Bruno Haible [Sun, 16 Sep 2018 01:15:54 +0000 (03:15 +0200)]
setlocale: Improve support for locales not supported by libc.

Reported by Dapeng Gao <peter@dpgao.cc> at
<https://savannah.gnu.org/bugs/?54479>.

* gettext-runtime/intl/setlocale.c: Include <stdio.h>.
(libintl_setlocale): Use a more error-tolerant strategy when the locale
to be set is not supported by libc: Emit warnings instead of failing.

6 years agostrstr, strcasestr: Add workaround against glibc-2.28 bug.
Bruno Haible [Sat, 15 Sep 2018 10:04:03 +0000 (12:04 +0200)]
strstr, strcasestr: Add workaround against glibc-2.28 bug.

Reported by Michael Brunnbauer via Siddhesh Poyarekar and Eric Blake.

* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Set
gl_cv_func_strstr_works_always to 'no' on glibc 2.28.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Set
gl_cv_func_strcasestr_works_always to 'no' on glibc 2.28.
* doc/posix-functions/strstr.texi: Document the glibc 2.28 bug.
* doc/glibc-functions/strcasestr.texi: Likewise.

6 years agodoc: Fix bottom of top-level page.
Bruno Haible [Fri, 14 Sep 2018 10:52:53 +0000 (12:52 +0200)]
doc: Fix bottom of top-level page.

Reported by Akim Demaille <akim.demaille@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00072.html>.

* doc/pastposix-functions/index.texi: Rename node to '_index' in HTML
mode.
* doc/gnulib.texi (Legacy Function Substitutes): Update menu
accordingly.

6 years agoAdd test case from a recent glibc bug.
Bruno Haible [Wed, 12 Sep 2018 21:40:02 +0000 (23:40 +0200)]
Add test case from a recent glibc bug.

* tests/test-strstr.c (main): Add test of long needle.
* tests/test-strcasestr.c (main): Likewise.
* tests/test-c-strstr.c (main): Likewise.
* tests/test-c-strcasestr.c (main): Likewise.
* tests/test-memmem.c (main): Likewise.

6 years agoApply Eric Blake's improvements from 2011-02-25 to more tests.
Bruno Haible [Wed, 12 Sep 2018 19:30:42 +0000 (21:30 +0200)]
Apply Eric Blake's improvements from 2011-02-25 to more tests.

* tests/test-c-strstr.c (main): Add the same tests here as well.

6 years agoApply Jim Meyering's fix from 2015-01-11 to more tests.
Bruno Haible [Wed, 12 Sep 2018 19:27:52 +0000 (21:27 +0200)]
Apply Jim Meyering's fix from 2015-01-11 to more tests.

* tests/test-memmem.c (main): Free haystack.
* tests/test-strcasestr.c (main): Likewise.
* tests/test-c-strcasestr.c (main): Likewise.

6 years agoxstrtol: actually copy the intprops.h line
Paul Eggert [Tue, 11 Sep 2018 19:42:31 +0000 (12:42 -0700)]
xstrtol: actually copy the intprops.h line

6 years agoxstrtol: fix missing-TYPE_SIGNED typo
Paul Eggert [Tue, 11 Sep 2018 19:29:01 +0000 (12:29 -0700)]
xstrtol: fix missing-TYPE_SIGNED typo

* lib/xstrtol.c (TYPE_SIGNED): New macro, duplicating intprops.h.

6 years agotimespec: fix resolution confusion
Paul Eggert [Tue, 11 Sep 2018 01:42:25 +0000 (18:42 -0700)]
timespec: fix resolution confusion

In normal usage, clock resolution is given in seconds, but the
code was mistakenly using inverse seconds and calling it
“resolution”.  Fix this, partly by renaming two identifiers.
The old names will be kept for a bit, to ease transition.
* lib/timespec.h (TIMESPEC_HZ, LOG10_TIMESPEC_HZ):
New constants, replacing TIMESPEC_RESOLUTION and
LOG10_TIMESPEC_RESOLUTION, which are now obsolescent.
All uses changed.

6 years agomktime: simplify in prep for glibc merge
Paul Eggert [Sun, 9 Sep 2018 15:56:15 +0000 (08:56 -0700)]
mktime: simplify in prep for glibc merge

* lib/mktime.c, lib/timegm.c [_LIBC]:
Include mktime-internal.h (a small file just for glibc)
instead of using a typedef.

6 years agointprops: minor clarification of code
Paul Eggert [Sat, 8 Sep 2018 00:13:59 +0000 (17:13 -0700)]
intprops: minor clarification of code

* lib/intprops.h (_GL_BINARY_OP_OVERFLOW):
Use _GL_INT_CONVERT rather than reinventing it.

6 years agoFix a comment.
Bruno Haible [Fri, 7 Sep 2018 21:39:37 +0000 (23:39 +0200)]
Fix a comment.

* tests/test-posix_spawn3.c (parent_main): Fix typo in comment.

6 years agoposix_spawn_file_actions_addchdir: Add tests.
Bruno Haible [Fri, 7 Sep 2018 21:38:53 +0000 (23:38 +0200)]
posix_spawn_file_actions_addchdir: Add tests.

* tests/test-posix_spawn_file_actions_addchdir.c: New file.
* tests/test-posix_spawn4.c: New file.
* modules/posix_spawn_file_actions_addchdir-tests: New file.

6 years agoposix_spawn_file_actions_addchdir: New module.
Bruno Haible [Fri, 7 Sep 2018 21:35:52 +0000 (23:35 +0200)]
posix_spawn_file_actions_addchdir: New module.

Suggested by Eric Blake in
<https://lists.gnu.org/archive/html/bug-findutils/2018-09/msg00007.html>.

* lib/spawn.in.h (posix_spawn_file_actions_addchdir): New declaration.
* lib/spawn_int.h (struct __spawn_action): Add tag 'spawn_do_chdir' and
union member 'chdir_action'.
* lib/spawn_faction_addchdir.c: New file.
* lib/spawni.c (__spawni): Implement the spawn_do_chdir action.
* lib/spawn_faction_addclose.c: Test REPLACE_POSIX_SPAWN instead of
HAVE_WORKING_POSIX_SPAWN.
* lib/spawn_faction_adddup2.c: Likewise.
* lib/spawn_faction_addopen.c: Likewise.
* m4/posix_spawn_faction_addchdir.m4: New file.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): Test whether module
'posix_spawn_file_actions_addchdir' is present and whether
posix_spawn_file_actions_addchdir_np exists. Define REPLACE_POSIX_SPAWN
instead of HAVE_WORKING_POSIX_SPAWN.
* m4/spawn_h.m4 (gl_SPAWN_H): Test whether
posix_spawn_file_actions_addchdir is declared.
(gl_SPAWN_H_DEFAULTS): Initialize
GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR,
HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR,
REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR.
* modules/spawn (Makefile.am): Substitute
GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR,
HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR,
REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR.
* modules/posix_spawn_file_actions_addchdir: New file.
* modules/posix_spawn_file_actions_addclose (Depends-on,
configure.ac): Test also REPLACE_POSIX_SPAWN.
* modules/posix_spawn_file_actions_adddup2 (Depends-on,
configure.ac): Likewise.
* modules/posix_spawn_file_actions_addopen (Depends-on,
configure.ac): Likewise.
* tests/test-spawn-c++.cc (posix_spawn_file_actions_addchdir): Check
signature.
* doc/posix-functions/posix_spawn.texi: Mention the new module.
* doc/posix-functions/posix_spawnp.texi: Likewise.

6 years agoFix typo in comment in yesterday's commit.
Bruno Haible [Fri, 7 Sep 2018 07:57:25 +0000 (09:57 +0200)]
Fix typo in comment in yesterday's commit.

6 years agostddef: Override max_align_t on NetBSD 8.0/x86.
Bruno Haible [Thu, 6 Sep 2018 20:44:01 +0000 (22:44 +0200)]
stddef: Override max_align_t on NetBSD 8.0/x86.

* m4/stddef_h.m4 (gl_STDDEF_H): When testing for max_align_t, test also
the value of __alignof__ (max_align_t).
* doc/posix-headers/stddef.texi: Mention the issue.

6 years agofcntl: Fix F_DUPFD_CLOEXEC behaviour on Haiku.
Bruno Haible [Thu, 6 Sep 2018 16:36:02 +0000 (18:36 +0200)]
fcntl: Fix F_DUPFD_CLOEXEC behaviour on Haiku.

* lib/fcntl.c (rpl_fcntl): For F_DUPFD_CLOEXEC, don't even try the
system fcntl.
* doc/posix-functions/fcntl.texi: Document the issue.

6 years agocount-trailing-zeros tests: Rely on limits-h module.
Bruno Haible [Thu, 6 Sep 2018 12:50:04 +0000 (14:50 +0200)]
count-trailing-zeros tests: Rely on limits-h module.

* tests/test-count-trailing-zeros.c (ULLONG_MAX): Remove fallback
definition.
* modules/count-trailing-zeros-tests (Depends-on): Add 'limits-h'.

6 years agocount-leading-zeros tests: Rely on limits-h module.
Bruno Haible [Thu, 6 Sep 2018 12:49:14 +0000 (14:49 +0200)]
count-leading-zeros tests: Rely on limits-h module.

* tests/test-count-leading-zeros.c (ULLONG_MAX): Remove fallback
definition.
* modules/count-leading-zeros-tests (Depends-on): Add 'limits-h'.

6 years agocount-one-bits tests: Rely on limits-h module.
Bruno Haible [Thu, 6 Sep 2018 12:48:00 +0000 (14:48 +0200)]
count-one-bits tests: Rely on limits-h module.

* tests/test-count-one-bits.c (ULLONG_MAX): Remove fallback definition.
* modules/count-one-bits-tests (Depends-on): Add 'limits-h'.

6 years agoxstrtoll: Rely on limits-h module.
Bruno Haible [Thu, 6 Sep 2018 12:46:06 +0000 (14:46 +0200)]
xstrtoll: Rely on limits-h module.

* lib/xstrtol.c: Don't include intprops.h.
(ULLONG_MAX, LLONG_MAX, LLONG_MIN): Remove fallback definitions.
* modules/xstrtol (Depends-on): Remove 'intprops'.
* modules/xstrtoll (Depends-on): Add 'limits-h'.

6 years agostrtoll, strtoull: Rely on limits-h module.
Bruno Haible [Thu, 6 Sep 2018 12:41:00 +0000 (14:41 +0200)]
strtoll, strtoull: Rely on limits-h module.

* lib/strtol.c (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove macros.
(ULLONG_MAX, LLONG_MAX, LLONG_MIN): Remove fallback definitions.
* modules/strtoll (Depends-on): Add limits-h.
* modules/strtoull (Depends-on): Likewise.

6 years agointprops tests: Fix compilation error with pre-C99 compiler.
Bruno Haible [Thu, 6 Sep 2018 12:35:29 +0000 (14:35 +0200)]
intprops tests: Fix compilation error with pre-C99 compiler.

* tests/test-intprops.c (verify_stmt): New macro.
(VERIFY, main): Use it.

6 years agolimits-h: Provide numerical limits macros.
Bruno Haible [Thu, 6 Sep 2018 12:28:38 +0000 (14:28 +0200)]
limits-h: Provide numerical limits macros.

* lib/limits.in.h (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Define also for
IRIX and for GCC.
(WORD_BIT, LONG_BIT): Define.
* m4/limits-h.m4 (gl_LIMITS_H): Set LIMITS_H to non-empty also when
<limits.h> does not define LLONG_MAX or WORD_BIT.
* tests/test-limits-h.c (TYPE_SIGNED, TYPE_WIDTH, TYPE_MINIMUM,
TYPE_MAXIMUM): New macros, from intprops.h.
Add tests for CHAR_BIT, WORD_BIT, LONG_BIT, <type>_MIN, and <type>_MAX.
* doc/posix-headers/limits.texi: Document what the 'limits-h' module
provides.

6 years agofcntl: Don't access nonexistent optional argument.
Bruno Haible [Thu, 6 Sep 2018 09:23:53 +0000 (11:23 +0200)]
fcntl: Don't access nonexistent optional argument.

Reported by Frank Busse <f.busse@imperial.ac.uk> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00018.html>.

* lib/fcntl.c (rpl_fcntl): For actions that don't take an argument,
don't consume an argument. For actions that take an 'int' argument,
consume an 'int' argument.

6 years agodoc: mention environ pitfall
Eric Blake [Thu, 31 May 2018 13:52:40 +0000 (08:52 -0500)]
doc: mention environ pitfall

Based on a bug report to the Cygwin list:
https://cygwin.com/ml/cygwin/2018-05/msg00321.html

* doc/posix-functions/environ.texi (environ): Assigning NULL to
environ is a glibc extension.

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agognulib-tool: Fix build order when $testsbase is a subdir of $sourcebase.
Bruno Haible [Mon, 3 Sep 2018 19:19:16 +0000 (21:19 +0200)]
gnulib-tool: Fix build order when $testsbase is a subdir of $sourcebase.

Reported by Antoine Luong <antoine.luong@c-s.fr> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00008.html>.

* gnulib-tool (func_import): For the tests, set a dotfirst flag.
(func_emit_lib_Makefile_am): Consider the dotfirst flag.
(func_emit_tests_Makefile_am): Don't consider the dotfirst flag.

6 years agomktime: fix unlikely race+overflow bug
Paul Eggert [Sun, 2 Sep 2018 09:53:31 +0000 (02:53 -0700)]
mktime: fix unlikely race+overflow bug

Problem reported by Alexandre Oliva in:
https://sourceware.org/bugzilla/show_bug.cgi?id=16346
* lib/mktime.c (__mktime_internal): Access *OFFSET only once,
to avoid an unlikely race if the compiler delays a load and
if this cascades into a signed integer overflow.

6 years agomktime, timegm: simplify glibc time64_t
Paul Eggert [Sat, 1 Sep 2018 01:02:48 +0000 (18:02 -0700)]
mktime, timegm: simplify glibc time64_t

* lib/mktime.c, lib/timegm.c (mktime_offset_t) [_LIBC]:
Now long int, not time_t, since long int is the longstanding type
for this in glibc and there is no need to change it even if time_t
becomes 64 bits - even int would do, though this would be a change
to the glibc generated code.  When this change is merged into
glibc, it should simplify the time_t vs time64_t situation.

6 years agomktime, timegm: simplify merge to glibc
Paul Eggert [Sat, 1 Sep 2018 01:02:48 +0000 (18:02 -0700)]
mktime, timegm: simplify merge to glibc

Move code around to make a merge to glibc easier to audit.
This should not change behavior.
* lib/mktime.c: Include more standard files unconditionally.
(NEED_MKTIME_INTERNAL, NEED_MKTIME_WINDOWS)
(NEED_MKTIME_WORKING): Give default values to pacify -Wundef,
which glibc uses.  Default NEED_MKTIME_WORKING to DEBUG_MKTIME, to
simplify later conditionals; default the others to zero.  In uses
of these conditionals, explicitly spell out how _LIBC affects
things, so it’s easier to review from a glibc viewpoint.
(my_tzset, __tzset) [!_LIBC]: New function and macro, to better
compartmentalize tzset issues.  Move system-dependent tzsettish
code here from mktime.
(mktime): Move tzsettish code to my_tzset, and move
localtime_offset to within mktime so that it doesn’t
need a separate ifdef.
* lib/mktime-internal.h (__gmtime_r, __localtime_r, __mktime_internal):
Move these macros here from lib/mktime.c and lib/gmtime.c.

6 years agoautoupdate
Karl Berry [Thu, 30 Aug 2018 13:27:53 +0000 (06:27 -0700)]
autoupdate

6 years agoautoupdate
Karl Berry [Tue, 28 Aug 2018 15:20:16 +0000 (08:20 -0700)]
autoupdate

6 years agointprops: avoid evaluation of some expressions
Paul Eggert [Tue, 28 Aug 2018 01:31:44 +0000 (18:31 -0700)]
intprops: avoid evaluation of some expressions

This makes EXPR_SIGNED (e) easier to use, as it no longer
evaluates the expression E.  Formerly, E was required to be free
of side effects.
* lib/intprops.h (_GL_INT_CONVERT, _GL_INT_NEGATE_CONVERT)
(EXPR_SIGNED, TYPE_WIDTH, _GL_INT_MINIMUM, _GL_INT_MAXIMUM)
(_GL_SIGNED_INT_MAXIMUM): Do not evaluate the expression arg.

6 years agoautoupdate
Paul Eggert [Sun, 26 Aug 2018 03:40:55 +0000 (20:40 -0700)]
autoupdate

6 years agoautoupdate
Karl Berry [Sat, 25 Aug 2018 15:22:51 +0000 (08:22 -0700)]
autoupdate

6 years agoautoupdate
Karl Berry [Fri, 24 Aug 2018 15:14:55 +0000 (08:14 -0700)]
autoupdate

6 years agogetcwd: Add cross-compilation guesses.
Bruno Haible [Thu, 23 Aug 2018 19:13:19 +0000 (21:13 +0200)]
getcwd: Add cross-compilation guesses.

Reported by Sergio Durigan Junior <sergiodj@redhat.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00130.html>.

Based on a patch by Paul Eggert.

* m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Add cross-compilation
guesses for all GNU systems.

6 years ago; autoupdate
Paul Eggert [Thu, 23 Aug 2018 00:59:49 +0000 (17:59 -0700)]
; autoupdate

6 years agoautoupdate
Karl Berry [Mon, 20 Aug 2018 15:31:12 +0000 (08:31 -0700)]
autoupdate

6 years agoglob-h: Formalize side effects from other modules.
Bruno Haible [Sun, 19 Aug 2018 19:00:35 +0000 (21:00 +0200)]
glob-h: Formalize side effects from other modules.

* m4/glob_h.m4 (gl_REPLACE_GLOB_H): New macro.
* m4/glob.m4 (gl_GLOB): Invoke it.