Fridolin Pokorny [Wed, 27 Aug 2014 13:25:30 +0000 (15:25 +0200)]
mountlist: use /proc/self/mountinfo when available
Use libmount to propagate device IDs provided by Linux in
/proc/self/mountinfo. This will give more accurate output when
using df in chroot'ed environments as the device IDs are not
determined by stat() which may be inaccurate within the chroot.
* lib/mountlist.c (read_file_system_list): Use the libmount routines
from util-linux to parse "/proc/self/mountinfo" or fall back to
standard getmntent() processing.
* m4/ls-mntd-fs.m4: Check for libmount only when 1-argument
getmntent() is used, as is the case on GNU/Linux.
* DEPENDENCIES: Mention the optional util-linux dependency.
Eric Wong [Sun, 7 Sep 2014 03:22:12 +0000 (03:22 +0000)]
users.txt: add cmogstored
cmogstored has used gnulib since the beginning in 2012 to support
GNU/Linux, FreeBSD, and GNU/kFreeBSD. cmogstored is currently
included in the FreeBSD ports collection, but developed primarily
on GNU/Linux.
Current implementation only tries to rsync PO files when rsync is
installed on the host. In case of error, no files are downloaded even
if they are available. This leads to bootstrap problems for hosts
that lie behind a restrictive firewall.
This patch always tries to rsync by default, falling back to wget if
an error occurs.
Eric Blake [Thu, 4 Sep 2014 19:11:04 +0000 (13:11 -0600)]
maintainer-makefile: add syntax check for useless ';;'
Most instances of ;; in C code are mistakes, where the second
semicolon is a no-op. This rule tries to make it easy to flag
the typos occuring at the end of a statement. It intentionally
does not flag for(;;) loops, and misses grammar problems in
comments if the problem occurs in the middle of the line.
Shell files (including configure.ac and Makefile.am, which can
contain shell snippets) are too likely to use case statements
where ;; is legitimate, so those are not scanned.
* top/maint.mk (sc_prohibit_double_semicolon): New rule.
Paul Eggert [Thu, 4 Sep 2014 21:55:12 +0000 (14:55 -0700)]
pthread, pthread_sigmask, threadlib: port to Ubuntu 14.04
Problem reported by Assaf Gordon in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00023.html
Apparently Ubuntu is doing some fancy link-time optimization
that doesn't work with -lpthread but does work with -pthread.
Work around the bug by preferring -pthread to -lpthread.
This change affects only LIBS, not CFLAGS, which is a little
weird, but it works.
* m4/pthread.m4 (gl_PTHREAD_CHECK):
* m4/threadlib.m4 (gl_THREADLIB_BODY): Prefer -pthread to -lpthread.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK):
Treat -pthread like -lpthread.
Paul Eggert [Tue, 2 Sep 2014 18:56:55 +0000 (11:56 -0700)]
gnulib-common.m4: port to GCC 4.2.1 and Sun Studio 12 C++
* m4/gnulib-common.m4 (AC_C_RESTRICT):
Override AC_C_RESTRICT unconditionally.
Update from autoconf, incorporating:
2014-09-02 autoconf: port 'restrict' to GCC 4.2.1
2009-01-28 Fix AC_C_RESTRICT for Sun Studio 12 C++.
Paul Eggert [Mon, 1 Sep 2014 08:51:06 +0000 (01:51 -0700)]
manywarnings: add GCC 4.9 warnings
Also, make it easier to maintain this in the future.
* build-aux/gcc-warning.spec: Add -Wabi-tag,
-Wconditionally-supported, -Wdelete-incomplete,
-Winherited-variadic-ctor, -Wvirtual-move-assign, -Wzerotrip.
Remove duplicates. Use tabs uniformly, as that's what 'cut' wants.
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add -Wdate-time,
-Wopenmp-simd. Use -fdiagnostics-show-option and -funit-at-a-time
only for older GCC versions that need them. Handke
-Wnormalized=nfc specially, so that the 'comm' command used
for maintenance doesn't get confused.
Paul Eggert [Mon, 1 Sep 2014 02:19:44 +0000 (19:19 -0700)]
vasnprintf: fix bugs in width computation
* lib/vasnprintf.c (VASNPRINTF):
Rework previous change, which introduced a bug,
to avoid the warning in a different way.
Avoid undefined behavior if the width arg is less than -INT_MAX.
Avoid unnecessary use of HAS_WIDTH local.
* lib/parse-datetime.y (yylex): Compare pointer to end of buffer,
instead of calculating difference of pointers. This removes an
annoying warning, devoid of any use.
Paul Eggert [Fri, 29 Aug 2014 20:00:16 +0000 (13:00 -0700)]
qsort_r: new module, for GNU-style qsort_r
This works even on FreeBSD, which has an incompatible qsort_r API.
* MODULES.html.sh: Add it.
* doc/glibc-functions/qsort_r.texi: It's now supported.
* lib/qsort.c: New file, taken from glibc with minor changes
inside "#ifndef _LIBC" and with an unnecessary "#include <alloca.h>"
removed.
* lib/qsort_r.c: New file, compiled only on FreeBSD.
* lib/stdlib.in.h (qsort_r): Declare in the usual way.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS):
* modules/qsort_r, modules/qsort_r-tests: New files.
* modules/stdlib (Makefile): Set up its defaults.
* tests/test-qsort_r.c: New file.
Paul Eggert [Fri, 8 Aug 2014 00:40:01 +0000 (17:40 -0700)]
vla: new module
vla: new module
GNU RCS can use this, mostly for documentation I expect. See:
http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00025.html
* MODULES.html.sh: Add vla.
* lib/vla.h, modules/vla: New files.
Daiki Ueno [Wed, 6 Aug 2014 23:46:52 +0000 (08:46 +0900)]
localename: make gl_locale_name_thread really thread-safe on Windows
* lib/localename.c [WINDOWS_NATIVE && !IN_LIBINTL]: Include
"glthread/lock.h".
(get_lcid_lock) [WINDOWS_NATIVE]: New variable.
(get_lcid) [WINDOWS_NATIVE]: Lock while looking for an LCID.
Paul Eggert [Fri, 8 Aug 2014 01:13:41 +0000 (18:13 -0700)]
getpass: don't assume struct termios
Problem report and trivial fix by Jonas 'Sortie' Termansen in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00015.html
* lib/getpass.c (getpass): Port to systems lacking struct termios.
Paul Eggert [Fri, 8 Aug 2014 01:04:32 +0000 (18:04 -0700)]
getdtablesize: fall back on sysconf (_SC_OPEN_MAX)
Problem reported by Jonas 'Sortie' Termansen in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00023.html
* lib/getdtablesize.c (getdtablesize) [_SC_OPEN_MAX]:
Implement via sysconf for platforms that lack getdtablesize.
Paul Eggert [Fri, 8 Aug 2014 00:25:28 +0000 (17:25 -0700)]
vararrays: modernize AC_C_VARARRAYS for C11
This backports a change I recently made to Autoconf.
* m4/vararrays.m4 (AC_C_VARARRAYS): Define __STDC_NO_VLA__ if
VLAs are not supported, as this is what C11 does. The old macro
HAVE_C_VARARRAYS is still defined if they are supported, but is
now obsolescent. Also, check for VLA bug in GCC 3.4.3.
Paul Eggert [Tue, 5 Aug 2014 20:19:57 +0000 (13:19 -0700)]
sys_select: fix FD_ZERO problem on Solaris 10
* lib/sys_select.in.h: Fix Solaris 10 bug where "#include
<sys/time.h>" followed by "#include <sys/select.h>" caused FD_ZERO
to expand to an expression that invoked memset without necessarily
including <string.h>. The problem was that the first include
defined _SYS_TIME_H, causing the second include to short-circuit.
Fix a similar problem with <sys/types.h> followed by <sys/select.h>.
Also, fix what appears to be a cut-and-paste typo, by replacing
_GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H with
_GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H.
Paul Eggert [Mon, 4 Aug 2014 18:30:33 +0000 (11:30 -0700)]
extern-inline: port to FreeBSD, DragonFly
* m4/extern-inline.m4 (gl_EXTERN_INLINE): Also assume the bug
is present if either __DragonFly__ or __FreeBSD__ is defined.
FreeBSD problem reported by Andrey Borzenkov in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
Also, worry about __APPLE__ only if __MACH__ is also defined,
as this is more consistent with the rest of gnulib.
(_GL_EXTERN_INLINE_STDHEADER_BUG): Rename this internal macro from
_GL_EXTERN_INLINE_APPLE_BUG, since the bug is not limited to Apple.
Use consistent style to check DEBUG macro in regex_internal.c
The DEBUG macro is checked using both #if and #ifdef in
regex_internal.c. Make this consistent with mktime, where we use "#if
defined DEBUG && DEBUG", to be compatible with gnulib as well as glibc
style.
regex: Make #if/#ifdef usage consistent for DEBUG
* lib/regex_internal.c: Use "#if defined DEBUG && DEBUG" instead
of the inconsistent usage of #if and #ifdef as that works with
both Glibc and Gnulib's style.
Eric Blake [Wed, 30 Jul 2014 21:01:44 +0000 (15:01 -0600)]
openat-die: use _Noreturn markup
Compiling coreutils.git on cygwin with gcc 4.8.3, I got:
lib/openat-die.c:34:1: error: function might be candidate for attribute 'noreturn' [-Werror=suggest-attribute=noreturn]
openat_save_fail (int errnum)
^
Eric Blake [Wed, 30 Jul 2014 23:11:49 +0000 (17:11 -0600)]
test-open: port to cygwin, which lacks Fortify
On cygwin, with gcc 4.8.3, I get this compilation warning:
In file included from ../../gltests/test-open.c:35:0:
../../gltests/test-open.h:35:1: warning: always_inline function might not be inlinable [-Wattributes]
test_open (int (*func) (char const *, int, ...), bool print)
^
On that platform, there are no Fortify enhancements, and the
internal macro __always_inline is always defined to turn on the
gcc attribute, contrary to our needs. Since relying on a __
prefix is already risky, it's better to limit the workaround of
commit d6ba92ea to just glibc.
* tests/test-open.h (ALWAYS_INLINE): New macro.
(__always_inline): Don't abuse internal symbol on non-glibc.
Jim Meyering [Fri, 18 Jul 2014 21:16:44 +0000 (14:16 -0700)]
test-userspec: don't look up numeric user names
* tests/test-userspec.c: I found a system for which getpwnam("0")
returned a pointer to a non-root user's entry, and that made the
test fail.
(T): Prefix each numeric input with "+", to inhibit lookup.
Eli Zaretskii [Tue, 15 Jul 2014 19:18:48 +0000 (12:18 -0700)]
localcharset, localename: MS-Windows support for non-default locales
* lib/localcharset.c (locale_charset) [WINDOWS_NATIVE]: Before
falling back on the default system codepage, try extracting
the codepage from what 'setlocale' returns. This allows to
take into account changes of the codeset due to non-default
locale set by a previous call to 'setlocale'.
* lib/localename.c (LOCALE_NAME_MAX_LENGTH) [WINDOWS_NATIVE]:
Define if not already defined.
(enum_locales_fn, get_lcid) [WINDOWS_NATIVE]: New functions.
(gl_locale_name_thread) [WINDOWS_NATIVE]: Produce the
current locale by calling 'setlocale', then converting the
locale name into LCID by calling 'get_lcid'. This allows to
take into account changes in the current locale from the
default one, in contrast to GetThreadLocale.
announce-gen: avoid failure when Digest::SHA is installed
When Digest::SHA is available, Digest::SHA1 is not loaded and thus
Digest::SHA1->new in print_checksums fails.
* build-aux/announce-gen (digest_classes): New associative array
for available message digest implementations.
(print_locations): Use it.
This reverts commit 9b9370ca, as it currently requires that
developers of any project that explicitly uses the gettext module
or implicitly uses it through the utimens-tests or
futimens-tests modules, use gettext >= 0.19.
However there are some stability and availablity issues with
that version at present.
We can reinstate this soon, when stability is addressed
and packages are more readily available.
Jim Meyering [Sat, 12 Jul 2014 23:33:49 +0000 (16:33 -0700)]
regex: don't deref NULL upon heap allocation failure
* lib/regcomp.c (parse_dup_op): Handle duplicate_tree
failure in one more place.
To trigger the segfault, configure grep -with-included-regex,
build it, and run these commands:
( ulimit -v 300000; echo a|src/grep -E a+++++++++++++++++++++ )
I discovered this while replying to a private report from
Jens Schleusener about excessive memory consumption by grep
when using a regular expression like the one above.
maint.mk: give projects more flexibilty in set_prog_name arguments
* top/maint.mk (sc_program_name): Allow arguments other than argv[0]
to be passed to set_program_name(). This is needed by the multicall
coreutils program for example.
Paul Eggert [Fri, 11 Jul 2014 19:19:34 +0000 (12:19 -0700)]
regex: fix memory leak in compiler
Fix by Andreas Schwab in:
https://sourceware.org/ml/libc-alpha/2014-06/msg00503.html
* lib/regcomp.c (parse_reg_exp): Deallocate partially
constructed tree before returning error.
* lib/localename.c (string_has): Tag internal function as pure.
* lib/localename.h (gl_locale_name_default): Tag extern declaration
as const when appropriate.
This is a partial sync-up of error.c with glibc. The following
changes went in:
- Get rid of the INTUSE macro
- Remove unused macro ALLOCA_LIMIT
- Fix a potential buffer overflow in error_tail (sourceware bz #15672)
- Fix a potential NULL dereference in strcmp
Pavel Hrdina [Wed, 9 Jul 2014 11:13:07 +0000 (13:13 +0200)]
nl_langinfo: fix build under mingw
The commit fcfce839 improved localization of names for week days
and months, but the author forget to include windows.h in order
to use 'GetACP ()'. Without this header file build using mingw
fails with this error message:
../../../gnulib/lib/nl_langinfo.c: In function 'ctype_codeset':
../../../gnulib/lib/nl_langinfo.c:76:5: warning: implicit declaration of
function 'GetACP' [-Wimplicit-function-declaration]
sprintf (buf + 2, "%u", GetACP ());
^
In file included from
/usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:73:0,
from ../../../gnulib/lib/nl_langinfo.c:149:
/usr/i686-w64-mingw32/sys-root/mingw/include/winnls.h: At top level:
/usr/i686-w64-mingw32/sys-root/mingw/include/winnls.h:653:64: error:
conflicting types for 'GetACP'
WINBASEAPI UINT WINAPI GetACP(void);
^
../../../gnulib/lib/nl_langinfo.c:76:29: note: previous implicit
declaration of 'GetACP' was here
sprintf (buf + 2, "%u", GetACP ());
^
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
mountlist: do not classify a bind-mounted dir entry as "dummy"
This was originally implemented with commit 613bcb62,
however that change failed to check for hasmntopt().
Then a subsequent commit 62bb7a8b caused hasmntopt()
to be replaced with a stub on most platforms.
* m4/ls-mntd-fs.m4: Check for hasmntopt() on platforms with
1-argument getmntent() (instead of assuming absence).
Eric Blake [Tue, 8 Jul 2014 19:12:28 +0000 (13:12 -0600)]
maint.mk: less syntax-check noise when SIGPIPE is ignored
For a project with enough files, such as libvirt, vc-list-files
can produce so much input that it can lead to SIGPIPE to earlier
parts of a pipeline when later parts do a quick filter. Also,
many buildbot environments (annoyingly) ignore SIGPIPE, which
causes a number of tools to be rather chatty about reporting
EPIPE write failures. It doesn't help that POSIX has standardized
that the shell is unable to revert SIGPIPE to unignored status
if it inherits it as ignored - otherwise, the solution would just
be to re-enable SIGPIPE anywhere we expect to benefit from early
filtering exits. Here's a short demonstration:
and a link to the much larger buildbot results against libvirt:
http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/2465/console
with noise such as this, detracting from the later actual build
failure it was reporting:
But look at the above example: we are piping data to grep -l,
and then discarding that output. At most, data | grep -l will
output "(standard input)", and exit early if the first match
is found before the end of a page (causing SIGPIPE to the process
feeding the pipe). It makes much more sense to use grep -l when
searching for a subset of files that have a match among a larger
set of file names passed as arguments, and NOT when used to
filter stdin. Sure, we're burning a bit more CPU power by
processing the full list instead of exiting early, but at least
it cuts down on the noise.
* top/maint.mk (_sc_header_without_use)
(sc_require_config_h_first): Parse full list.
Eli Zaretskii [Sat, 5 Jul 2014 21:42:47 +0000 (14:42 -0700)]
nl_langinfo: CODESET on MS-Windows and more items from localeconv
* lib/langinfo.in.h (DECIMAL_POINT, THOUSANDS_SEP, GROUPING)
(CURRENCY_SYMBOL, INT_CURR_SYMBOL, MON_DECIMAL_POINT)
(MON_THOUSANDS_SEP, MON_GROUPING, POSITIVE_SIGN, NEGATIVE_SIGN)
(FRAC_DIGITS, INT_FRAC_DIGITS, P_CS_PRECEDES, N_CS_PRECEDES)
(P_SEP_BY_SPACE, N_SEP_BY_SPACE, P_SIGN_POSN, N_SIGN_POSN): Define.
* lib/nl_langinfo.c: Include <locale.h> and <string.h> early.
Include <stdio.h> if Microsoft Windows.
Include <time.h> if !REPLACE_NL_LANGINFO.
(ctype_codeset): New function, taken from rpl_nl_langinfo,
and with improvements for Microsoft Windows.
(rpl_nl_langinfo): Use it.
(nl_langinfo) [!REPLACE_NL_LANGINFO]: Likewise.
Compute the values of RADIXCHAR, THOUSEP, GROUPING, CRNCYSTR,
INT_CURR_SYMBOL, MON_DECIMAL_POINT, MON_THOUSANDS_SEP,
MON_GROUPING, POSITIVE_SIGN, NEGATIVE_SIGN, FRAC_DIGITS,
INT_FRAC_DIGITS, P_CS_PRECEDES, N_CS_PRECEDES, P_SEP_BY_SPACE,
N_SEP_BY_SPACE, P_SIGN_POSN, and N_SIGN_POSN from the
corresponding values returned by 'localeconv'. Compute the values
of AM_STR, PM_STR, DAY_n, ABDAY_n, MON_n, and ABMON_n by calling
'strftime' with a suitable struct tm value.
Paul Eggert [Fri, 27 Jun 2014 18:35:44 +0000 (11:35 -0700)]
mktime: merge #if/#ifdef usage from glibc
* lib/mktime.c: Use "#if defined DEBUG && DEBUG", not "#if DEBUG",
as that works with both Glibc's and Gnulib's style.
See thread starting at Siddhesh Poyarekar's bug report at:
http://lists.gnu.org/archive/html/bug-gnulib/2014-06/msg00102.html
Paul Eggert [Thu, 19 Jun 2014 15:51:30 +0000 (08:51 -0700)]
regex: fix memory leak in compiler
Fix by Andreas Schwab in:
https://sourceware.org/ml/libc-alpha/2014-06/msg00462.html
* lib/regcomp.c (parse_expression): Deallocate partially
constructed tree before returning error.
Paul Eggert [Thu, 19 Jun 2014 15:22:20 +0000 (08:22 -0700)]
regex: merge patch from libc
2014-02-12 Joseph Myers <joseph@codesourcery.com>
Combine __USE_BSD and __USE_SVID into __USE_MISC.
* lib/regex.h [__USE_BSD]: Change condition to [__USE_MISC].
Paul Eggert [Tue, 17 Jun 2014 15:09:57 +0000 (08:09 -0700)]
acl: port to gcc -Wredundant-decls
From a request by Dmitry Antipov in:
http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00263.html
* lib/acl.h (_GL_ACL_H): New macro. Protect entire contents with
"#ifndef _GL_ACL_H".
Jim Meyering [Tue, 17 Jun 2014 15:29:46 +0000 (08:29 -0700)]
parse-duration: eliminate 68-year duration limit
* lib/parse-duration.c: Include "intprops.h".
(TIME_MAX): Rename to MAX_DURATION and define to
TYPE_MAXIMUM(time_t).
* modules/parse-duration (Depends-on): Add intprops.
Reported by Jonas 'Sortie' Termansen.
Paul Eggert [Sat, 14 Jun 2014 19:33:26 +0000 (12:33 -0700)]
pthread: don't assume AC_CANONICAL_HOST, port better to Solaris, etc.
* modules/pthread (Depends-on): Add 'extensions', as it defines
_POSIX_PTHREAD_SEMANTICS, which is needed on Solaris.
(configure.ac-early): New section.
* m4/pthread.m4 (gl_PTHREAD_CHECK): Revert previous change, as
it is no longer needed.
Paul Eggert [Fri, 13 Jun 2014 15:30:48 +0000 (08:30 -0700)]
regex: don't be multithreaded if USE_UNLOCKED_IO.
Problem reported by Michael Felt in: http://bugs.gnu.org/17773
* lib/regex_internal.h: Do not use multithreaded version if
USE_UNLOCKED_IO is defined. This is a hack, but it works
around a porting bug with coreutils 8.22 on AIX 7.1.
Eli Zaretskii [Tue, 10 Jun 2014 21:19:13 +0000 (22:19 +0100)]
select: fix waiting on anonymous pipes on MS-Windows
The existing select() implementation for MS-Windows returned
immediately with a zero value when it is called to wait for input
from an anonymous pipe (e.g., a pipe created by a call to 'pipe' or
'pipe2'), as discussed at:
This was noticed while running Guile's test suite on MS-Windows.
Guile uses 'select', among other places, in its implementation
of 'sleep' and 'usleep' primitives. It calls 'select'
with a file descriptor of a signal delivery pipe, which is written to
(by another thread) when Guile is interrupted by a signal. But due to
the above-mentioned problem, these two functions never sleep, and
instead return immediately.
* lib/select.c (rpl_select): Fall back to polling when select()
indicates there is nothing to check, while due to the timeout not
expiring, activity is indicated on one of the handles.
Also clear the TIMEOUT argument if the timer does expire.
Eli Zaretskii [Tue, 10 Jun 2014 20:22:16 +0000 (21:22 +0100)]
times: fix to return non constant value on MS-Windows
The existing implementation of times() for MS-Windows uses the process
creation time returned by the GetProcessTimes API to construct the
value that the function should return, which has two problems:
The value is constant: every call to 'times' within the same
process returns the same value. Callers generally expect the
value to change, since Posix says the value is the elapsed time
since some arbitrary point in time, and that point doesn't change
for function calls in the same process. For example, Guile's test
suite includes a test that calls 'times', sleeps for a few
seconds, then calls 'times' again, and expects the return value to
change according to approximately the number of seconds it slept.
The value overflows the clock_t data type (which is 32 bits wide),
because its point of origin is Jan 1, 1601. This is unnecessary,
since the point of origin can change from process to process.
* lib/times.c (times): Don't use the process creation time,
rather clock() which on windows returns the number of
clock ticks since the process started.
Ben Walton [Tue, 3 Jun 2014 22:01:14 +0000 (23:01 +0100)]
mountlist: avoid hasmntopt const type warning on solaris
* lib/mountlist.c: Solaris defines the OPT param of hasmntopt()
with char * instead of const char *. Passing the constant string
"ignore" generates a compiler warning. For Solaris cast MNT_IGNORE
to avoid the warning.
Ever since commit 3f51bf41, we are leaving garbage in the console
if a user executes commands without first running configure, as
shown in the following pseudo-transcript:
$ git clone $sv/coreutils.git
$ cd coreutils
$ ./bootstrap
$ make
make: -n: Command not found
There seems to be no Makefile in this directory.
You must run ./configure before running 'make'.
make: *** [abort-due-to-no-makefile] Error 1
The first line stems from the fact that we have a $(shell $(SED) -n)
use, which gets unconditionally executed even though $(SED) is only
guaranteed to be defined if Makefile was included. We also end up
trying to invoke /vc-list-files to compute the set of syntax check
rules to run due to a $(shell $(VC_LIST)), even though that file
likely doesn't exist in the root directory, but where the error
message was squelched. Since we already have the nice hooks in
place to remind the user they haven't created Makefile yet, and
since 'make syntax-check' makes no sense without a Makefile, it is
easier to just avoid $(shell) computations of internal state
associated with syntax check, by using the same conditional as
GNUmakefile in determining if Makefile exists.
* top/maint.mk (syntax-check): Guard definition and use of
$(shell) by whether Makefile is present.
* lib/rename.c (rpl_rename): In the non-Win32 variant of rpl_rename,
it is possible that dst_exists may be set but not used. Mark it with
the unused attribute to avoid compiler warnings.
Ben Walton [Mon, 2 Jun 2014 18:50:41 +0000 (19:50 +0100)]
rename: mark a label as potentially unused
* lib/rename.c (rpl_rename): Avoid compiler warnings seen on Solaris,
by marking the out label as potentially unused.
* m4/gnulib-common.m4: Mention the need for the trailing ; for C++.
Paul Eggert [Sat, 31 May 2014 21:07:57 +0000 (14:07 -0700)]
dup2, fcntl, fcntl-h: port to AIX 7.1
This fixes some porting problems discovered when testing the latest
grep snapshot on AIX 7.1. I don't think if fixes any bugs
in grep but it could be important for other applications.
* doc/posix-functions/dup2.texi:
* doc/posix-functions/fcntl.texi:
* doc/posix-headers/fcntl.texi:
Document AIX bugs.
* lib/fcntl.in.h (O_CLOEXEC, O_NOFOLLOW, O_TTY_INIT) [_AIX]:
Define to 0 if outside 'int' range.
* m4/dup2.m4 (gl_FUNC_DUP2):
* m4/fcntl.m4 (gl_FUNC_FCNTL):
Check for getdtablesize. If it's available, test a value just
outside its range instead of testing 1000000. When cross-compiling,
guess that AIX will fail this improved test.
Paul Eggert [Fri, 30 May 2014 16:42:30 +0000 (09:42 -0700)]
ftoastr: work around compiler bug in IBM xlc 12.1
* lib/ftoastr.h (_GL_FLT_PREC_BOUND, _GL_DBL_PREC_BOUND)
(_GL_LDBL_PREC_BOUND): Make these macros, not enums, to work
around a compiler bug in IBM xlc 12.1.0.0: it complains
'"ftoastr.c", line 80.37: 1506-045 (S) Undeclared identifier
_GL_FLT_PREC_BOUND.'
Kieran Colford [Fri, 30 May 2014 12:47:43 +0000 (08:47 -0400)]
valgrind-tests: fixed misleading help message
The help message generated by a configure script using this module
implied that valgrind was disabled by default, which it wasn't.
Left the auto enablement in and patched the help message like:
s/enable/disable/
Paul Eggert [Fri, 30 May 2014 06:00:02 +0000 (23:00 -0700)]
exclude-tests: port to AIX 7.1
* modules/exclude-tests (test_exclude_LDADD): Add $(LIBTHREAD).
Needed on AIX 7.1 with xlc V12.1, otherwise it won't link because
the regex code uses locks.
Paul Eggert [Thu, 29 May 2014 04:04:04 +0000 (21:04 -0700)]
pthread_sigmask, timer-time: use gl_THREADLIB only if needed
Without this fix, Emacs would sometimes call sigprocmask instead
of pthread_sigmask, which is a no-no in multithreaded applications.
Problem reported by Jorgen Schaefer in <http://bugs.gnu.org/17561>.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK):
Suppress check for pthread_sigmask working without -lpthread if
the application always links with -lpthread. Do not link with
$LIBMULTITHREAD if gl_THREADLIB is not defined.
* m4/timer_time.m4 (gl_TIMER_TIME):
Require gl_THREADLIB only if it is defined. Do not append
$LIBMULTITHREAD to LIB_TIMER_TIME if gl_THREADLIB is not defined.
Sylvain Beucler [Tue, 27 May 2014 20:21:55 +0000 (22:21 +0200)]
gnulib-tool: adjust translation wget to avoid a https redirection
Context: http://translationproject.org/latest/gnulib redirects to
https://translationproject.org/latest/gnulib/
Rationale: if the user falls back to wget, she doesn't have rsync and
is probably in a minimal build environment, where packages such as
'ca-certificates' are missing as well, resulting in a failed (and
difficult to detect since ignored) translation initial fetch.
Consequently let's avoid https if possible, and add the missing
trailing slash. This also avoids an unnecessary 302 redirection.
* gnulib-tool: Add trailing slash to gnulib URL.
Pádraig Brady [Thu, 22 May 2014 16:09:49 +0000 (17:09 +0100)]
getlogin_r-tests: fix various issues in recent change
* tests/test-getlogin_r.c: Include required headers that were
missed in recent commit eec20b4e.
Also consistently check the errno rather than the return value from
getlogin_r as POSIX only specifies that non zero is returned on error.
* modules/getlogin_r-tests (configure.ac): Add the check for ttyname().
Paul Eggert [Thu, 22 May 2014 07:05:01 +0000 (00:05 -0700)]
fchdir: port 'open' and 'close' redefinitions to AIX 7.1
* lib/chown.c, lib/clean-temp.c, lib/copy-file.c, lib/execute.c:
* lib/fsusage.c, lib/gc-gnulib.c, lib/javacomp.c, lib/mountlist.c:
* lib/openat-proc.c, lib/pagealign_alloc.c, lib/progreloc.c:
* lib/spawn-pipe.c:
Do not #undef 'open' and 'close'. AIX 7 does '#define open open64'
and then 'int open64(const char *, int, ...);', which means the
declaration for 'open' gets lost if we later '#undef open'.
Discovered while building grep pretest 2.18.151-1c770 on AIX 7.1,
where the compilation reported the non-fatal error "In function
'openat_proc_name' ... warning: implicit declaration of function
'open'". In this case the error is relatively harmless, but in
other cases it might not be so minor.
Paul Eggert [Wed, 21 May 2014 01:14:48 +0000 (18:14 -0700)]
xalloc: don't potentially generate invalid code for xmemdup calls
* lib/xalloc.h (xmemdup): Do not mark with _GL_ATTRIBUTE_ALLOC, as
this function can initialize the newly-allocated storage with new
pointers, which means this function is not malloc-like. See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56955
Pádraig Brady [Sun, 18 May 2014 01:48:03 +0000 (02:48 +0100)]
getlogin-tests: avoid false failure under cron
* tests/test-getlogin.c (main): Avoid verifying errnos from ttyname()
since that's not what's under test. Centos 6 was seen to return
EINVAL for ttyname() when run from cron.
Paul Eggert [Fri, 16 May 2014 20:56:00 +0000 (13:56 -0700)]
mbrlen, mbrtowc: fix bug with empty input
* lib/mbrtowc.c (rpl_mbrtowc) [MBRTOWC_EMPTY_INPUT_BUG]: Fix the bug.
* m4/mbrlen.m4 (gl_MBRLEN_EMPTY_INPUT): New macro. It's not used,
so this is mainly for documentation.
* m4/mbrtowc.m4 (gl_MBRTOWC_EMPTY_INPUT): New macro.
(gl_FUNC_MBRTOWC): Use it.
* tests/test-mbrtowc.c (main): Test for the bug.
Paul Eggert [Fri, 16 May 2014 01:30:04 +0000 (18:30 -0700)]
doc: document mbrtowc and mbrlen problem with empty input
* doc/posix-functions/mbrlen.texi (mbrlen):
* doc/posix-functions/mbrtowc.texi (mbrtowc):
Document portability problem when the input string is empty. See:
https://sourceware.org/bugzilla/show_bug.cgi?id=16950
getlogin-tests: avoid false failure under sudo/ssh etc.
* modules/getlogin-tests (configure.ac): Check for ttyname().
* tests/test-getlogin.c (main): Don't depend on environment variables
to correlate with getlogin(), since sudo and ssh etc. can tamper
with the LOGNAME and USER env vars. Instead lookup the name from
the uid associated with the stdin tty.
Paul Eggert [Sun, 11 May 2014 07:36:37 +0000 (00:36 -0700)]
mbsstr, quotearg, xstrtol: pacify IRIX 6.5 cc
These were found when building the latest grep snapshot on IRIX 6.5.
* lib/mbsstr.c (knuth_morris_pratt_multibyte): Break "a=b=c;" into
"b=c; a=b;", since IRIX 6.5 cc complains about the former if b is
never used later.
* lib/quotearg.c (quoting_options_from_style):
* lib/xstrtol.c (__xstrtol):
Use enum instead of 0, to pacify IRIX 6.5 cc.
gitlog-to-changelog: revert inclusion of git-log-fix file
Assaf Gordon reported that this would replace a project's
existing git-log-fix. This file is always going to be project
specific if it exists at all, so it's better to make it optional.
A corresponding change will be made to GNU hello to improve
usage of the git-log-fix file.
* build-aux/git-log-fix: Delete dummy file.
* modules/gitlog-to-changelog: Don't reference the project
specific git-log-fix file.
Natanael Copa [Fri, 18 Apr 2014 09:16:27 +0000 (09:16 +0000)]
physmem: use sysinfo if _SC_PHYS_PAGES unavailable
* lib/physmem.c (physmem_total): Some systems like musl libc do not
(yet) support _SC_PHYS_PAGES. Use the linux syscall sysinfo as fallback
if _SC_PHYS_PAGES or _SC_PAGESIZE fails.
(physmem_available): Likewise for _SC_AVPHYS_PAGES.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Paul Eggert [Sat, 19 Apr 2014 05:29:55 +0000 (22:29 -0700)]
exclude: port to strict C99
Strict C does not allow converting a function pointer to void *
and vice versa. Pass a pointer to a function pointer instead.
* lib/exclude.c (add_exclude_file):
Pass the address of the function pointer.
(call_addfn): And deference the address here, to match.
Paul Eggert [Fri, 18 Apr 2014 05:41:09 +0000 (22:41 -0700)]
regex: do not depend on malloc-gnu
* modules/regex (Depends-on): Remove malloc-gnu.
It's no longer needed, because of the 2012-12-29 patch
"regex: port to hosts where malloc (0) == NULL".
Reported by Nathan Kennedy in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-04/msg00026.html