]> Savannah Git Hosting - gnulib.git/log
gnulib.git
8 years agocanonicalize-lgpl: fix errno after malloca fails
Paul Eggert [Thu, 18 Aug 2016 18:56:07 +0000 (11:56 -0700)]
canonicalize-lgpl: fix errno after malloca fails

This fixes a typo I recently introduced.  Suggested by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00039.html
* lib/canonicalize-lgpl.c (__realpath):
Don't assume malloca sets errno on failure.

8 years agostrtod: port errno handling to z/OS
Paul Eggert [Thu, 18 Aug 2016 00:38:05 +0000 (17:38 -0700)]
strtod: port errno handling to z/OS

* lib/strtod.c (strtod): Save and restore errno more reliably.

8 years agostrtod: port to z/OS
Daniel Richard G [Thu, 18 Aug 2016 00:36:24 +0000 (17:36 -0700)]
strtod: port to z/OS

* lib/strtod.c (strtod): Address a couple quirks in the z/OS
implementation.

strtod: port to z/OS
* lib/strtod.c (strtod): Address a couple quirks in the z/OS
implementation.

8 years agoregex, string: rename to avoid '__string'
Paul Eggert [Thu, 18 Aug 2016 00:24:11 +0000 (17:24 -0700)]
regex, string: rename to avoid '__string'

* lib/regex.h, lib/string.in.h: Do not use the identifier
'__string', as it is effectively reserved by string.h on z/OS.

8 years agoc-strcase-tests, wcwidth-tests: depend on c-ctype
Paul Eggert [Thu, 18 Aug 2016 00:18:22 +0000 (17:18 -0700)]
c-strcase-tests, wcwidth-tests: depend on c-ctype

* modules/c-strcase-tests, modules/wcwidth-tests (Depends-on):
Add c-ctype.

8 years agothread: port to z/OS
Daniel Richard G [Wed, 17 Aug 2016 23:59:39 +0000 (16:59 -0700)]
thread: port to z/OS

* lib/glthread/thread.c, lib/glthread/thread.h:
Rudimentary gl_thread support for z/OS.

8 years agomaint: port tests to z/OS errno behavior
Daniel Richard G [Wed, 17 Aug 2016 23:57:35 +0000 (16:57 -0700)]
maint: port tests to z/OS errno behavior

* tests/test-nonblocking-reader.h:
* tests/test-nonblocking-writer.h:
Accommodate z/OS errno code preferences. (I believe this should
still be within spec; IBM is good at following the letter if not
the spirit of such things.)

8 years agomaint: preprocessor changes to support z/OS
Daniel Richard G [Wed, 17 Aug 2016 23:55:13 +0000 (16:55 -0700)]
maint: preprocessor changes to support z/OS

* lib/alloca.in.h, lib/fnmatch.c, lib/get-rusage-as.c:
* lib/glob.c, lib/math.in.h, lib/ptsname_r.c:
* tests/infinity.h, tests/nan.h, tests/test-canonicalize-lgpl.c:
* tests/test-nonblocking-pipe.h:

8 years agofclose, strstr-simple, wchar: port to z/OS
Daniel Richard G [Wed, 17 Aug 2016 23:09:38 +0000 (16:09 -0700)]
fclose, strstr-simple, wchar: port to z/OS

* m4/fclose.m4, m4/strstr.m4, m4/wchar_h.m4:
Changes to the Autoconf M4 code to support z/OS.  Note that
fclose() is broken in a different way on z/OS than it is on other
systems, thus the special-case in fclose.m4.

8 years agoiconv_open-utf-tests, iconv-tests: port to EBCDIC
Daniel Richard G [Wed, 17 Aug 2016 23:05:02 +0000 (16:05 -0700)]
iconv_open-utf-tests, iconv-tests: port to EBCDIC

* tests/test-iconv-utf.c, tests/test-iconv.c:
Added appropriately conditional #pragmas so that the test strings
in test-iconv-utf.c are correctly interpreted in ASCII instead of
EBCDIC (i.e. 'J' == 0x4A and not 0xD1). This issue could be
addressed in a more portable way by simply rewriting all the ASCII
literal characters as octal escapes, but then you would lose the
partial readability that the strings have now. Also, iconv_open()
on z/OS does not recognize "ISO-8859-1", but "ISO8859-1" works.

8 years agoc-strcase-tests, wcwidth-tests: port to EBCDIC
Daniel Richard G [Wed, 17 Aug 2016 22:58:01 +0000 (15:58 -0700)]
c-strcase-tests, wcwidth-tests: port to EBCDIC

* tests/test-c-strcasecmp.c: Include c-ctype.h.
(main) [!C_CTYPE_ASCII]: Skip tests that assume ASCII.
* tests/test-wcwidth.c: Likewise.

8 years agostdbool: don't require _Bool for C++
Paul Eggert [Wed, 17 Aug 2016 22:33:06 +0000 (15:33 -0700)]
stdbool: don't require _Bool for C++

Problem reported by David Seifert in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-06/msg00005.html
* NEWS, doc/posix-headers/stdbool.texi (stdbool.h): Document this.
* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL): Make the check
more-forgiving for C++, in that it requires only 'bool'.  Be a bit
stricter about checking that bool and _Bool are compatible in C.

