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.
Pádraig Brady [Wed, 24 Jun 2015 18:08:08 +0000 (19:08 +0100)]
savedir: avoid undefined behavior in qsort call
GCC 5.1.1 -fsanitize=undefined with glibc 2.21 is returning:
"runtime error: null pointer passed as argument 1,
which is declared to never be null"
* lib/savedir.c (streamsavedir): Avoid the call with no entries.
Glenn Morris [Sat, 20 Jun 2015 17:09:22 +0000 (10:09 -0700)]
gitlog-to-changelog: improve gitmerge.el commits
Let the Emacs ChangeLog generation process exclude "skipped"
messages from merge commits (Bug#20717).
* build-aux/gitlog-to-changelog: Handle gitmerge.el skipped commits.
Paul Eggert [Sat, 20 Jun 2015 16:57:08 +0000 (09:57 -0700)]
wchar: fix MinGW compilation warnings
This lets Texinfo compile cleanly. See Eli Zaretskii in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-06/msg00050.html
* lib/wchar.in.h: Do not use special invocation convention on MinGW.
Daiki Ueno [Sat, 20 Jun 2015 06:33:07 +0000 (15:33 +0900)]
uniname/uniname-tests: use pristine data files
For copyright and maintenance reasons, use the data files from UCD
without modification.
* tests/uniname/test-uninames.c (FIELDLEN): Remove.
(getfield): Remove.
(aliases_count): New global variable.
(fill_names): Skip comments and empty lines in the input. Don't
use getfield.
(fill_aliases): Likewise.
(main): Change the expected command line arguments to:
NAMES... ["--" ALIASES...].
* tests/uniname/test-uninames.sh: Adjust to the change in
test-uninames.c.
* tests/uniname/UnicodeDataNames.txt: Remove.
* tests/uniname/UnicodeData.txt: New file, from Unicode 8.0.0.
* tests/uniname/NameAliases.txt: Use the pristine copy of the data
file from Unicode 8.0.0.
Daiki Ueno [Fri, 19 Jun 2015 05:31:19 +0000 (14:31 +0900)]
libunistring: bump minimum version to 0.9.6
The modules are listed by a script that does:
* all modules depending on updated Unicode data: Regenerate.
The modules are listed by a script that does:
- for each file listed by: git show --oneline --name-only 705f4efc
- deduce the containing modules, based on "Files:"
- deduce the modules which depend on the containing modules, based
on "Depends-on:"
Daiki Ueno [Thu, 18 Jun 2015 08:34:54 +0000 (17:34 +0900)]
libunistring: update to Unicode 8.0.0
* lib/gen-uni-tables.c (SIZEOF): New macro.
(output_numeric): Increase the maximum number of fractions from
128 to 160. Increase the level3 value width from 7 bits to 8
bits. Use SIZEOF instead of a hard-coded integer.
(output_blocks): Decrease the cut-off threshold from 0x30000 to
0x28000.
(fill_blocks): Increase the maximum number of blocks from 256 to
384. Use SIZEOF instead of a hard-coded integer.
(get_lbp): Adjust to new characters added in Unicode 8.0.0.
* lib/unictype/numeric.c (uc_numeric_value): Adjust the level3
value width.
* lib/unilbrk/lbrktables.c (unilbrk_table): Implement LBP21b and
a new case added to LBP22.
* lib/uniwidth/width.c (nonspacing_table_data): Add U+08E3,
U+A69E, U+FE2E..U+FE2F, U+111CA..U+111CC, U+11300,
U+115DC..U+115DD, U+1171D..U+1171F, U+11722..U+11725,
U+11727..U+1172B, U+1DA00..U+1DA36, U+1DA3B..U+1DA6C, U+1DA75,
U+1DA84, U+1DA9B..U+1DA9F, and U+1DAA1..U+1DAAF.
* tests/uniwidth/test-uc_width2.sh: Same updates as in
lib/uniwidth/width.c.
* all generated files under lib/uni* and tests/uni*: Regenerate.
Pádraig Brady [Tue, 16 Jun 2015 05:39:42 +0000 (06:39 +0100)]
gnu-web-doc-update: add --mirror to remove stale files
* build-aux/gnu-web-doc-update: Add a --mirror option to remove
out of date files from the CVS server. Since this is usually
appropriate, a prompt is given when the option is not specified,
along with the `cvs remove` command that would be run.
Paul Eggert [Sun, 7 Jun 2015 01:20:40 +0000 (18:20 -0700)]
acl-permissions: pacify -Wsuggest-attribute=const
Problem reported by Masanari Iida in: http://bugs.gnu.org/20753
* lib/acl-internal.h (free_permission_context):
Declare with attribute const if ! (defined USE_ACL &&
(HAVE_ACL_GET_FILE || defined GETACL)).
Paul Eggert [Fri, 5 Jun 2015 18:47:37 +0000 (11:47 -0700)]
acl-permissions: more porting to AIX
* lib/file-has-acl.c (file_has_acl) [HAVE_STATACL]:
* lib/readutmp.c (read_utmp) [UTMP_NAME_FUNCTION]:
* lib/set-permissions.c (set_acls) [HAVE_ACLX_GET && ACL_AIX_WIP]:
Add cast for AIX, whose system calls are declared to accept
char * even though the arguments are really char const *.
* lib/mountlist.c (read_file_system_list) [MOUNTED_VMOUNT]:
Rework types to pacify xlc.
Jonathan Perkin [Thu, 4 Jun 2015 11:10:34 +0000 (12:10 +0100)]
stdio: Don't redefine gets when using C++
We've hit this failure a few times in pkgsrc with packages which embed gnulib,
an example being the latest gnutls:
../../src/gl/stdio.h:1034:1: error: 'char* gets(char*)' conflicts with a previous declaration
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^
Pádraig Brady [Wed, 3 Jun 2015 03:38:03 +0000 (04:38 +0100)]
vasprintf-posix: avoid compiling vasnprintf where possible
* modules/vasprintf-posix: Avoid compiling the large vasnprintf
module where not required. For example on a GNU/Linux system
when gnulib-tool is run with the --conditional-dependencies option.
Pádraig Brady [Mon, 1 Jun 2015 23:53:48 +0000 (00:53 +0100)]
file-has-acl: fix build on Mac OS X 10
This reverts commit f1b37e3a which doesn't work on Mac OS X >= 10.4
which has an incompatible 6 parameter getxattr() call.
* doc/glibc-functions/getxattr.texi: Mention the divergent getxattr()
call on Mac OS X >= 10.4.
* doc/glibc-functions/fgetxattr.texi: Likewise.
* lib/file-has-acl.c: Revert to more complete combined check.
* m4/acl.m4 (gl_FILE_HAS_ACL): Likewise.
Reported by Jack Howarth.
Pádraig Brady [Mon, 1 Jun 2015 23:06:52 +0000 (00:06 +0100)]
prefix-gnulib-mk: remove no longer needed special case
* build-aux/prefix-gnulib-mk (prefix): Since commit e3704b9c,
continued lib_SOURCES lines are no longer present,
so special case handling of such entries is not required.
Pádraig Brady [Mon, 1 Jun 2015 20:50:13 +0000 (21:50 +0100)]
gnulib-tool: concatenate lib_SOURCES to a single line
* gnulib-tool: Refactor the line merging sed logic,
and use that to output a single lib_SOURCES line for each module.
gnulib using projects often postprocess this output to prepend
subdir paths to each item, and having a single line simplifies this
processing allowing better decoupling from the gnulib-tool output.
This avoids a new issue with coreutils where it failed to prepend
a path on the new {get,set}-permissions.c items (which were
on continued lines in modules/acl-permissions).
Pádraig Brady [Sun, 31 May 2015 02:08:52 +0000 (03:08 +0100)]
readlinkat: avoid OS X 10.10 trailing slash bug
* doc/posix-functions/readlink.texi: Mention that OS X 10.10
has this bug.
* doc/posix-functions/readlinkat.texi: Likewise. Also mention
that OS X 10.10 has this function.
* lib/readlinkat.c (rpl_readlinkat): Handle the trailing slash bug,
as done for readlink().
* m4/readlinkat.m4 (gl_FUNC_READLINKAT): Check for the readlink()
trailing slash bug, and assume readlinkat() has the same issue.
Also fix a typo where $gl_cv_decl_readlink_works was tested,
rather than the correct $gl_cv_decl_readlinkat_works.
Reported by Tom G. Christensen <tgc@jupiterrise.com>:
* lib/set-permissions.c (set_acls): The count, entries, ace_count, and
ace_entries variables have moved into struct permission_context but
they were still accessed as local variables here.
Pádraig Brady [Fri, 29 May 2015 02:11:59 +0000 (03:11 +0100)]
linkat: avoid OS X 10.10 trailing slash with symlink bug
On Darwin 14.3.0 linkat(,"path1",,"dangling_symlink/",)
causes the symlink to be dereferenced, and if it points
to a non existent file, that file will be created as
a hard link to "path1".
This fixes a test failure in test-linkat.c.
* m4/linkat.m4 (gl_FUNC_LINKAT): Augment the test with
this case. The existing workaround in linkat.c for
trailing slash issues, suffices for this case.
* doc/posix-functions/linkat.texi: Add OS X 10.10 to
the list of platforms with trailing slash issues.
Pádraig Brady [Thu, 28 May 2015 13:15:08 +0000 (14:15 +0100)]
unlinkat: handle ignoring of ".." on Darwin 14
* lib/unlinkat.c: unlinkat() has the same bug as unlink()
on Mac OS X 10.10, where it ignores paths with a trailing "..",
so handle in the same manner.
* m4/unlinkat.m4: Comment on this Darwin issue.
* doc/posix-functions/unlink.texi: Update the latest version
where the issue was seen.
* doc/posix-functions/unlinkat.texi: Mention this issue.
Fixes a test failure in test-unlinkat.c.
Paul Eggert [Wed, 27 May 2015 23:05:44 +0000 (16:05 -0700)]
qacl: split into qcopy-acl and qset-acl
Emacs needs the former, but not the latter.
* modules/acl-permissions: New file, containing most of the old qacl.
* modules/file-has-acl (Depends-on): Depend on acl-permissions, not qacl.
* modules/qacl: Now merely depends on qcopy-acl and qset-acl.
* modules/qcopy-acl, modules/qset-acl: New files.
* MODULES.html.sh (File system functions):
Mention the new modules, and mention qacl while we're at it.
Glenn Morris [Wed, 27 May 2015 21:44:16 +0000 (14:44 -0700)]
gitlog-to-changelog: new option --ignore-line
(This patch is imported from the GNU Emacs master.)
This option ignores individual commit lines matching a pattern.
* build-aux/gitlog-to-changelog: Add --ignore-line option.
qacl: Reimplement qset_acl and qcopy_acl (Bug#20666)
Implement get_permissions and set_permissions primitives for getting all
the permissions of a file, storing them, and later setting them. (In the
minimal case, the permissions consist only of a file mode.) Reimplement
qset_acl and qcopy_acl based on these new primitives: this avoids code
duplication and makes error handling more consistent.
The Solaris and Cygwin code still uses duplicate code paths for setting
a file mode while making sure that no acls exist and setting an explicit
acl; this is no worse than before, but could be cleaned up. The AIX
code still doesn't read ACLs, it only makes sure that acls don't get in
the way when setting a file mode.
* lib/acl-internal.h (struct permission_context): New data structure.
(get_permissions, set_permissions, free_permission_context): Declare.
* lib/acl-internal.c (free_permission_context): New helper function.
* lib/get-permissions.c (get_permissions): New helper function split off
from qcopy_acl.
* lib/set-permissions.c: (set_acls_from_mode): On Solaris, Cygwin, and
AIX, set a file's permissions based only on a file mode.
(acl_from_mode, context_acl_from_mode, context_aclv_from_mode): All
other platforms construct a temporary acl from the file mode and set
that acl in the same way as setting an acl read from the source file.
This should help avoid code duplication and inconsistent / buggy
behavior.
(set_acls): New helper function Split off from qcopy_acl.
(chmod_or_fchmod): Moved here from qset-acl.c.
(set_permissions): New helper function.
* lib/qcopy-acl.c (qcopy_acl): Rewrite using get_permissions and
set_permissions.
* lib/qset-acl.c (qset_acl): Rewrite using set_permissions.
* modules/qacl: Add get-permissions.c and set-permissions.c.
file-has-acl: Split feature tests again (Bug#20667)
* lib/file-has-acl.c: Instead of testing for
XATTR_NAME_POSIX_ACL_ACCESS and XATTR_NAME_POSIX_ACL_DEFAULT,
define them when needed.
* m4/acl.m4 (gl_FILE_HAS_ACL): With that, Paul's
GETXATTR_WITH_POSIX_ACLS change shouldn't be needed anymore.
Pádraig Brady [Wed, 27 May 2015 11:59:05 +0000 (12:59 +0100)]
string: fix build failure on BSD/OSX with FORTIFY_SOURCE
This avoids a conflict with "FORTIFY_SOURCE" variants
of the string functions when they're replaced on NetBSD-6.0.1
and Darwin-14.3.0 at least. On these platforms, the system
<string.h> re-includes "string.h" through <strings.h>, before
going on to redefine the "FORTIFY_SOURCE" _chk variants.
For example rpl_strncat is redefined to __builtin___strncat_chk.
Note strncat is being replaced as the configure check is failing
with GCC 4.5.0, due to the builtin strncat failing the check.
I.E. when compiled with -O2 the test fails, but passes when
-fno-builtin-strncat is also specified. -D_FORTIFY_SOURCE has
no impact on the configure test result.
* lib/string.in.h: Avoid including our "lib/string.h" while
including the system <string.h>.
Eric Blake [Wed, 27 May 2015 03:27:44 +0000 (21:27 -0600)]
stdio: limit __gnu_printf__ witness to gcc 4.4+
If we start adding more places that need to conditionally label
functions with __gnu_printf__, it will be nicer if the logic for
determining that gcc even supports that attribute is done once
up front rather than in each caller.
Eric Blake [Tue, 26 May 2015 23:26:15 +0000 (17:26 -0600)]
error: use correct printf attributes on mingw
Now that we always turn on __USE_MINGW_ANSI_STDIO when extensions
are in use, we need to replicate the same logic in error.h as
we have in stdio.h, for selecting the correct format string that
will squelch gcc -Wformat=2 warnings.
Reported by Assaf Gordon.
* lib/stdio.in.h (_GL_ATTRIBUTE_SPEC_PRINTF): New define.
Eric Blake [Tue, 26 May 2015 21:00:50 +0000 (15:00 -0600)]
inttypes: force correct mingw PRIdMAX even without <stdio.h>
The mingw trick of using __USE_MINGW_ANSI_STDIO only changes the
definitions in <inttypes.h> if <stdio.h> is also included. But
since we want to always use the __gnu_printf__ flavor when
available, we want to make sure that including <inttypes.h> in
isolation will give the desired "lld" answer.
Reported by Assaf Gordon.
* modules/inttypes (Depends-on): Require extensions, so that mingw
always uses GNU style inttypes.
* lib/inttypes.in.h: On mingw, include <stdio.h>.
Eric Blake [Wed, 20 May 2015 23:18:20 +0000 (17:18 -0600)]
stdio: fix probe on mingw under gcc 5.1
Per https://gcc.gnu.org/gcc-5/porting_to.html, gcc 5.1 intentionally
changed the preprocessor to emit multiple lines, rather than one
line, when expanding text that includes literal markers combined with
a macro expansion obtained from a header. This in turn breaks the
probe for whether mingw headers support GNU-style "lld" for PRIdMAX,
as the probe text was no longer on one line.
This patch changes from grepping preprocessor output (with its
indeterminate layout due to differences in preprocessors) to instead
using a compile-time check of the length of the macro expansion.
It feels a bit gross, but the grossness is limited to mingw, which
is the only platform where using __gnu_printf__ instead of __printf__
will make a difference.
Based on a report by Suren Hajyan.
* m4/stdio_h.m4 (gl_STDIO_H): Change to compile test, to work
around new gcc preprocessor rules.
Paul Eggert [Thu, 30 Apr 2015 02:47:12 +0000 (19:47 -0700)]
extern-inline: no need for workaround in GCC 5.1
* doc/extern-inline.texi (extern inline):
* m4/extern-inline.m4 (gl_EXTERN_INLINE):
GCC bugs 54113 and 63877 are fixed in GCC 5.1, so don't work
around these bugs in GCC 5.1 and later. Maybe in a decade or
two we can remove these workarounds.
* lib/xalloc.h: Don't use the __alloc_size__ attribute
with clang, as support has been fully removed as of clang 3.5:
https://github.com/llvm-mirror/clang/commit/c047507a
* lib/eealloc.h: Likewise.
* lib/pagealign_alloc.h: Likewise.
Paul Eggert [Mon, 27 Apr 2015 08:23:29 +0000 (01:23 -0700)]
tests: pacify GCC 5.1's stricter printf checking
* tests/test-dirname.c (main):
* tests/test-getaddrinfo.c (simple):
* tests/test-getlogin.c (main):
* tests/test-getndelim2.c (main):
* tests/test-inttostr.c (CK):
* tests/test-md5.c (main):
* tests/test-read-file.c (main):
* tests/test-sha1.c (main):
Fix mismatches between printf format and value signedness.
* tests/test-inttostr.c (FMT, CAST_VAL, V_min, V_max):
Remove, as CAST_VAL always returned a value of type uintmax_t.
Paul Eggert [Mon, 27 Apr 2015 08:19:03 +0000 (01:19 -0700)]
fts: port to GCC 5.1 with --enable-gcc-warnings
Without this fix, GCC 5.1 (correctly) warns about a subscript
error on the fts_name component of FTSENT. It's actually a
flexible member, so define it that way on C99 or later hosts.
* lib/fts.c (fts_alloc): Use offsetof, not sizeof, for a
structure that now has a flexible array member.
* lib/fts_.h (__FLEXIBLE_ARRAY_MEMBER): New macro.
(FTSENT): fts_name is now flexible on C99-or-later platforms.
* modules/fts (Depends-on): Add flexmember.
Paul Eggert [Sun, 26 Apr 2015 16:20:34 +0000 (09:20 -0700)]
file-has-acl: port to CentOS 6
Problem reported by Tom G. Christensen in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-04/msg00074.html
* lib/file-has-acl.c: Use GETXATTR_WITH_POSIX_ACLS instead of a
combination of HAVE_SYS_XATTR_H, HAVE_LINUX_XATTR_H, and
HAVE_GETXATTR.
* m4/acl.m4 (gl_FILE_HAS_ACL): Test fot the entire combination of
linux/xattr.h, sys/xattr.h, getxattr, XATTR_NAME_POSIX_ACL_ACCESS,
and XATTR_NAME_POSIX_ACL_DEFAULT, since that's what what
file-has-acl.c actually needs.
file-has-acl: always return false when ACLs aren't supported
* lib/file-has-acl.c (file_has_acl): Consistent with other paths,
change the GNU/Linux getxattr path, to transform "not supported"
errors to a false return rather than an error. This is handled
within file_has_acl() due to the platform specific tests to
determine if ACLs are not supported.
Paul Eggert [Sun, 26 Apr 2015 00:28:45 +0000 (17:28 -0700)]
gettext: propagate po/Makefile.in.in too
* build-aux/po/Makefile.in.in: Copy from latest gettext.
* config/srclist.txt: In build-aux/po, copy Makefile.in.in and
remove-potcdate.sin from $GETTEXT. This fixes a version mismatch
between Makefile.in.in and the gettext-runtime m4 files.
Paul Eggert [Sat, 25 Apr 2015 05:07:56 +0000 (22:07 -0700)]
file-has-acl: new module, split from acl
And add a new module file-has-acl-tests to match.
I ran into a problem with the recent changes to the acl module,
as they introduced a typo 'test use_xattrs = 0' into 'configure'.
When using the fixed version with Emacs, I discovered that
file-has-acl wasn't separated out well enough for Emacs (e.g., it
had multiple libraries, but needed only one), so I fixed that too.
* NEWS: Document this incompatible change.
* modules/file-has-acl, modules/file-has-acl-tests: New files.
* m4/acl.m4 (gl_FUNC_ACL_ARG): New macro, split from gl_FUNC_ACL.
Initialize gl_need_lib_has_acl.
(gl_FUNC_ACL): Require it.
Simplify use of 'test'. Set LIB_HAS_ACL if gl_need_lib_has_acl.
Move the file-has-acl.c-relevant stuff to ...
(gl_FILE_HAS_ACL): ... this new macro. Rewrite to fix 'test
use_xattrs = 0' typo, and omit some needless work. Set
gl_need_lib_has_acl=1 if we'll need LIB_HAS_ACL to be set
when gl_FUNC_ACL is called.
* modules/acl (Files, lib_SOURCES): Remove lib/file-has-acl.c.
(Link): Remove $(LIB_HAS_ACL).
* modules/acl-tests (Files, Depends-on, configure.ac, TESTS)
(check_PROGRAMS): Move stuff relevant to file-has-acl to
modules/file-has-acl-tests.
(test_file_has_acl_LDADD): Move to modules/file-has-acl-tests.
Paul Eggert [Tue, 21 Apr 2015 07:22:00 +0000 (00:22 -0700)]
lstat: fix cross-compilation 'ln -s' problem
* m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK):
Have the test program call 'symlink' rather than a separate
script run 'ln -s'; this is more likely to work in
cross-compilation environments. Reported by Pavel Fedin in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-04/msg00060.html
* gnulib-tool (func_show_module_list): Change hexadecimal
numbers to octal in BOLD_ON and BOLD_OFF. The use of hex
encoded numbers as arguments to `printf' is not portable,
and is not claimed by POSIX. This is the case with FreeBSD.
* lib/acl-internal.c: Remove struct stat parameter from HP-UX's version of
acl_nontrivial. Check if the acl has at most three entries instead (it must
have exactly three entries according to the HP-UX documentation). Ignore
uids and gids as long as an entry is either for a user (i.e., the owner),
a group (i.e., the owning group), or others.
* lib/acl-internal.h: Change HP-UX's acl_nontrivial prototype.
* lib/qcopy-acl.c (qcopy_acl): With that, we no longer need to stat the source
file.
On Linux, use the getxattr syscall instead of the acl_extended_file libacl
library function to check for the presence of acls, avoiding a library
dependency.
* lib/file-has-acl.c: Include xattr headers if we have them.
(file_has_acl): On Linux, use getxattr().
* m4/acl.m4 (gl_FUNC_ACL): Define LIB_HAS_ACL as the libraries to link with for
file_has_acl(). Check for xattr headers and getxattr().
* modules/acl: Add a dep on the stdbool module which was already needed.
Add the new reduced dependency LIB_HAS_ACL reference.
acl, qacl: split off shared functions into separate object file
Some of the helper functions in file-has-acl.c are used from qcopy-acl.c while
file_has_acl() isn't needed there. Split the shared functions off into
acl-internal.c.
* lib/file-has-acl.c: Remove helper functions here.
* lib/acl-internal.c: Add helper functions here.
* modules/qacl: Use acl-internal.c instead of file-has-acl.c here.
* modules/acl: Add file-has-acl.c now that qacl doesn't use it anymore.
Revert commit bedd7833 as it breaks `make dist` in Inetutils
at least, due to the interdependencies with top/GNUMakefile,
which depend on the tag prefixes. This results in `make dist`
inducing a new call to autoconf where a simple tar-ball build
would be expected.
* build-aux/git-version-gen: If fallback string is empty,
but git is available, use "git describe --always" to extract
a revision, and prefix it with "g". This is much better than
responding "UNKNOWN" and it applies to shallow clones!