* gnulib-tool (func_emit_pre_early_macros): New function, it wraps
emitting of initial gl_EARLY macros.
(func_import, func_create_testdir): All dumps of gl_PROG_AR_RANLIB
replaced with func_emit_pre_early_macros call.
Pádraig Brady [Fri, 2 Oct 2015 19:21:50 +0000 (20:21 +0100)]
xalloc: avoid GCC 5.1 warning on 32 bit
* lib/xalloc.h: Disable -Wstrict-overflow for uses of
xalloc_oversized(), which was seen to give this warning
on GCC 5.1 on 32 bit: "assuming signed overflow does not occur
when simplifying conditional".
Daiki Ueno [Fri, 2 Oct 2015 02:27:40 +0000 (11:27 +0900)]
uniname/uniname-tests: avoid compiler warnings
* tests/uniname/test-uninames.c (fill_names, fill_aliases): Remove
unused local variables.
(test_alias_lookup): Fix alias name display in failure cases.
Paul Eggert [Sun, 27 Sep 2015 06:55:07 +0000 (23:55 -0700)]
c-ctype: do not worry about EBCDIC + char signed
Drop support for EBCDIC with char being signed, as this breaks too
many programs. Problem reported by Ben Pfaff in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-09/msg00053.html
* lib/c-ctype.h: Verify that we are not using EBCDIC with
char being signed.
(_C_CTYPE_LOWER_A_THRU_F_N): New macro.
(_C_CTYPE_LOWER_N, _C_CTYPE_A_THRU_F): Use it.
(_C_CTYPE_DIGIT, _C_CTYPE_LOWER, _C_CTYPE_PUNCT, _C_CTYPE_UPPER):
(c_isascii, c_isgraph, c_isprint, c_ispunct, c_tolower, c_toupper):
* tests/test-c-ctype.c (test_all):
Simplify by assuming standard char values cannot be negative.
* tests/test-c-ctype.c (NCHARS, to_char): Remove; all uses removed.
Paul Eggert [Sat, 26 Sep 2015 02:45:59 +0000 (19:45 -0700)]
c-ctype: port better to z/OS EBCDIC
Problems reported by Daniel Richard G. in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-09/msg00050.html
* lib/c-ctype.h (_C_CTYPE_CNTRL): Rewrite in terms of
the C standard escapes and _C_CTYPE_OTHER_CNTRL.
(_C_CTYPE_OTHER_CNTRL): New macro.
* tests/test-c-ctype.c (test_all): Test from CHAR_MIN, not
from SCHAR_MIN, as the functions are defined only from values
promoted from char or from unsigned char, not necessarily from
signed char.
The gl_PROG_AR_RANLIB (it is always called by gl_EARLY) sets AR
and ARFLAGS variables. Doing this unconditionally could break
later Automake's AM_PROG_AR invocation (at least it's
AC_CHECK_TOOLS call to detect correct 'ar' binary).
Original purpose of the gl_PROG_AR_RANLIB was only to handle the
Amsterdam Compiler Kit, so make the previous code to have effects
only on ACK, and rather automatically call the Automake's
AM_PROG_AR as soon as possible to decide other cases.
* m4/gnulib-common.m4 (gl_PROG_AR_RANLIB): AC_BEFORE AM_PROG_AR.
Set the AR/ARFLAGS to ACK defaults OR call AM_PROG_AR. If neither
is possible, keep setting AR/ARFLAGS to reasonable defaults.
* gnulib-tool (func_import): Put the gl_USE_SYSTEM_EXTENSIONS
right before gl_PROG_AR_RANLIB into gnulib-comp.m4 (if the
'extensions' module is used.
* modules/extensions (configure.ac-early): Remove as this snippet
is added to gnulib-comp.m4 earlier anyway.
Paul Eggert [Fri, 25 Sep 2015 18:16:27 +0000 (11:16 -0700)]
sockets: MS Windows initalization fixes
Problem reported by Test User in:
http://lists.gnu.org/archive/html/help-shishi/2015-09/msg00001.html
* lib/sockets.h (SOCKETS_1_0, SOCKETS_2_0, SOCKETS_2_1):
Correct the endianness.
* lib/sockets.c (gl_sockets_startup): Return 2 on any version
number mismatch, not just on <. Cleanup before any such failure.
* m4/gc.m4: Use AM_PATH_LIBCRYPT to test for libcrypt versions
at least as recent as 1.4.4. The previously used macro is not
available now, since modules were removed in version 1.6.0.
Paul Eggert [Fri, 25 Sep 2015 07:01:10 +0000 (00:01 -0700)]
c-ctype: rewrite to use inline functions
This simplifies maintenance, since it makes for just one
implementation of each function, letting the compiler have the fun
of optimization. In practice this works well nowadays with GCC.
E.g., c_isascii might need only three instructions even though the
source code lists every ASCII character individually in a large
switch statement.
Also, fix some z/OS porting bugs reported by Daniel Richard G. in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-09/msg00037.html
* NEWS: Document the API change.
* lib/c-ctype.c: Drastically simplify, since this now just expands
inline functions.
* lib/c-ctype.h: Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
(C_CTYPE_INLINE): New macro.
(C_CTYPE_CONSECUTIVE_DIGITS, C_CTYPE_CONSECUTIVE_LOWERCASE)
(C_CTYPE_CONSECUTIVE_UPPERCASE): Remove.
Verify that either ASCII or EBCDIC is being used.
(_C_CTYPE_SIGNED_EBCDIC, _C_CTYPE_CNTRL, _C_CTYPE_A_THRU_F_N)
(_C_CTYPE_DIGIT_N, _C_CTYPE_LOWER_N, _C_CTYPE_UPPER_N)
(_C_CTYPE_CASES, _C_CTYPE_A_THRU_F, _C_CTYPE_DIGIT, _C_CTYPE_LOWER)
(_C_CTYPE_UPPER, _C_CTYPE_PUNCT_PLAIN):
New private macros.
(_C_CTYPE_CNTRL): In EBCDIC, '\x07' is a control, not '\xff'.
(c_isalnum, c_isalpha, c_isascii, c_isblank, c_iscntrl, c_isdigit)
(c_isgraph, c_islower, c_isprint, c_ispunct, c_isspace, c_isupper)
(c_isxdigit, c_tolower, c_toupper): Now inline functions.
(c_tolower, c_toupper): When converting, return the unsigned char,
as that is what z/OS does.
* lib/c-strcaseeq.h (CASEEQ): Simplify in the light of the removal
of some c-ctype.h macros.
* modules/c-ctype (Depends-on): Add extern-inline; remove verify.
* tests/test-c-ctype.c (test_all): Fix test for c_toupper and
c_tolower promotion to be compatible with z/OS.
Paul Eggert [Thu, 24 Sep 2015 20:22:23 +0000 (13:22 -0700)]
maint: add coding cookies to non-ASCII sources
Otherwise, Emacs might do the wrong thing if run in an
he_IL.ISO-8859-8 locale, which an Emacs developer does on occasion.
Problem reported by Eli Zaretskii in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00966.html
Don't bother with test files, as they aren't copied to the Emacs
source directory. If this problem affects test files in some other
GNU project, we can add coding cookies to the non-ASCII test files
later.
Pavel Raiskup [Thu, 24 Sep 2015 15:17:38 +0000 (17:17 +0200)]
gitlog-to-changelog: trim only trailing whitespaces
This is fix for --format regression introduced by commit 2b93079a5d1baa4d; it caused that --format='%s%n%n%b%n' (see the
doubled %n string) had no effect anymore. This format
specification has been used e.g. by GNU paxuitils (commit edfd8bcc3).
* build-aux/gitlog-to-changelog (main): Stop squashing multiple
newlines in commmit messages.
Paul Eggert [Wed, 23 Sep 2015 19:26:38 +0000 (12:26 -0700)]
Test that c_iscntrl agrees with iscntrl, etc.
Suggested by Daniel Richard G. in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-09/msg00034.html
* modules/c-ctype-tests (Depends-on): Add ctype.
* tests/test-c-ctype.c: Include <ctype.h>.
(NCHARS): New constant.
(test_agree_with_C_locale): New function.
(main): Use it.
(test_all): Use named constants.
Paul Eggert [Wed, 23 Sep 2015 03:04:13 +0000 (20:04 -0700)]
savewd: remove SAVEWD_CHDIR_READABLE
It was problematic in the light of file systems that ignore umask.
Problem reported by Sebastian Ungar in: http://bugs.gnu.org/21534
* NEWS: Document this.
* lib/mkancesdirs.c (mkancesdirs): MAKE_DIR now returns 0 if
successful, -1 (setting errno) on failure, rather than something
more complicated than that.
* lib/mkdir-p.c (make_dir_parents):
Do not use SAVEWD_CHDIR_READABLE.
* lib/savewd.c (savewd_chdir):
Remove support for SAVEWD_CHDIR_READABLE.
* lib/savewd.h (SAVEWD_CHDIR_READABLE): Remove.
Paul Eggert [Tue, 22 Sep 2015 21:47:06 +0000 (14:47 -0700)]
c-ctype: assume EBCDIC 1047 for c_iscntrl
* lib/c-ctype.c (c_iscntrl): When EBCDIC, assume code page 1047 at
both compile-time and at run-time. Check it at compile-time. We can
worry about other code pages later, if the topic ever comes up.
Fix typo in C_CTYPE_EBCDIC.
Paul Eggert [Tue, 22 Sep 2015 19:17:06 +0000 (12:17 -0700)]
c-ctype: port better to EBCDIC
Problems reported by Daniel Richard G. in
http://lists.gnu.org/archive/html/bug-gnulib/2015-09/msg00020.html
* lib/c-ctype.c: Include <limits.h>, for CHAR_MIN and CHAR_MAX.
Include "verify.h".
(C_CTYPE_ASCII, C_CTYPE_CONSECUTIVE_DIGITS)
(C_CTYPE_CONSECUTIVE_LOWERCASE, C_CTYPE_CONSECUTIVE_UPPERCASE):
Define as enum constants with value false, if not defined, so that
code can use 'if' instead of 'ifdef'. Using 'if' helps make the
code more portable, as both branches of the 'if' are compiled on
all platforms.
(C_CTYPE_EBCDIC): New constant.
(to_char): New static function.
(c_isalnum, c_isalpha, c_isdigit, c_islower, c_isgraph, c_isprint)
(c_ispunct, c_isupper, c_isxdigit, c_tolower, c_toupper):
Rewrite to use 'if' instead of 'ifdef'.
Use to_char if non-ASCII. Prefer <= to >=.
Prefer true and false to 1 and 0, for booleans.
(c_iscntrl): Use 'if', not 'ifdef'. Special case for EBCDIC.
Verify that the character set is either ASCII or EBCDIC.
* tests/test-c-ctype.c: Include <limits.h>, for CHAR_MIN
(to_char): New function.
(test_all): Port to EBCDIC. Add some more tests, e.g., for c_ispunct.
nanosleep: fix return code for interrupted replacement
* lib/nanosleep.c (nanosleep): In the replaced nanosleep, ensure
that we return -1 in the case the call is interrupted by a signal,
rather than the current value of 1.
Diagnosed and tested by Daniel Richard G.
Paul Eggert [Sat, 19 Sep 2015 20:53:34 +0000 (13:53 -0700)]
Diagnose ERE '()|\1'
Problem reported by Hanno Böck in: http://bugs.gnu.org/21513
* lib/regcomp.c (parse_reg_exp): While parsing alternatives, keep
track of the set of previously-completed subexpressions available
before the first alternative, and restore this set just before
parsing each subsequent alternative. This lets us diagnose the
invalid back-reference in the ERE '()|\1'.
Paul Eggert [Sat, 19 Sep 2015 17:16:02 +0000 (10:16 -0700)]
regex: fix dangling-backreference bug
This should fix the following bugs:
http://bugs.gnu.org/21513 assertion error in pop_fail_stack
http://bugs.gnu.org/19775 Test failing after the CVE fix
https://sourceware.org/bugzilla/show_bug.cgi?id=11053
Wrong results with backreferences
https://sourceware.org/bugzilla/show_bug.cgi?id=17356
regex assertion violation with triple backreferences
* lib/regexec.c (set_regs): Don't pop an empty failure stack.
Paul Eggert [Sat, 19 Sep 2015 16:21:47 +0000 (09:21 -0700)]
regex: merge patches from libc
2015-09-08 Joseph Myers <joseph@codesourcery.com>
Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912).
* lib/regex_internal.h:
Include <libc-lock.h> instead of <bits/libc-lock.h>.
2015-06-05 Joseph Myers <joseph@codesourcery.com>
Fix regex wcrtomb namespace (bug 18496).
* lib/regex_internal.c (build_wcs_upper_buffer): Call __wcrtomb
instead of wcrtomb.
2015-06-05 Joseph Myers <joseph@codesourcery.com>
Fix regex wctype namespace (bug 18495).
* lib/regcomp.c (re_compile_fastmap_iter): Call __towlower
instead of towlower.
* lib/regex_internal.c (build_wcs_upper_buffer): Call __iswlower
instead of iswlower. Call __towupper instead of towupper.
* lib/regex_internal.h (IS_WIDE_WORD_CHAR): Call __iswalnum
instead of iswalnum.
2015-01-07 Chris Metcalf <cmetcalf@ezchip.com>
* lib/regcomp.c (parse_bracket_exp): Initialize type to
COLL_SYM in a couple of places to avoid uninitialized variable
wanings on tilegx gcc 4.8.2.
2014-11-17 Andreas Schwab <schwab@suse.de>
* lib/regex_internal.h: Don't include <locale/elem-hash.h>.
2014-09-11 Roland McGrath <roland@hack.frob.com>
Move findidx nested functions to top-level.
* lib/regcomp.c [_LIBC]: #include <locale/weight.h>.
(build_equiv_class) [_LIBC]: Don't #include it inside the function.
Pass new arguments to findidx.
* lib/regexec.c [RE_ENABLE_I18N] [_LIBC]: #include <locale/weight.h>.
[RE_ENABLE_I18N] (check_node_accept_bytes) [_LIBC]:
Don't #include it inside the function. Pass new arguments to findidx.
* lib/regex_internal.h:
[!NOT_IN_libc] [_LIBC]: #include <locale/weight.h>.
(re_string_elem_size_at): Don't #include it inside the function.
Pass new arguments to findidx.
2014-08-01 Siddhesh Poyarekar <siddhesh@redhat.com>
Check if DEBUG is defined in regex_internal.c
* lib/regex_internal.c: Check if DEBUG is defined and is set.
Assaf Gordon [Tue, 8 Sep 2015 23:43:32 +0000 (19:43 -0400)]
ceill: detect buggy OpenBSD implementation
* m4/ceill.m4 (gl_FUNC_CEILL): Detect buggy openBSD implementation
which returns zero for small values. Discussed here:
http://lists.gnu.org/archive/html/bug-gnulib/2015-08/msg00010.html
Dave Chiluk [Mon, 31 Aug 2015 21:07:58 +0000 (16:07 -0500)]
mountlist: add me_mntroot field on Linux machines
* lib/mountlist.c (read_file_system_list): Populate me_mntroot in
mount_entry so Linux machines based on /proc/self/mountinfo can
distinguish between bind mounts and original mounts. In reality bind
mounts aren't treated differently than mountroot=/ mounts by the
kernel, but the user often wants these bind mounts distinguished.
* lib/mountlist.h (struct mount_entry): Add me_mntroot element.
More details at https://pad.lv/1432871
Christian Egli [Fri, 4 Sep 2015 10:06:46 +0000 (12:06 +0200)]
doc: Describe to use multiple instances of gnulib
* doc/gnulib-tool.texi: Add a section to the manual outlining how two
instances of gnulib with different modules can be used, for example one
for a lib and another one for associated tools.
Paul Eggert [Mon, 3 Aug 2015 19:34:38 +0000 (12:34 -0700)]
Improve port of stdalign to C++11
Problem reported by Sundaram in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-08/msg00003.html
* lib/stdalign.in.h (alignof, alignas): Don't define if C++11 or newer.
(__alignas_is_defined): Define if C++11 or newer.
Assaf Gordon [Sun, 2 Aug 2015 05:30:07 +0000 (23:30 -0600)]
pmccabe2html: fix gawk regex escaping
* build-aux/pmccabe2html: Add one more backslash to properly
escape the gsub replacement value. Fixes this error:
gawk: ./build-aux/pmccabe2html:425: \
warning: escape sequence `\&' treated as plain `&'
Paul Eggert [Mon, 27 Jul 2015 23:41:17 +0000 (16:41 -0700)]
time_rz: port better to MinGW
Don't change tzname, as this makes MinGW dump core (Bug#21020).
Instead, store the tzname copy in the struct tm_zone object.
Problem reported by Eli Zaretskii in: http://bugs.gnu.org/21020#48
* lib/strftime.c [!_LIBC]:
* lib/time_rz.c: Include time-internal.h.
* lib/strftime.c (strftime_case_) [!HAVE_TM_ZONE]: Infer the zone
name from *TZ rather than from TZNAME, doable because *TZ now has
a tzname_copy member.
* lib/time-internal.h: New file, with contents taken from
lib/time_rz.c. It's separate because strftime.c now accesses
struct tm_zone members.
(struct tm_zone) [HAVE_TZNAME && !HAVE_TM_ZONE]:
New member tzname_copy.
* lib/time_rz.c (struct tm_zone): Move to time-internal.h.
(tzalloc) [HAVE_TZNAME && !HAVE_TM_ZONE]:
Initialize tzname_copy member.
(save_abbr) [HAVE_TZNAME && !HAVE_TM_ZONE]: Save abbreviation
in tzname_copy member.
(revert_tz) [HAVE_TZNAME]: Remove no-longer-needed tzname saving.
(restore_tzname): Remove; no longer needed. All calls removed.
* modules/time_rz (Files): Add lib/time-internal.h.
Paul Eggert [Sat, 25 Jul 2015 23:37:17 +0000 (16:37 -0700)]
strftime: fix newly-introduced bug on Solaris
* lib/strftime.c (strftime_case_): Set the local variable 'zone'
consistently at the start, rather than doing some of the setup at
the start and some in the %Z format spec. This is cleaner, and
works better with time_rz on platforms like Solaris where struct
tm lacks a tm_zone member, as when !HAVE_TM_GMTOFF %z's calls to
mktime_z and localtime_rz can mess up the tzname cache.
Paul Eggert [Sat, 25 Jul 2015 22:20:57 +0000 (15:20 -0700)]
test-strftime: test for Solaris bug
* modules/strftime-tests (Depends-on): Add strerror.
* tests/test-strftime.c: Include <errno.h>.
(posixtm_test): New function, containing the old 'main'.
(struct tzalloc_test, struct localtime_rz_test): New types.
(TZ, LT): New static vars.
(tzalloc_test): New function.
(main): Rewrite in terms of posixtm_test and tzalloc_test.
Paul Eggert [Sat, 25 Jul 2015 22:20:10 +0000 (15:20 -0700)]
time_rz: port to Solaris etc.
Works around a tzname problem on platforms like Solaris that have
tzname but not tm_zone, by setting tzname at the appropriate time
and restoring it later.
* lib/time_rz.c (tzname_address, tzname_value) [HAVE_TZNAME]:
New static vars.
(save_abbr) [HAVE_TZNAME]: Set them.
(revert_tz) [HAVE_TZNAME]: Clear or use them.
(restore_tzname): New function.
(localtime_rz, mktime_z): Use it.
Paul Eggert [Fri, 24 Jul 2015 01:28:13 +0000 (18:28 -0700)]
fprintftime, strftime: use timezone_t args
* NEWS: Document the change.
* lib/fprintftime.h (fprintftime):
* lib/strftime.c (extra_args) [my_strftime]:
* lib/strftime.h (nstrftime):
Time zone arg is now of type timezone_t, not int.
* lib/strftime.c (mktime_z) [_LIBC]: New macro.
(__gmtime_r, __localtime_r) [!HAVE_TM_GMTOFF]: Remove; no longer used.
(my_strftime) [emacs && !my_strftime]:
(emacs_strftimeu) [emacs && !FPRINTFTIME]:
Remove; Emacs doesn't need this any more.
(HAVE_TZSET) [my_strftime]: Unset, since we no longer want
fprintftime and nstrftime to call tzset.
(ut) [!my_strftime]: Remove, replacing with ...
(tz) [!my_stftime]: ... this new macro. All uses changed.
(strftime_case_): Use localtime_rz and mktime_z instead
of localtime_r and mktime.
* modules/fprintftime (Depends-on): Add time_rz.
* modules/strftime (Depends-on): Add time_rz. Remove time_r.
* tests/test-strftime.c (main): Adjust to new nstrftime API.
Illumos defines __sun, but does not have getlocalename_l nor the
equivalent. This partially reverts commit 387c214.
* m4/localename.m4 (gl_LOCALENAME): Check if getlocalename_l is
available, as well as uselocale.
* lib/localename.c [HAVE_USELOCALE && __sun]: Don't fallback to
use getlocalename_l if it is not available.
* lib/set-permissions.c (set_acls): Document where support for FreeBSD
ACL_TYPE_NFS4 acls should go.
* lib/get-permissions.c (get_permissions): Likewise.
When a directory doesn't have an ACL_TYPE_DEFAULT acl, acl_get_file will return
an empty acl, but when trying to set that acl, FreeBSD's acl_set_file will fail
with errno == EINVAL. Instead, FreeBSD expects acl_delete_def_file to be used.
* lib/acl-internal.c (acl_default_nontrivial): Recognize empty default acls.
* lib/set-permissions.c (set_acls): Avoid calling acl_set_file for empty
ACL_TYPE_DEFAULT acls.
file-has-acl, acl-permissions: fix some more HP-UX typos
Problem reported by John David Anglin in: http://bugs.gnu.org/20979
* lib/set-permissions.c (context_acl_from_mode): Fix some more obvious
typos introduced by the recent ACL changes.
Paul Eggert [Sat, 4 Jul 2015 18:05:00 +0000 (11:05 -0700)]
file-has-acl, acl-permissions: fix HP-UX typos
Problem reported by John David Anglin in: http://bugs.gnu.org/20979
* lib/file-has-acl.c (file_has_acl):
* lib/set-permissions.c (context_acl_from_mode)
(context_aclv_from_mode, set_acls):
Fix some obvious typos when HAVE_GETCL /* HP-UX */.
They were introduced by the recent ACL changes.
Paul Eggert [Sat, 4 Jul 2015 15:25:21 +0000 (08:25 -0700)]
regex: match current GNU grep behavior
These symbols have not matched GNU grep behavior for quite some time.
Fix prompted by Balazs Kezes bug report at: http://bugs.gnu.org/20974
* lib/regex.h (RE_SYNTAX_GREP, RE_SYNTAX_EGREP):
Change to match current GNU behavior.
Simplify by expressing it as differences from POSIX BREs and EREs.
(RE_SYNTAX_POSIX_EGREP): No longer differs from GNU behavior.
* lib/set-permissions.c (acl_from_mode): Guard with #ifdef
directives identical to those guarding the sole use.
Otherwise, on some systems, we'd get a warning about
the function being defined but not used.
Also, filter through cppi to correct misleading indentation
of cpp directives.
tests: restrict shells to those that support 'local'
The local keyword is very widely supported and used
in tests in coreutils and grep at least. Therefore
restrict to testing with shells that support it.
This mainly excludes /bin/sh on Solaris.
Note standard ksh also doesn't support this keyword,
but that wasn't in the list of considered shells anyway.
For discussion on adding 'local' to POSIX, see:
http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/122267/focus=3271
* tests/init.sh (gl_shell_test_script_): Add a test for 'local'.
Previously, uN_strtok moved PTR to the next unit to the token end.
When DELIM contained a multibyte character, the new position could
be a middle of a multibyte character.
* lib/unistr/u-strtok.h (FUNC): Place PTR at the next character
after the token.
* lib/unistr/u8-strtok.c (U_STRMBLEN): New macro.
* lib/unistr/u16-strtok.c (U_STRMBLEN): New macro.
* lib/unistr/u32-strtok.c (U_STRMBLEN): New macro.
* modules/unistr/u8-strtok (Depends-on): Depend on
unistr/u8-strmblen.
* modules/unistr/u16-strtok (Depends-on): Depend on
unistr/u16-strmblen.
* modules/unistr/u32-strtok (Depends-on): Depend on
unistr/u32-strmblen.
* tests/unistr/test-u-strtok.h: New file.
* tests/unistr/test-u8-strtok.c: New file.
* tests/unistr/test-u16-strtok.c: New file.
* tests/unistr/test-u32-strtok.c: New file.
* modules/unistr/u8-strtok-tests: New file.
* modules/unistr/u32-strtok-tests: New file.
* modules/unistr/u16-strtok-tests: New file.
Copyright-paperwork-exempt: yes Co-authored-by: Daiki Ueno <ueno@gnu.org>
On slower platforms (e.g., Solaris 10/SPARC), u{16,32}-strstr tests can
take longer than 5 seconds to complete.
Reported by Dagobert Michelsen in:
https://lists.gnu.org/archive/html/bug-libunistring/2015-06/msg00006.html
* tests/unistr/test-u16-strstr.c (main): Increase timeout from 5
seconds to 10 seconds.
* tests/unistr/test-u32-strstr.c (main): Likewise.
Pavel Raiskup [Wed, 1 Jul 2015 07:38:35 +0000 (09:38 +0200)]
gnulib-common.m4: change the ARFLAGS default to 'cr'
In some GNU/Linux distributions people started to compile 'ar'
binary with --enable-deterministic-archives (binutils project).
That, however, in combination with previous autotools long time
working default AR{_,}FLAGS=cru causes warnings on such
installations:
ar: `u' modifier ignored since `D' is the default (see `U')
The 'u' option (at least with GNU binutils) did small optimization
during repeated builds because it instructed 'ar' to not
open/close unchanged *.o files and to rather read their contents
from old archive file. However, its removal should not cause a
big performance hit for usual workflows.
Distributions started using --enable-deterministic-archives
knowing that it will disable the 'u', with the benefit of having
rather a bit more deterministic builds.
Also, to justify this change a bit more, keeping 'u' in ARFLAGS
could only result in many per-project changes to override
Automake's ARFLAGS default, just to silent such warnings.
* m4/gnulib-common.m4 (gl_PROG_AR_RANLIB): Set ARFLAGS='cr' if not
set already.
Pavel Raiskup [Wed, 1 Jul 2015 10:30:57 +0000 (12:30 +0200)]
selinux-h: avoid double free after *getfilecon()
Originally reported by Ben Shelton on bug-tar:
http://lists.gnu.org/archive/html/bug-tar/2015-04/msg00009.html
* lib/getfilecon.c (map_to_failure): Set the already freed '*con'
pointer to NULL. Man getfilecon(3) says that any non-NULL '*con'
parameter should be freed by freecon(3) (regardless the return
value).
Pavel Fedin [Wed, 1 Jul 2015 07:18:11 +0000 (10:18 +0300)]
fix pty related tests issues on Windows
* lib/grantpt.c (grantpt): grantpt.c seems to be never used on Windows,
however it's still present in tests/ subdirectory of the final project.
Therefore avoid it to pass `make check`.
* tests/test-openpty.c (main): Windows has no PTYs and gnulib's openpty()
will just return -ENOSYS, so avoid this non applicable test allowing
the build to proceed.
Pádraig Brady [Tue, 30 Jun 2015 19:35:26 +0000 (20:35 +0100)]
acl: fix definition of acl_from_mode on FreeBSD
This was causing basic coreutils copy operations to fail
with ENOTSUP or ENOENT error messages.
* lib/acl-internal.h (acl_from_mode): Only define when
! defined HAVE_ACL_FROM_TEXT. That allows the version
of acl_from_mode() defined in lib/set-permissions.c to
be used on FreeBSD at least.
* lib/set-permissions.c: Fix up comment spelling,
and a redundant variable assignment; noticed in passing.
Jim Meyering [Mon, 29 Jun 2015 17:05:31 +0000 (10:05 -0700)]
linkat: fix invalid definition of LINKAT_SYMLINK_NOTSUP on OS X
It started like this when building coreutils' latest on OS X,
invoking ./configure with a nonempty --cache=.cache:
lib/linkat.c:46:42: error: operator '||' has no right operand
lib/linkat.c: In function 'rpl_linkat':
lib/linkat.c:330:27: error: #if with no expression
The problem is that m4/linkat.m4's gl_FUNC_LINKAT
uses AC_CACHE_CHECK to set LINKAT_SYMLINK_NOTSUP,
but that violates a tenet of AC_CACHE_CHECK: it must
have no side effect other than setting its cache variable.
What happens is that when the cache is set, we'd skip the
code in that AC_CACHE_CHECK call, and leave LINKAT_SYMLINK_NOTSUP
defined to whatever value it happened to have in configure's
environment. In my case, it was not defined, so this later code:
AC_DEFINE_UNQUOTED([LINKAT_SYMLINK_NOTSUP], [$LINKAT_SYMLINK_NOTSUP],
[Define to 1 if linkat can create hardlinks to symlinks])
would emit code with an empty RHS.
* m4/linkat.m4 (gl_FUNC_LINKAT): Move the setting of
$LINKAT_SYMLINK_NOTSUP out of the AC_CACHE_CHECK code block.
Paul Eggert [Mon, 29 Jun 2015 06:43:35 +0000 (23:43 -0700)]
mgetgroups: port to strict OS X
* doc/glibc-functions/getgrouplist.texi (getgrouplist):
Document the getgrouplist problem.
* lib/mgetgroups.c (getgrouplist_gids) [HAVE_GETGROUPLIST]:
New macro.
(mgetgroups): Use it.
* m4/mgetgroups.m4 (gl_MGETGROUPS):
Check for OS X signature for getgrouplist.
Jim Meyering [Sun, 28 Jun 2015 20:11:04 +0000 (13:11 -0700)]
mountlist: avoid an unused-label warning on OS X
* lib/mountlist.c (read_file_system_list) [MOUNTED_GETMNTINFO]:
Building on OS X, I saw a warning about the "free_then_fail" label
being unused. Give it the _GL_UNUSED_LABEL attribute.
Pádraig Brady [Wed, 24 Jun 2015 22:52:24 +0000 (23:52 +0100)]
fts: avoid reading beyond the heap allocation
GCC 5.1.1 with -O2 and -fsanitize=address reports
the following from `chmod a+rx ..` for example:
ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200000be48
READ of size 4 at 0x61200000be48 thread T0
#0 0x40f0a1 in fts_stat lib/fts.c:1821
#1 0x4141ec in fts_open lib/fts.c:514
#2 0x40ca6e in xfts_open lib/xfts.c:36
#3 0x402c35 in process_files src/chmod.c:336
#4 0x402c35 in main src/chmod.c:566
#5 0x7f8fdc38678f in __libc_start_main (/lib64/libc.so.6+0x2078f)
#6 0x404608 in _start (/home/padraig/git/coreutils/src/chmod+0x404608)
0x61200000be4b is located 0 bytes to the right of
267-byte region [0x61200000bd40,0x61200000be4b) allocated by thread T0 here:
#0 0x7f8fdd4cfa0a in malloc (/lib64/libasan.so.2+0x98a0a)
#1 0x40f22c in fts_alloc lib/fts.c:1916
The read of size 4 from a heap object of size 3 is indeed invalid,
though this may be due to incorrect padding assumptions by GCC, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66661
The read is coming from the a[2] access in ISDOT() which GCC seems
to assume can access according to the alignment of the main structure,
since the flexible array members are being accessed directly.
One could cast the parameter to ISDOT() to (char const*) to restrict
to byte at a time access, however it seems more correct and maintainable
to increase the buffer size to the appropriate alignment to avoid this issue.
For reference some notes on alignment and flexible array members are at:
https://sites.google.com/site/embeddedmonologue/home/c-programming/data-alignment-structure-padding-and-flexible-array-member
* lib/fts.c (fts_alloc): Increase allocation to alignof(FTSENT).
* modules/fts: Depend on stdalign.