8 years agogetdelim: remove dependency on realloc-posix
Paul Eggert [Wed, 17 Aug 2016 22:01:50 +0000 (15:01 -0700)]
getdelim: remove dependency on realloc-posix

* lib/canonicalize-lgpl.c (alloc_failed)
[!FUNC_REALPATH_WORKS || defined _LIBC]: New function,
(__realpath) [!FUNC_REALPATH_WORKS || defined _LIBC]: Use it.
Use __set_errno where needed, for consistency.
* lib/getdelim.c (alloc_failed): New function.
(getdelim): Use it.
* modules/getdelim (Depends-on): Remove realloc-posix.

8 years agoupdate from texinfo
Karl Berry [Wed, 17 Aug 2016 15:37:27 +0000 (08:37 -0700)]
update from texinfo

8 years agoupdate from texinfo
Karl Berry [Wed, 10 Aug 2016 14:12:01 +0000 (07:12 -0700)]
update from texinfo

8 years agoparse-datetime: add optional debug printing
Assaf Gordon [Sun, 7 Aug 2016 00:08:32 +0000 (20:08 -0400)]
parse-datetime: add optional debug printing

Print parsing information, warnings, and errors to stderr.

* lib/parse-datetime.h (parse_datetimte_debug): New global variable.
* lib/parse-datetime.y:
(DEBUG_*):  Macros calling debug functions if debugging is enabled.
(PROGRESS*): Same as DEBUG, for progress reporting.
(dbg_printf): Print message to stderr, with 'date' prefix.
(struct parser_control): Add 'debug_*_seen' variables.
(str_days): Converts day ordinal/number to string (e.g. 'last wed').
(debug_print_current_time, debug_print_relateive_time): Prints the
current/relative date/time value of parser_control.
(YACC parser syntax): Print parsed parts with DEBUG_* macros.
(to_year): Warn about 2-digit year parsing.
(yylex):   Warn about unrecognized words.
(get_effective_timezone): Returns current timezone in minutes.
(debug_strf{time,date,datetime}): Convert 'struct tm' to string as
clearly and unambigiously as possible.
(debug_mktime_not_ok): Print detailed information about failed
date/time values.
(parse_datetime): Add DEBUG messages for failures, warnings. Add
PROGRESS messages for status messages.
* modules/parse-datetime: Add 'timegm', 'gettext-h' dependencies.

8 years agoupdate from texinfo
Karl Berry [Tue, 9 Aug 2016 14:54:32 +0000 (07:54 -0700)]
update from texinfo

8 years agotests/init.sh: exclude dash with bad "local" semantics
Jim Meyering [Mon, 1 Aug 2016 16:37:15 +0000 (09:37 -0700)]
tests/init.sh: exclude dash with bad "local" semantics

* tests/init.sh (gl_shell_test_script_): Add a function to
eliminate a shell like "dash" (unlike bash, zsh) that has
surprising/risky "local var='...'" semantics.  Inspired by
the problem and discussion in https://bugs.gnu.org/24116#11.

8 years agoupdate from texinfo
Karl Berry [Mon, 8 Aug 2016 13:52:16 +0000 (06:52 -0700)]
update from texinfo

8 years agoupdate from texinfo
Karl Berry [Sat, 6 Aug 2016 15:18:27 +0000 (08:18 -0700)]
update from texinfo

8 years agoupdate from texinfo
Karl Berry [Thu, 4 Aug 2016 13:13:19 +0000 (06:13 -0700)]
update from texinfo

8 years agoupdate from texinfo
Karl Berry [Wed, 3 Aug 2016 14:05:05 +0000 (07:05 -0700)]
update from texinfo

8 years agomaint.mk: expand the prohibit_doubled_word regex
Ján Tomko [Tue, 2 Aug 2016 13:41:13 +0000 (15:41 +0200)]
maint.mk: expand the prohibit_doubled_word regex

This check has a static list of words that are checked for
repetitions.  Expand it before running the perl script to
avoid using expensive captures.  This decreases the cost
for libvirt from 1.66s to 0.66s.
* top/maint.mk (prohibit_doubled_word_expanded_): Define.
(sc_prohibit_doubled_word): Use it.

8 years agouseless-if-before-free: skip non-matching lines early
Ján Tomko [Mon, 1 Aug 2016 17:54:47 +0000 (10:54 -0700)]
useless-if-before-free: skip non-matching lines early

* build-aux/useless-if-before-free: First match each line with the
simple/quick /\bif\b/ and reject if there is no match. This often
saves the cost of the much more involved regular expression.
For libvirt, this decreases the cost from 1.44s to 1.02s.

8 years agoupdate from texinfo
Karl Berry [Tue, 2 Aug 2016 13:00:57 +0000 (06:00 -0700)]
update from texinfo

8 years agomaint.mk: speed up sc_po_check
Ján Tomko [Sat, 30 Jul 2016 05:39:31 +0000 (22:39 -0700)]
maint.mk: speed up sc_po_check

sc_po_check would skip files based on their names, or on the
existence of files with derived names. Rewrite it to use perl
instead of shell to make the check faster.
* top/maint.mk (perl_translatable_files_list_): Define.
(sc_po_check): Use it.

8 years agomaint.mk: speed up require_config_h_first
Ján Tomko [Tue, 26 Jul 2016 14:28:16 +0000 (16:28 +0200)]
maint.mk: speed up require_config_h_first

Instead of spawning three processes per file,
rewrite the check in perl and run it once for all the files.
* top/maint.mk (perl_config_h_first_): Define.
(sc_require_config_h_first): Use it in place of shell code.

8 years agomaint.mk: speed up sc_po_check
Ján Tomko [Sat, 30 Jul 2016 05:39:31 +0000 (22:39 -0700)]
maint.mk: speed up sc_po_check

sc_po_check would skip files based on their names, or on the
existence of files with derived names. Rewrite it to use perl
instead of shell to make the check faster.
* top/maint.mk (perl_translatable_files_list_): Define.
(sc_po_check): Use it.

8 years agoupdate from texinfo
Karl Berry [Mon, 1 Aug 2016 13:42:23 +0000 (06:42 -0700)]
update from texinfo

8 years agoupdate from texinfo
Karl Berry [Sun, 31 Jul 2016 17:52:14 +0000 (10:52 -0700)]
update from texinfo

8 years agoautoupdate
Karl Berry [Sun, 31 Jul 2016 17:52:02 +0000 (10:52 -0700)]
autoupdate

8 years agoautoupdate
Karl Berry [Fri, 22 Jul 2016 13:35:57 +0000 (06:35 -0700)]
autoupdate

8 years agoupdate from texinfo
Karl Berry [Thu, 21 Jul 2016 13:32:07 +0000 (06:32 -0700)]
update from texinfo

8 years agoautoupdate
Karl Berry [Tue, 19 Jul 2016 15:12:23 +0000 (08:12 -0700)]
autoupdate

8 years agoupdate from texinfo
Karl Berry [Sun, 17 Jul 2016 15:26:26 +0000 (08:26 -0700)]
update from texinfo

8 years agoobstack: pacify GCC 6 with -Wnull-dereference
Paul Eggert [Fri, 15 Jul 2016 08:35:22 +0000 (10:35 +0200)]
obstack: pacify GCC 6 with -Wnull-dereference

Problem reported by Assaf Gordon in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-07/msg00028.html
* lib/obstack.c, lib/obstack.h (obstack_alloc_failed_handler):
Declare with __attribute_noreturn__.
* lib/obstack.h (__attribute_noreturn__): New macro.

8 years agoupdate from texinfo
Karl Berry [Thu, 14 Jul 2016 15:36:45 +0000 (08:36 -0700)]
update from texinfo

8 years agodoc: mention glibc, OS X, Cygwin [S]SIZE_MAX buglet
Eric Blake [Wed, 13 Jul 2016 15:51:00 +0000 (09:51 -0600)]
doc: mention glibc, OS X, Cygwin [S]SIZE_MAX buglet

More platforms have similar bugs, and in the case of glibc on s390,
the bug is in SIZE_MAX instead of SSIZE_MAX.

* doc/posix-headers/stdint.texi (stdint.h): Document the bugs.
* doc/posix-headers/limits.texi (limits.h): Document the bugs.

Signed-off-by: Eric Blake <eblake@redhat.com>
8 years agodoc: mention glibc SSIZE_MAX buglet
Paul Eggert [Wed, 13 Jul 2016 09:42:40 +0000 (11:42 +0200)]
doc: mention glibc SSIZE_MAX buglet

* doc/posix-headers/limits.texi (limits.h): Document the bug.

8 years agoprintf-posix: Fix mingw build
Martin Kletzander [Mon, 4 Jul 2016 07:10:59 +0000 (09:10 +0200)]
printf-posix: Fix mingw build

Commit 54615b95ff238e235e806855efc46a9abad09f2e changed the regular
expression for detecting C symbol prefixes but forgot to qoute square
brackets in the command line arguments for grep.  That way when
building with mingw the condition was false although it ought to be
true instead.  In particular scenarios this led to the following
compile error:

    Cannot export rpl_printf: symbol not found
    Cannot export rpl_scanf: symbol not found
    collect2: error: ld returned 1 exit status

Fix this by properly quoting square brackets.

8 years agomktime: call tzset as per POSIX
Paul Eggert [Sun, 3 Jul 2016 10:59:54 +0000 (12:59 +0200)]
mktime: call tzset as per POSIX

Problem reported by Ludovic Courtès in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-06/msg00068.html
* lib/mktime.c (mktime) [!_LIBC && HAVE_TZSET]: Call tzset.
* m4/mktime.m4 (gl_FUNC_MKTIME): Check for tzset.

8 years agofts: handle readdir() errors
Pádraig Brady [Wed, 22 Jun 2016 12:49:53 +0000 (13:49 +0100)]
fts: handle readdir() errors

* lib/fts.c (fts_build): readdir(3) returns NULL when finished,
but also upon error when it will also set errno.  Therefore
flag the error case from readdir().  We treat the case where
no items are read the same as if the dir can't be accessed,
i.e. by setting fts_errno to FTS_DNR.

The bug was initially reported by Peter Benie
http://bugzilla.opensuse.org/show_bug.cgi?id=984910
where it was mentioned that readdir() may fail
when an NFS server has a poor readdir cookie implementation.

8 years agointprops: port better to GCC 7
Paul Eggert [Fri, 24 Jun 2016 11:35:12 +0000 (13:35 +0200)]
intprops: port better to GCC 7

GCC 7 __builtin_add_overflow supports a new usage form, where the
last argument is a null pointer, and which merely returns 1 if an
overflow would occur.  This is a constant expression if all
arguments are constants, and should generate faster code when code
needs to be generated.
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_WITH_NULL): New macro.
(_GL_ADD_OVERFLOW, _GL_SUBTRACT_OVERFLOW, _GL_MULTIPLY_OVERFLOW):
Use builtin operations if available.
(INT_NEGATE_OVERFLOW): Prefer INT_SUBTRACT_OVERFLOW if builtin
operations are available, as it's almost surely faster.

8 years agointprops-test: port to GCC 6
Paul Eggert [Thu, 23 Jun 2016 12:51:02 +0000 (14:51 +0200)]
intprops-test: port to GCC 6

* tests/test-intprops.c: Ignore -Woverflow if any GCC version,
since the bug is not fixed in GCC 6.1.

8 years agoautoupdate
Karl Berry [Mon, 20 Jun 2016 15:16:31 +0000 (08:16 -0700)]
autoupdate

8 years agoupdate from texinfo
Karl Berry [Sun, 19 Jun 2016 16:36:26 +0000 (09:36 -0700)]
update from texinfo

8 years agoautoupdate
Karl Berry [Tue, 14 Jun 2016 16:05:27 +0000 (09:05 -0700)]
autoupdate

8 years agoxalloc-oversized: port to GCC 7; fewer warnings
Paul Eggert [Mon, 13 Jun 2016 18:17:03 +0000 (11:17 -0700)]
xalloc-oversized: port to GCC 7; fewer warnings

GCC 7 will have a better way to deal with integer overflow.
Plus, fix a warnings problem reported by Tim Ruehsen in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-06/msg00022.html
* lib/xalloc-oversized.h (__xalloc_oversized): New macro.
(xalloc_oversized): Use plain __builtin_mul_overflow if GCC 7 or later.
For GCC 5, use __xalloc_oversized if both args are constants,
or if pedantic.

8 years agoautoupdate (gettext-0.19.8.1)
Karl Berry [Mon, 13 Jun 2016 15:37:24 +0000 (08:37 -0700)]
autoupdate (gettext-0.19.8.1)

8 years agoupdate from texinfo
Karl Berry [Thu, 9 Jun 2016 16:21:51 +0000 (09:21 -0700)]
update from texinfo

8 years agoregex: port to Sun C
Paul Eggert [Wed, 8 Jun 2016 08:46:35 +0000 (01:46 -0700)]
regex: port to Sun C

Reported by Daiki Ueno.
* lib/regcomp.c (regcomp, regerror): Use _Restrict_, not
__restrict, in prototype.  This fixes a problem I introduced in
the 2016-02-19 merge from glibc.

8 years agoupdate from texinfo
Karl Berry [Sat, 4 Jun 2016 12:49:04 +0000 (05:49 -0700)]
update from texinfo

8 years agostdbool: Restore __bool_true_false_are_defined check
Paul Eggert [Tue, 31 May 2016 16:03:15 +0000 (09:03 -0700)]
stdbool: Restore __bool_true_false_are_defined check

* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL):
__bool_true_false_are_defined is still defined, even with C++11.

8 years agostdbool: Port AC_CHECK_HEADER_STDBOOL to C++11
David Seifert [Mon, 30 May 2016 20:54:32 +0000 (22:54 +0200)]
stdbool: Port AC_CHECK_HEADER_STDBOOL to C++11

* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL): Port to C++11.
Copyright-paperwork-exempt: true

8 years agoUse GCC_LINT, not lint
Paul Eggert [Mon, 30 May 2016 19:18:19 +0000 (12:18 -0700)]
Use GCC_LINT, not lint

FreeBSD and Cygwin #define _Noreturn to empty if 'lint' is defined.
Problem reported by Ken Brown in: http://bugs.gnu.org/23640
* doc/posix-headers/stdnoreturn.texi (stdnoreturn.h):
Document problem with lint and _Noreturn.
* lib/diffseq.h (IF_LINT, IF_LINT2):
* lib/fts.c (sccsid):
* lib/getndelim2.c (IF_LINT):
* lib/gl_anylinked_list2.h (gl_linked_iterator)
(gl_linked_iterator_from_to):
* lib/gl_anytree_list2.h (gl_tree_iterator)
(gl_tree_iterator_from_to):
* lib/gl_anytree_oset.h (gl_tree_iterator):
* lib/gl_array_list.c (gl_array_iterator)
(gl_array_iterator_from_to):
* lib/gl_array_oset.c (gl_array_iterator):
* lib/gl_carray_list.c (gl_carray_iterator)
(gl_carray_iterator_from_to):
* lib/idcache.c:
* lib/inet_ntop.c (IF_LINT):
* lib/regcomp.c (build_charclass_op, create_tree):
* lib/regex_internal.c (re_acquire_state)
(re_acquire_state_context):
* lib/trigl.c (rcsid):
* lib/trim.c (IF_LINT):
* lib/vasnprintf.c (IF_LINT):
* lib/verify.h (assume):
Treat GCC_LINT like lint.

8 years agosecure_getenv: Port to many more platforms.
Bruno Haible [Sun, 29 May 2016 10:54:32 +0000 (12:54 +0200)]
secure_getenv: Port to many more platforms.

* m4/secure_getenv.m4 (gl_PREREQ_SECURE_GETENV): Also check for get*id
functions.
* lib/secure_getenv.c (secure_getenv): Add alternate implementations
for non-BSD Unix platforms and for native Windows.
* doc/glibc-functions/secure_getenv.texi: Remove known issue.
Prompted by a request from Nikos Mavrogiannopoulos.

8 years agoupdate from texinfo
Karl Berry [Sat, 28 May 2016 15:39:46 +0000 (08:39 -0700)]
update from texinfo

8 years agocanonicalize: Fix broken probe for realpath.
Eric Blake [Fri, 27 May 2016 20:04:35 +0000 (14:04 -0600)]
canonicalize: Fix broken probe for realpath.

Noticed in libvirt due to rpl_canonicalize being compiled on
glibc where it used to rely on the libc version.

* m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Fix regression
in logic introduced in 54615b95.

Signed-off-by: Eric Blake <eblake@redhat.com>
8 years agounsetenv: relax to LGPLv2+
Eric Blake [Thu, 26 May 2016 14:47:27 +0000 (08:47 -0600)]
unsetenv: relax to LGPLv2+

Especially since setenv is also LGPLv2+, and it makes sense for the
two modules to stay in sync, rather than one to be usable only in
LPGLv3+ projects.

* modules/unsetenv (License): Match setenv license.

Signed-off-by: Eric Blake <eblake@redhat.com>
8 years agoupdate from texinfo
Paul Eggert [Thu, 26 May 2016 19:31:40 +0000 (12:31 -0700)]
update from texinfo

8 years agogendocs.sh: Set default TOP_NODE_UP_URL in HTML output.
Ludovic Courtès [Sat, 7 May 2016 17:15:26 +0000 (19:15 +0200)]
gendocs.sh: Set default TOP_NODE_UP_URL in HTML output.

Suggested by Gavin Smith <gavinsmith0123@gmail.com>.
Reported by myglc2 <myglc2@gmail.com> in <http://bugs.gnu.org/22651>.

* build-aux/gendocs.sh (MANUAL_TITLE, PACKAGE, EMAIL)
(commonarg, dirargs, dirs, infoarg, generate_ascii)
(generate_html, generate_info, generate_tex, outdir)
(source_extra, split, srcfile, texarg): Move above 'version'.
(htmlarg): Likewise, and add "-c TOP_NODE_UP_URL=/manual".

8 years agomanywarnings: update for GCC 6.1
Paul Eggert [Tue, 17 May 2016 16:08:02 +0000 (09:08 -0700)]
manywarnings: update for GCC 6.1

* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Add GCC 6.1 options that apply to C.
* build-aux/gcc-warning.spec: Add GCC 6.1 options that
do not apply to C, are obsolescent, etc.

8 years agoautoupdate
Karl Berry [Mon, 16 May 2016 15:05:06 +0000 (08:05 -0700)]
autoupdate

8 years agointdiv0, memmem, nocrash, strcasestr, strstr: no exit
Nikos Mavrogiannopoulos [Fri, 13 May 2016 19:10:03 +0000 (12:10 -0700)]
intdiv0, memmem, nocrash, strcasestr, strstr: no exit

Do not call 'exit' in a signal handler, as this is not
portable.  Call '_exit' instead.  This addresses an issue with tests
not being terminated.

8 years agoglob: size_t overflow checks
Paul Eggert [Fri, 13 May 2016 06:08:22 +0000 (23:08 -0700)]
glob: size_t overflow checks

* lib/glob.c (__has_builtin): New macro.
(size_add_wrapv, glob_use_alloca): New static functions.
(glob, glob_in_dir): Check for size_t overflow in several places,
and fix some size_t checks that were not quite right.

8 years agoglob: don't assume INT_MAX < SIZE_MAX
Paul Eggert [Mon, 9 May 2016 15:53:10 +0000 (08:53 -0700)]
glob: don't assume INT_MAX < SIZE_MAX

* lib/glob.c (glob): Prefer SIZE_MAX to ~((size_t) 0), as the
latter is not portable to (probably theoretical) hosts where
SIZE_MAX <= INT_MAX.

8 years agoFix undefined behaviour in gettext.h.
Bruno Haible [Mon, 9 May 2016 07:29:35 +0000 (09:29 +0200)]
Fix undefined behaviour in gettext.h.

* lib/gettext.h (dcpgettext_expr, dcnpgettext_expr): Avoid accessing a
pointer's value after the storage it points to has been freed.
Reported by Michael Pyne in https://savannah.gnu.org/bugs/?47847.
Spotted by Coverity.

8 years agoautoupdate
Karl Berry [Wed, 11 May 2016 15:24:14 +0000 (08:24 -0700)]
autoupdate

9 years agogit-version-gen: avoid undefined shift
Paul Eggert [Sun, 8 May 2016 18:38:22 +0000 (11:38 -0700)]
git-version-gen: avoid undefined shift

Problem reported by Mosè Giordano in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-05/msg00012.html
* build-aux/git-version-gen: Avoid undefined behavior if invoked
with --prefix or --fallback but without a later argument.  While
we're at it, omit unnecessary quotes.

9 years agoupdate from texinfo
Karl Berry [Sun, 8 May 2016 16:11:48 +0000 (09:11 -0700)]
update from texinfo

9 years agoglob: merge glibc changes into lib/glob.c
Paul Eggert [Wed, 4 May 2016 16:57:48 +0000 (09:57 -0700)]
glob: merge glibc changes into lib/glob.c

* lib/glob.c (glob_in_dir): Sync with glibc/posix/glob.c,
dated 2016-05-04 12:09:35 2016 +0200.  Here are the changes:
2016-05-04 CVE-2016-1234: glob: Do not copy d_name field of
  struct dirent [BZ #19779]
2016-04-29 glob: Simplify the interface for the GLOB_ALTDIRFUNC
  callback gl_readdir
2015-10-20 Convert miscellaneous function definitions to prototype style
2015-10-20 Convert 113 more function definitions to prototype style
  (files with assertions)
2015-06-12 Fix getlogin_r namespace (bug 18527).
2014-02-10 Use glibc_likely instead __builtin_expect.
2013-10-20 When glob pattern contains a trailing slash match only
  directories. Fixes bug 10278.
2013-09-04 glob: silence -Wattribute warnings
2013-06-07 Avoid use of "register" as optimization hint.
2012-09-25 Use size_t instead of int for internal variables in glob
  (bug 14621)
2011-07-20 Check for overflows in expressions
2011-05-28 Remove unused variable
2011-05-22 Add a few more alloca size checks
2010-03-27 Whitespace fixes
2010-03-27 Fix one more issue with the glob patch
2010-03-24 Fix glob with empty pattern
2008-05-27 Remove useless more "if" tests before "free"
* modules/glob (Depends-on): Add stdint.

9 years agomktime: spelling fix in comment
Paul Eggert [Mon, 2 May 2016 01:49:47 +0000 (18:49 -0700)]
mktime: spelling fix in comment

* lib/mktime.c: Fix spelling.

9 years agomktime: port to stricter signed overflow checking
Paul Eggert [Mon, 2 May 2016 00:25:16 +0000 (17:25 -0700)]
mktime: port to stricter signed overflow checking

* lib/mktime.c: Omit 'pragma GCC optimize ("wrapv")'.
(long_int): Require width for INT_MAX * 3 * (seconds per year),
instead of merely for INT_MAX * 2.  In practice platforms that
do the latter also do the former.
(TIME_T_MIN, TIME_T_MAX, TIME_T_MIDPOINT, SHR): Remove.
(shr): New static function, replacing SHR.  All uses changed.
(mktime_min, mktime_max): New constants, replacing TIME_T_MIN
and TIME_T_MAX.  All uses changed.
(ydhms_diff, guess_time_tm, ranged_convert, __mktime_internal):
Use long_int, not time_t.
(long_int_avg): New static function, replacing time_t_avg.
All uses changed.  Round toward positive infinity, as that
generates slightly better code.
(time_t_add_ok, time_t_int_add_ok): Remove.  All uses replaced
by INT_ADD_WRAPV.
(guess_time_tm): Accept time, not a pointer to it.  All uses changed.
(convert_time): New static function.
(ranged_convert): Use it
(ranged_convert): Check for *T out of [mktime_min, mktime_max] range.
Use simpler test for loop exit.
(__mktime_internal): Store negative of guessed offset, to simplify
overflow checking.  Remove no-longer-needed test for small time_t
overflows.

9 years agomktime: speed up DEBUG_MKTIME benchmarks
Paul Eggert [Sun, 1 May 2016 19:49:21 +0000 (12:49 -0700)]
mktime: speed up DEBUG_MKTIME benchmarks

Call tzset just once, at the start, rather than for every test
case.  This lets us measure the CPU cost of mktime as opposed to
that of tzset.  This is relevant when TZ is not set and glibc is
being used.  This speeds up tests by a factor of 40 on my Fedora
23 x86-64 platform.
* lib/mktime.c (main) [DEBUG_MKTIME]: Call localtime at the start,
to call tzset and as a sanity check.  Later on, use localtime_r
instead of localtime.

9 years agomktime: resurrect DEBUG_MKTIME testing
Paul Eggert [Sun, 1 May 2016 19:15:52 +0000 (12:15 -0700)]
mktime: resurrect DEBUG_MKTIME testing

* lib/mktime.c [DEBUG_MKTIME]: Do not include <config.h>.
Include <string.h>, for strcmp.

9 years agomktime: simplify DEBUG_MKTIME
Paul Eggert [Sun, 1 May 2016 19:10:37 +0000 (12:10 -0700)]
mktime: simplify DEBUG_MKTIME

* lib/mktime.c (DEBUG_MKTIME): Define to 0 if not defined.
Simplify later usage accordingly.

9 years agoPort mktime_internal offset to unsigned time_t
Paul Eggert [Sun, 1 May 2016 18:44:51 +0000 (11:44 -0700)]
Port mktime_internal offset to unsigned time_t

This avoids some assumptions about wraparound arithmetic on
signed integer overflow.
* lib/mktime-internal.h (mktime_offset_t): New type.
(mktime_internal): Use it in decl.
* lib/mktime.c, lib/timegm.c (mktime_offset_t) [_LIBC]: New type.
* lib/mktime.c (__mktime_internal, localtime_offset):
* lib/timegm.c (timegm): Use it.
* m4/mktime.m4 (gl_TIME_T_IS_SIGNED): New macro.
(gl_FUNC_MKTIME): Require it.

9 years agoxstrtol: prohibit monstrosities like "1bB"
Paul Eggert [Wed, 27 Apr 2016 19:10:54 +0000 (12:10 -0700)]
xstrtol: prohibit monstrosities like "1bB"

Problem reported by Young Mo Kang in: http://bugs.gnu.org/23388
* lib/xstrtol.c (__xstrtol): Allow trailing second suffixes like
"B" only if the first suffix needs a base.
* tests/test-xstrtol.sh: Test this.

9 years agoxstrtod: reinstate setting of *result upon ERANGE
Pádraig Brady [Thu, 21 Apr 2016 11:20:58 +0000 (12:20 +0100)]
xstrtod: reinstate setting of *result upon ERANGE

* lib/xstrtod.c (XSTRTOD): The user may decide to use
the returned limits upon ERANGE, so allow and document that.

9 years agoxstrtod: modify *result only if no errors
Tino Calancha [Wed, 20 Apr 2016 22:33:39 +0000 (15:33 -0700)]
xstrtod: modify *result only if no errors

* lib/xstrtod.c (XSTRTOD).
Copyright-paperwork-exempt: yes

9 years agobtowc: document problems in C locale
Paul Eggert [Tue, 19 Apr 2016 16:11:34 +0000 (09:11 -0700)]
btowc: document problems in C locale

* doc/posix-functions/btowc.texi (btowc): Mention incompatibility
with mbrtowc.  See: http://bugs.gnu.org/23269#32

9 years agoautoupdate
Karl Berry [Fri, 15 Apr 2016 14:41:08 +0000 (07:41 -0700)]
autoupdate

9 years agoupdate from texinfo
Karl Berry [Thu, 14 Apr 2016 15:33:01 +0000 (08:33 -0700)]
update from texinfo

9 years agomktime: improve integer overflow checking
Paul Eggert [Wed, 13 Apr 2016 17:53:56 +0000 (10:53 -0700)]
mktime: improve integer overflow checking

* lib/mktime.c: Include stdbool.h, intprops.h, verify.h.
(WRAPV): Remove; no longer needed.
(verify): Remove.  Replace all uses with call to verify.h 'verify'.
(TYPE_IS_INTEGER, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM):
Remove.  Use intprops.h defns instead.
(leapyear, isdst_differ, time_t_add_ok, time_t_int_ok):
Use bool for Boolean, for clarity.
(time_t_add_ok, time_t_int_add_ok): Use INT_ADD_WRAPV to
detect integer overflow.
* modules/mktime (Depends-on): Add intprops, stdbool, verify.

9 years agointprops: check two's complement assumption
Paul Eggert [Wed, 13 Apr 2016 17:49:08 +0000 (10:49 -0700)]
intprops: check two's complement assumption

Suggested by Eric Blake in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-04/msg00016.html
* lib/intprops.h: Include <verify.h>.  Verify that signed char,
short, int, long, and (if available) long long are two's complement.
* modules/intprops (Depends-on): Add 'verify'.

9 years agointprops, mktime, strtol: assume two's complement
Paul Eggert [Wed, 13 Apr 2016 07:06:36 +0000 (00:06 -0700)]
intprops, mktime, strtol: assume two's complement

These macros were not portable to every conforming C11 ones'
complement platform.  It's not worth the hassle of porting to some
platforms that use ones' complement or signed magnitude, as such
platforms are almost purely theoretical nowadays and porting even
to some of them makes the code harder to review for little
practical benefit.  Problem reported by Florian Weimer in:
https://sourceware.org/ml/libc-alpha/2016-04/msg00295.html
* lib/intprops.h (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT)
(TYPE_SIGNED_MAGNITUDE, _GL_INT_TWOS_COMPLEMENT):
* lib/mktime.c (TYPE_TWOS_COMPLEMENT):
* lib/strtol.c (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT)
(TYPE_SIGNED_MAGNITUDE):
Remove.  All uses rewritten to assume two's complement, which is
all we can reasonably test nowadays anyway.
* top/maint.mk (_intprops_names): Remove the removed macros.

9 years agostdint: port to strict C11 left shift
Paul Eggert [Mon, 11 Apr 2016 15:42:02 +0000 (08:42 -0700)]
stdint: port to strict C11 left shift

* lib/stdint.in.h (_STDINT_MIN, _STDINT_MAX):
Pacify clang -Wshift-negative-value, which should be an issue only
on clang setups where stdint.h does not conform to C11 or to C++11.
Problem reported by Philipp Stephani in: http://bugs.gnu.org/23261

9 years agombrtowc: work around glibc bug#19932
Paul Eggert [Sat, 9 Apr 2016 08:28:36 +0000 (01:28 -0700)]
mbrtowc: work around glibc bug#19932

Fix mbrtowc so that it never returns -1 in the C locale,
as this conflicts with a future version of POSIX
http://austingroupbugs.net/view.php?id=663#c2738
and causes problems with GNU grep: http://bugs.gnu.org/23234
See glibc bug 19932:
https://sourceware.org/bugzilla/show_bug.cgi?id=19932
* doc/posix-functions/mbrlen.texi (mbrlen):
* doc/posix-functions/mbrtowc.texi (mbrtowc):
Document the glibc bug.
* lib/mbrtowc.c [C_LOCALE_MAYBE_EILSEQ]:
Include hard-locale.h, locale.h.
(rpl_mbrtowc): Work around the C_LOCALE_MAYBE_EILSEQ bug,
if the bug is possible.
* m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): New macro.
(gl_FUNC_MBRTOWC): Use it, and define C_LOCALE_MAYBE_EILSEQ as needed.
* modules/hard-locale (License): Now LGPLv2+, for mbrtowc.
* modules/mbrtowc (Depends-on): Add hard-locale.
* modules/mbrtowc-tests (Files, TESTS): Add tests/test-mbrtowc5.sh.
* tests/test-mbrtowc.c (main): Test for bug fix if arg is '5'.
* tests/test-mbrtowc5.sh: New file.

9 years agoupdate from texinfo
Karl Berry [Wed, 6 Apr 2016 21:02:39 +0000 (14:02 -0700)]
update from texinfo

9 years agoautoupdate
Karl Berry [Tue, 5 Apr 2016 15:57:36 +0000 (08:57 -0700)]
autoupdate

9 years agostdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves [Mon, 4 Apr 2016 05:48:22 +0000 (22:48 -0700)]
stdint: detect good enough pre-C++11 stdint.h in C++ mode

When gnulib is configured in C++ mode for a system with a working C99
implementation of stdint.h that predates C++11, gnulib ends up
substituting stdint.h anyway.  This works on most targets, but on e.g.,
64-bit MinGW, it doesn't, as gnulib's substitute assumes LP64, while
MinGW is LLP64.  Instead of trying to detect the right types, detect
good-enough-pre-C++11 stdint.h and in such case define
__STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS in config.h.
* m4/stdint.m4 (gl_STDINT_H): Always define __STDC_CONSTANT_MACROS
/ __STDC_LIMIT_MACROS while checking whether the system stdint.h
conforms to C99.  If it does, check whether it hides symbols
behind the __STDC_{CONSTANT|LIMIT}_MACROS macros.  Then if it
does, define those macros in config.h.

9 years agoargp: merge changes from glibc
Paul Eggert [Sun, 3 Apr 2016 23:37:13 +0000 (16:37 -0700)]
argp: merge changes from glibc

Among other things, this should fix problems found by a Coverity
scan and reported by Andrei Borzenkov:
http://lists.gnu.org/archive/html/bug-gnulib/2016-01/msg00015.html
http://lists.gnu.org/archive/html/bug-gnulib/2016-01/msg00016.html
* lib/argp-ba.c, lib/argp-fmtstream.c, lib/argp-fmtstream.h:
* lib/argp-fs-xinl.c, lib/argp-help.c, lib/argp-namefrob.h:
* lib/argp-parse.c, lib/argp-pv.c, lib/argp-pvh.c, lib/argp-xinl.c:
* lib/argp.h:
Merge changes from glibc.
* tests/test-argp-2.sh: Adjust to match new behavior.

9 years agoPrefer American spelling for "initialize"
Paul Eggert [Sun, 3 Apr 2016 21:01:43 +0000 (14:01 -0700)]
Prefer American spelling for "initialize"

9 years agoautoupdate
Karl Berry [Sat, 2 Apr 2016 15:43:06 +0000 (08:43 -0700)]
autoupdate

9 years agostddef: support configuring with g++
Paul Eggert [Sat, 2 Apr 2016 04:01:17 +0000 (21:01 -0700)]
stddef: support configuring with g++

Problem reported by Ángel González in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-04/msg00003.html
* lib/stddef.in.h (_GL_STDDEF_ALIGNAS, max_align_t):
Do not define if _GCC_MAX_ALIGN_T is defined.

9 years agoautoupdate
Karl Berry [Thu, 31 Mar 2016 17:16:15 +0000 (10:16 -0700)]
autoupdate

9 years agoautoupdate
Karl Berry [Wed, 30 Mar 2016 14:30:18 +0000 (07:30 -0700)]
autoupdate

9 years agoupdate from texinfo
Karl Berry [Sat, 26 Mar 2016 14:32:21 +0000 (07:32 -0700)]
update from texinfo

9 years agotest-framework-sh: minor cleanups
Paul Eggert [Fri, 25 Mar 2016 19:25:37 +0000 (12:25 -0700)]
test-framework-sh: minor cleanups

* tests/init.sh (testdir_prefix_): Output a trailing newline,
since strictly speaking POSIX requires this.
(setup_): Do not use the variable 'fail', as that makes the
trace output harder to read ('fail' is typically used by
tests to mean the test failed).  Treat // portably.
Check that new directory is not merely a sibling of the tmp dir.
Avoid unnecessary invocation of tr.

9 years agotest-framework-sh: revert port to NetBSD 7.0
Paul Eggert [Fri, 25 Mar 2016 19:00:35 +0000 (12:00 -0700)]
test-framework-sh: revert port to NetBSD 7.0

It was a false alarm; I misinterpreted Assaf Gordon's report.
* tests/init.sh (testdir_prefix_, pfx_, template_length_):
Restore.
(test_dir_): Adjust to mktempd_ change.
(mktempd_): Restore 2nd arg.  Use -t again.
(base_template_, template_, nx_): Resurrect old code.