]> Savannah Git Hosting - gnulib.git/log
gnulib.git
10 years agomountlist: avoid hasmntopt const type warning on solaris
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.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
10 years agomaintainer-makefile: delete obsolete code
Eric Blake [Wed, 4 Jun 2014 19:09:56 +0000 (13:09 -0600)]
maintainer-makefile: delete obsolete code

I noticed this while reading through the file to debug a different
issue.  The grace period mentioned in the comment has elapsed.

* top/maint.mk (build_aux): Drop old code, as threatened.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaintainer-makefile: avoid spurious error messages
Eric Blake [Wed, 4 Jun 2014 18:52:33 +0000 (12:52 -0600)]
maintainer-makefile: avoid spurious error messages

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.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agorename: avoid unused-but-set-variable compiler warning
Ben Walton [Mon, 2 Jun 2014 19:13:54 +0000 (20:13 +0100)]
rename: avoid unused-but-set-variable compiler warning

* 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.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
10 years agomaint: add ChangeLog entry missing in previous commit
Pádraig Brady [Mon, 2 Jun 2014 19:08:05 +0000 (20:08 +0100)]
maint: add ChangeLog entry missing in previous commit

* ChangeLog: Add the omitted entry.

10 years agorename: mark a label as potentially unused
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++.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
10 years agognulib-common.m4: Fix typo in _GL_UNUSED_LABEL.
Paul Eggert [Sun, 1 Jun 2014 23:52:00 +0000 (16:52 -0700)]
gnulib-common.m4: Fix typo in _GL_UNUSED_LABEL.

* m4/gnulib-common.m4 (_GL_UNUSED_LABEL): Omit trailing semicolon.

10 years agoacl: apply pure attribute to two functions
Ben Walton [Sun, 1 Jun 2014 22:39:44 +0000 (23:39 +0100)]
acl: apply pure attribute to two functions

* lib/acl-internal.h (acl_nontrivial, acl_ace_nontrivial):
Mark as "pure" as flagged by gcc 4.9 on Solaris 10.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
10 years agognulib-common.m4: add _GL_UNUSED_LABEL
Pádraig Brady [Sun, 1 Jun 2014 21:25:28 +0000 (22:25 +0100)]
gnulib-common.m4: add _GL_UNUSED_LABEL

* m4/gnulib-common.m4: Add _GL_UNUSED_LABEL which is similar to
_GL_UNUSED, but handles g++ < 4.5 not supporting this syntax.

10 years agodup2, fcntl, fcntl-h: port to AIX 7.1
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.

10 years agoprintf, config.rpath: Port to FreeBSD 10.
Paul Eggert [Fri, 30 May 2014 23:15:27 +0000 (16:15 -0700)]
printf, config.rpath: Port to FreeBSD 10.

Problem reported by Tijl Coosemans in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-05/msg00078.html
* build-aux/config.rpath (hardcode_libdir_flag_spec)
(hardcode_direct): Simplify FreeBSD configuration.
(library_names_spec): Don't mishandle FreeBSD 10+.
* m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_LONG_DOUBLE)
(gl_PRINTF_INFINITE_LONG_DOUBLE, gl_PRINTF_DIRECTIVE_F)
(gl_SNPRINTF_TRUNCATION_C99, gl_SNPRINTF_RETVAL_C99)
(gl_SNPRINTF_DIRECTIVE_N, gl_VSNPRINTF_ZEROSIZE_C99):
Don't mishandle FreeBSD 10+ when cross-compiling.

10 years agoftoastr: work around compiler bug in IBM xlc 12.1
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.'

10 years agovalgrind-tests: fixed misleading help message
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/

10 years agoisfinite, isinf, isnan tests: fix for little-endian PowerPC
Ulrich Weigand [Fri, 30 May 2014 10:34:23 +0000 (11:34 +0100)]
isfinite, isinf, isnan tests: fix for little-endian PowerPC

* tests/test-isfinite.c (test_isfinitel): Only manipulate the
first double of a PowerPC "double double" pair.
* tests/test-isinf.c (test_isinfl): Likewise.
* tests/test-isnan.c (test_long_double): Likewise.
* tests/test-isnanl.h (main): Likewise.
* tests/test-signbit.c (test_signbitl): Likewise.

10 years agoexclude-tests: port to AIX 7.1
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.

10 years agopthread_sigmask, timer-time: use gl_THREADLIB only if needed
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.

10 years agognulib-tool: wget translations using --no-verbose rather than --quiet
Sylvain Beucler [Tue, 27 May 2014 20:25:59 +0000 (22:25 +0200)]
gnulib-tool: wget translations using --no-verbose rather than --quiet

This allows the user to see error messages if any (--quiet hides them)
* gnulib-tool: Invoke wget with --no-verbose, rather than --quiet.

10 years agognulib-tool: adjust translation wget to avoid a https redirection
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.

10 years agogetlogin_r-tests: check return value rather than errno
Pádraig Brady [Thu, 22 May 2014 16:49:33 +0000 (17:49 +0100)]
getlogin_r-tests: check return value rather than errno

* tests/test-getlogin_r.c (main): As per POSIX we should be
verifying the return value from getlogin_r() rather than errno.

10 years agogetlogin_r-tests: fix various issues in recent change
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().

10 years agofchdir: port 'open' and 'close' redefinitions to AIX 7.1
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.

10 years agoupdate from texinfo
Karl Berry [Wed, 21 May 2014 22:53:19 +0000 (15:53 -0700)]
update from texinfo

10 years agoxalloc: don't potentially generate invalid code for xmemdup calls
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

10 years agogetlogin_r-tests: avoid false failure under sudo/ssh etc.
Pádraig Brady [Mon, 19 May 2014 12:04:23 +0000 (13:04 +0100)]
getlogin_r-tests: avoid false failure under sudo/ssh etc.

* tests/test-getlogin_r.c (main): Sync up with test-getlogin.c
changes from commit 97249cf29 to not depend on environment variables.

10 years agogetlogin-tests: avoid false failure under cron
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.

10 years agombrtowc.m4: fix a comment typo
Jim Meyering [Fri, 16 May 2014 23:03:14 +0000 (16:03 -0700)]
mbrtowc.m4: fix a comment typo

* m4/mbrtowc.m4 (gl_FUNC_MBRTOWC): Fix typo s/2/-2/ in
emitted documentation string.

10 years agombrlen, mbrtowc: fix bug with empty input
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.

10 years agodoc: document mbrtowc and mbrlen problem with empty input
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

10 years agodoc: document exec* = spawn+exit bug with non-Cygwin Windows platforms
Paul Eggert [Thu, 15 May 2014 20:07:50 +0000 (13:07 -0700)]
doc: document exec* = spawn+exit bug with non-Cygwin Windows platforms

Problem reported by Eli Zaretskii in:
http://lists.gnu.org/archive/html/bug-grep/2014-05/msg00118.html
* doc/posix-functions/execl.texi (execl):
* doc/posix-functions/execle.texi (execle):
* doc/posix-functions/execlp.texi (execlp):
* doc/posix-functions/execv.texi (execv):
* doc/posix-functions/execve.texi (execve):
* doc/posix-functions/execvp.texi (execvp):
Mention spawn+exit problem on non-Cygwin Windows platforms.

10 years agoautoupdate
Karl Berry [Thu, 15 May 2014 12:37:17 +0000 (05:37 -0700)]
autoupdate

10 years agogetlogin-tests: avoid false failure under sudo/ssh etc.
Guilherme de Almeida Suckevicz [Wed, 14 May 2014 21:06:24 +0000 (22:06 +0100)]
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.

10 years agombsstr, quotearg, xstrtol: pacify IRIX 6.5 cc
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.

11 years agoupdate from texinfo
Karl Berry [Mon, 5 May 2014 18:10:30 +0000 (11:10 -0700)]
update from texinfo

11 years agoautoupdate
Karl Berry [Thu, 1 May 2014 17:30:52 +0000 (10:30 -0700)]
autoupdate

11 years agoautoupdate
Karl Berry [Thu, 1 May 2014 13:02:49 +0000 (06:02 -0700)]
autoupdate

11 years agoautoupdate
Karl Berry [Tue, 22 Apr 2014 19:22:12 +0000 (12:22 -0700)]
autoupdate

11 years agogitlog-to-changelog: revert inclusion of git-log-fix file
Pádraig Brady [Fri, 18 Apr 2014 23:50:11 +0000 (00:50 +0100)]
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.

11 years agomaint.mk: Relax the copyright check to cater for non FSF projects
Assaf Gordon [Fri, 18 Apr 2014 18:34:45 +0000 (19:34 +0100)]
maint.mk: Relax the copyright check to cater for non FSF projects

* top/maint.mk (sc_copyright_check): Relax the check for $PACKAGE.texi
to not require the "Free" suffix after the copyright years.

11 years agophysmem: use sysinfo if _SC_PHYS_PAGES unavailable
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>
11 years agoexclude: port to strict C99
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.

11 years agoregex: do not depend on malloc-gnu
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

11 years agoautoupdate
Karl Berry [Thu, 17 Apr 2014 12:53:58 +0000 (05:53 -0700)]
autoupdate

11 years agoexpl: avoid incorrect expl(small_value) on OpenBSD 5.4
Assaf Gordon [Wed, 16 Apr 2014 15:35:55 +0000 (11:35 -0400)]
expl: avoid incorrect expl(small_value) on OpenBSD 5.4

OpenBSD 5.4, expl() incorrectly returns 'nan' for small values.
Detect this and use gnulib's expl() in that case.

Discussed here:
http://marc.info/?t=139159081700002&r=1&w=2
(Message from David Coppa on 2014-02-05 to openbsd-tech mailing list).

Fixed here (in revision 1.2):
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libm/src/ld128/s_floorl.c

* m4/expl.m4 (gl_FUNC_EXPL): Add a check for this condition.
* doc/posix-functions/expl.texi: Mention the workaround.

11 years agoxalloc: allow x2nrealloc (P, PN, S) where P && !*PN
Paul Eggert [Sat, 12 Apr 2014 17:45:47 +0000 (10:45 -0700)]
xalloc: allow x2nrealloc (P, PN, S) where P && !*PN

* lib/xalloc.h (x2nrealloc): Extend slightly, to allow the current
size to be zero even when the pointer is nonnull.  This
accommodates the use case where P is malloc (0) and *PN is 0 on a
host where malloc (0) yields nonnull.

11 years agofts: avoid unnecessary strlen calls
Eric Blake [Wed, 9 Apr 2014 16:20:08 +0000 (10:20 -0600)]
fts: avoid unnecessary strlen calls

Not all platforms have _D_EXACT_NAMLEN.

* lib/fts.c (_D_EXACT_NAMLEN): Restore definition when needed.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agofts: avoid unnecessary strlen calls
Paul Eggert [Wed, 9 Apr 2014 16:08:55 +0000 (09:08 -0700)]
fts: avoid unnecessary strlen calls

* lib/fts.c (fts_build): Go back to using _D_EXECT_NAMLEN
when that can be faster than strlen.

11 years agofts: avoid unnecessary strlen calls
Bernhard Voelker [Wed, 9 Apr 2014 12:14:08 +0000 (14:14 +0200)]
fts: avoid unnecessary strlen calls

* lib/fts.c (_D_EXACT_NAMLEN): Remove macro.
(fts_build): Store the length of the dp->d_name entry in a local variable
instead of calling strlen() several times via the above, removed macro.
For 'rm -rf some-dir' with e.g. 1M directory entries, this speeds up the
run by ~4%, and reduces the execution time by about a third if run
via "ltrace -c rm -rf some-dir".

11 years agoautoupdate
Karl Berry [Thu, 3 Apr 2014 13:58:48 +0000 (06:58 -0700)]
autoupdate

11 years agoautoupdate
Karl Berry [Mon, 31 Mar 2014 23:34:04 +0000 (16:34 -0700)]
autoupdate

11 years agoobstack: Remove ancient NeXTSTEP gcc support conditional
Paul Eggert [Thu, 27 Mar 2014 20:38:41 +0000 (13:38 -0700)]
obstack: Remove ancient NeXTSTEP gcc support conditional

This change will ease merging with glibc.  The "#if ... __NEXT__"
causes a warning with -Wundef which glibc now enables by default.
Problem reported by Will Newton in
<http://lists.gnu.org/archive/html/bug-gnulib/2014-03/msg00032.html>.
glibc <sys/cdefs.h> now uses __extension__ for GCC 2.8 or later,
so go with that.
* lib/obstack.h (__extension__):

11 years agoobstack: merge with glibc changes
Paul Eggert [Thu, 27 Mar 2014 19:55:07 +0000 (12:55 -0700)]
obstack: merge with glibc changes

* lib/obstack.c, lib/obstack.h: Merge from glibc.
This is mostly indenting and commentary changes.
Instances of 'register' have been removed.

11 years agostrftime: wrap macros in "do {...} while(0)"
Bernhard Voelker [Wed, 26 Mar 2014 01:45:58 +0000 (02:45 +0100)]
strftime: wrap macros in "do {...} while(0)"

* lib/strftime.c (DO_NUMBER): Wrap multi-statement code block of
this macro in "do {...} while(0)" to prevent false use as a
single statement, e.g., in an un-braced "{}" else-block.
(DO_SIGNED_NUMBER, DO_TZ_OFFSET, DO_NUMBER_SPACEPAD): Likewise.
(strftime_case_): Remove 'else' after 'goto' - which was the
only non-fatal, un-braced use of one of the above macros.
Spotted by coverity (NESTING_INDENT_MISMATCH).

11 years agomodechange: avoid memory leaks for invalid octal modes
Bernhard Voelker [Wed, 26 Mar 2014 00:42:11 +0000 (01:42 +0100)]
modechange: avoid memory leaks for invalid octal modes

* lib/modechange.c (mode_compile): During the parsing of
notations like +40, free the 'mc' buffer for invalid mode
strings like +17777 (greater than the maximum octal mode),
=18 (bad octal mode characters) or u=1 ('affected' with
octal modes).
Reproducer, e.g.:

    $ valgrind --leak-check=full chmod +17777 file

Introduced via the 2012-03-09 commit, 4730c3e3, "modechange:
add notations +40, 00440, etc.".
Spotted by coverity (RESOURCE_LEAK).

11 years agoautoupdate
Karl Berry [Tue, 25 Mar 2014 13:08:30 +0000 (06:08 -0700)]
autoupdate

11 years agogitlog-to-changelog: include a dummy git-log-fix file
Paul Eggert [Mon, 24 Mar 2014 15:04:57 +0000 (08:04 -0700)]
gitlog-to-changelog: include a dummy git-log-fix file

Problem reported by Nathan Stratton Treadway in:
http://lists.gnu.org/archive/html/bug-tar/2014-03/msg00082.html
* build-aux/git-log-fix: New file.

11 years agoautoupdate
Karl Berry [Wed, 19 Mar 2014 17:51:48 +0000 (10:51 -0700)]
autoupdate

11 years agoupdate from texinfo
Karl Berry [Mon, 17 Mar 2014 14:47:50 +0000 (07:47 -0700)]
update from texinfo

11 years agogitlog-to-changelog: also include the file, git-log-fix
Jim Meyering [Thu, 13 Mar 2014 20:00:00 +0000 (13:00 -0700)]
gitlog-to-changelog: also include the file, git-log-fix

* modules/gitlog-to-changelog (Files): Add git-log-fix.
Reported by Assaf Gordon.

11 years agoautoupdate
Karl Berry [Fri, 14 Mar 2014 13:04:56 +0000 (06:04 -0700)]
autoupdate

11 years agoregex: port to OS X 10.8.5 en_US.UTF-8 locale
Paul Eggert [Fri, 7 Mar 2014 05:53:50 +0000 (21:53 -0800)]
regex: port to OS X 10.8.5 en_US.UTF-8 locale

This fixes a bug when ignoring case and when comparing the
titlecase letter 'Lj' (U+01C8 LATIN CAPITAL LETTER L WITH SMALL
LETTER J) to the corresponding uppercase letter 'LJ' (U+01C7 LATIN
CAPITAL LETTER LJ).  In the OS X 10.8.5 en_US.UTF-8 locale, the
titlecase letter is neither lowercase nor uppercase, but
uppercasing the titlecase letter (via towupper) yields the
uppercase letter, so the two letters should match when ignoring case.
Problem reported by Jim Meyering in <http://debbugs.gnu.org/16911#16>.
* lib/regex_internal.c (build_wcs_upper_buffer, build_upper_buffer):
Don't test whether a character is lowercase before uppercasing it.

11 years agomaint: fix ChangeLog to match commit record
Paul Eggert [Thu, 6 Mar 2014 01:51:59 +0000 (17:51 -0800)]
maint: fix ChangeLog to match commit record

11 years agostdint, read-file: fix missing SIZE_MAX on Android (tiny change)
Kevin Cernekee [Wed, 5 Mar 2014 20:10:56 +0000 (12:10 -0800)]
stdint, read-file: fix missing SIZE_MAX on Android (tiny change)

This is basically one of the options Bruno Haible proposed in:
http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00282.html
* lib/sys_types.in.h (_GL_INCLUDING_UNISTD_H): New macro.
* lib/stdint.in.h: Use it.
* modules/stdint (Depends-on): Add sys_types.

11 years agoparse-datetime: fix crash or infloop in TZ="" parsing
Pádraig Brady [Tue, 25 Feb 2014 10:58:48 +0000 (10:58 +0000)]
parse-datetime: fix crash or infloop in TZ="" parsing

This was reported in http://bugs.gnu.org/16872
from the coreutils command: date -d 'TZ="""'

The infinite loop for this case was present since the
initial TZ="" parsing support in commit de95bdc2 29-10-2004.
This was changed to a crash or heap corruption depending
on the platform with commit 2e3e4195 18-01-2010.

* lib/parse-datetime.y (parse_datetime): Break out of the
TZ="" parsing loop once the second significant " is found.
Also skip over any subsequent whitespace to be consistent
with the non TZ= case.
* tests/test-parse-datetime.c: Add test cases for TZ="" parsing.

11 years ago* NEWS: Recent changes are not that important.
Paul Eggert [Thu, 27 Feb 2014 07:58:18 +0000 (23:58 -0800)]
* NEWS: Recent changes are not that important.

11 years agosavedir: new symbol for fast-read version
Paul Eggert [Thu, 27 Feb 2014 07:57:26 +0000 (23:57 -0800)]
savedir: new symbol for fast-read version

* lib/savedir.h (SAVEDIR_SORT_FASTREAD): New symbol, for programs
like GNU cp that want to use SAVEDIR_SORT_INODE if available,
SAVEDIR_SORT_NONE otherwise.  Problem reported by Bernhard Voelker in:
http://lists.gnu.org/archive/html/coreutils/2014-02/msg00037.html

11 years agounistd: port readlink to Mac OS X 10.3.9
Paul Eggert [Tue, 25 Feb 2014 19:16:27 +0000 (11:16 -0800)]
unistd: port readlink to Mac OS X 10.3.9

* lib/unistd.in.h (_GL_INCLUDING_UNISTD_H): New macro, to work
around self-include problem in Mac OS X 10.3.9 when combined with
readlink module.  Problem reported by Klaus Zietler in
<http://bugs.gnu.org/16825>.

11 years ago* NEWS: Document recent change to diffseq.
Paul Eggert [Mon, 24 Feb 2014 00:19:31 +0000 (16:19 -0800)]
* NEWS: Document recent change to diffseq.

11 years agodiffseq: remove TOO_EXPENSIVE heuristic
Paul Eggert [Mon, 24 Feb 2014 00:16:31 +0000 (16:16 -0800)]
diffseq: remove TOO_EXPENSIVE heuristic

Problem with diffutils reported by Vincent Lefevre in
<http://bugs.gnu.org/16848>.  The simplest solution is to remove
the TOO_EXPENSIVE heuristic that I added to GNU diff in 1993.
Although appropriate for circa-1993 hardware, these days the heuristic
seems to be more trouble than it's worth.
* lib/diffseq.h: Modernize citations.
(struct context): Remove member too_expensive.
All uses changed.
(struct partition): Remove members lo_minimal, hi_minimal.
All uses changed.
(diag, compareseq): Remove arg find_minimal.  All uses changed.
(diag): Remove the TOO_EXPENSIVE heuristic that I added back in
1993 to make 'diff' run faster (but not as well) on large inputs.
These days, computers are fast enough that it's typically better
to run slower but more accurately.
* lib/fstrcmp.c: Remove duplicate comment.
* lib/fstrcmp.c (strcmp_bounded):
* lib/git-merge-changelog.c (compute_differences):
Adjust to diffseq.h changes.

11 years agosavedir: simplify by using stpcpy
Paul Eggert [Sun, 23 Feb 2014 22:20:18 +0000 (14:20 -0800)]
savedir: simplify by using stpcpy

* lib/savedir.c (direntry_t): Remove size member.  All uses removed.
(streamsavedir): Use stpcpy instead.
* modules/savedir (Depends-on): Add stpcpy.

11 years agospawn: fix link error on uclibc
Pádraig Brady [Tue, 14 Jan 2014 16:59:07 +0000 (16:59 +0000)]
spawn: fix link error on uclibc

* m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): use AC_SEARCH_LIBS,
to incorporate -lrt if needed (on uclibc for example).
* modules/posix_spawn: Reference the substituted LIB.

11 years agom4: fix gl_TIMER_TIME() detection of threads on uClibc
Thomas Petazzoni [Fri, 21 Feb 2014 23:41:38 +0000 (00:41 +0100)]
m4: fix gl_TIMER_TIME() detection of threads on uClibc

The timer_time.m4 gl_TIMER_TIME function determines which libraries
need to be linked to get access to the timer function, generally -lrt
for Linux systems. On platforms where threads are used, librt
typically uses thread functions from libpthread.

However, the test to determine whether the platform has thread or not
is incorrect: it assumes that if the C library is uClibc, then threads
are not available. This is actually not true: uClibc has configurable
thread support, and when thread support is available, librt calls
libpthread functions.

This is important when static linking is used, because otherwise only
-lrt is used at link time, which fails because librt calls undefined
thread functions. Both -lrt and -lpthread must be passed.

This problem is fixed by making the uClibc thread detection a bit
smarter, thanks to the usage of the __HAS_NO_THREADS__ macro defined
in <bits/uClibc_config.h>, which itself is included by <features.h>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaintainer-makefiles: provide AC_PROG_SED for older autoconf
Eric Blake [Fri, 21 Feb 2014 20:02:10 +0000 (13:02 -0700)]
maintainer-makefiles: provide AC_PROG_SED for older autoconf

Pavel Hrdina reported build failures on RHEL 5, where autoconf 2.59
is still the default, and predates the introduction of AC_PROG_SED.

This version is copied from autoconf 2.69, but with lots of constructs
open-coded because of macros not being available in 2.59; I tested
that the result selects the correct sed under RHEL 5.

* m4/gnulib-common.m4 (AC_PROG_SED): Copy from newer autoconf.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoexclude: add support for posix regexps
Sergey Poznyakoff [Sat, 15 Feb 2014 17:21:04 +0000 (19:21 +0200)]
exclude: add support for posix regexps

This commit adds support for POSIX extended regular expressions
and fixes a long-standing memory leak (pattern buffer was never
freed).  It also implements a new interface function to read
exclude patterns from a FILE, which passes an additional parameter
to its callback function, thereby allowing to preserve its state
between invocations.

* lib/exclude.c (struct patopts): Pack regex and pattern into union.
(pattern_buffer): New struct.
(exclude): New member patbuf.
(exclude_add_pattern_buffer): New function.
(free_exclude_segment): Free regexps.
(free_exclude): Free allocated pattern buffers.
(exclude_patopts): New function.
(file_pattern_matches): Use exclude_patopts.
(add_exclude): support regexps.
(add_exclude_fp): New function.
(add_exclude_file): Rewrite using add_exclude_fp.
(fnmatch_pattern_has_wildcards): Support posix extended regexps.
* lib/exclude.h (EXCLUDE_REGEX, EXCLUDE_ALLOC): New flags.
(add_exclude_fp)
(exclude_add_pattern_buffer): New prototypes.
* modules/exclude: Depends on regex and filename.

11 years agomaintainer-makefiles: use $(SED) for syntax check
Eric Blake [Thu, 20 Feb 2014 13:56:42 +0000 (06:56 -0700)]
maintainer-makefiles: use $(SED) for syntax check

Roman Bogorodskiy reported that attempts to use 'make syntax-check'
for libvirt on a BSD host was failing, due to libvirt's use of
GNU sed constructs in cfg.mk.  While libvirt could be patched to
use only portable sed constructs, it is also worth making sed
replaceable so that any maintainer can use a consistent sed program
rather than being hardcoded to the first 'sed' on $PATH.

* modules/maintainer-makefile (configure.ac): Check for sane sed.
* top/maint.mk: Change sed to $(SED).

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoupdate from texinfo
Karl Berry [Mon, 17 Feb 2014 00:36:46 +0000 (16:36 -0800)]
update from texinfo

11 years agosavedir: add sorting arg to savedir, streamsavedir; remove fdsavedir
Sergey Poznyakoff [Thu, 13 Feb 2014 20:01:39 +0000 (22:01 +0200)]
savedir: add sorting arg to savedir, streamsavedir; remove fdsavedir

Patch based on an idea by Dick Streefland in
<https://savannah.gnu.org/patch/?7892>.

* NEWS: Document this.
* lib/savedir.c (NAME_SIZE_DEFAULT): Remove.
(direntry_t, comparison_function): New types.
(direntry_cmp_name): New function.
(direntry_cmp_inode) [D_INO_IN_DIRENT]: New function.
(streamsavedir, savedir): New arg OPTION.
(streamsavedir): Simplify memory allocation.
(fdsavedir): Remove.
* lib/savedir.h (enum savedir_option): New type.
(streamsavedir, savedir): New arg OPTION.
(fdsavedir): Remove.

11 years agoautoupdate
Karl Berry [Thu, 13 Feb 2014 14:45:03 +0000 (06:45 -0800)]
autoupdate

11 years agoupdate from texinfo
Karl Berry [Sun, 9 Feb 2014 23:55:24 +0000 (15:55 -0800)]
update from texinfo

11 years agoupdate from texinfo
Karl Berry [Thu, 6 Feb 2014 23:19:16 +0000 (15:19 -0800)]
update from texinfo

11 years agofile-type: add support for doors and other less-common file types
Paul Eggert [Wed, 5 Feb 2014 19:09:15 +0000 (11:09 -0800)]
file-type: add support for doors and other less-common file types

Problem with S_ISDOOR reported by Rich Burridge.
* lib/file-type.c (file_type): Do S_ISLNK early too.  Do S_TYPEIS*
macros before the rest.  Add S_ISCTG, S_ISDOOR, S_ISMPB, S_ISMPC,
S_ISMPX, S_ISNAM, S_ISNWK, S_ISOFD, S_ISOFL, S_ISPORT, S_ISWHT.

11 years agoupdate from texinfo
Karl Berry [Thu, 30 Jan 2014 23:46:38 +0000 (15:46 -0800)]
update from texinfo

11 years agoautoupdate
Karl Berry [Sat, 25 Jan 2014 14:40:43 +0000 (06:40 -0800)]
autoupdate

11 years agopthread: work around winpthread header pollution on mingw
Eric Blake [Thu, 23 Jan 2014 03:39:45 +0000 (20:39 -0700)]
pthread: work around winpthread header pollution on mingw

Dan Berrange reported compilation failure of libvirt on Fedora 20
when cross-compiling to mingw; the problem was traced to bogus
macros in the winpthreads <pthread.h> header shipped as part of
mingw-headers 3.0.

  CC       util/libvirt_util_la-virerror.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/sys/time.h:10:0,
                 from ../gnulib/lib/sys/time.h:39,
                 from ../gnulib/lib/sys/select.h:117,
                 from util/virutil.h:31,
                 from util/virerror.c:35:
../gnulib/lib/time.h:468:21: error: expected identifier or '(' before '{' token
 _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
                     ^

Gnulib's time.h was already working around the pthread.h pollution,
but now that newer mingw has started providing struct timespec,
the workaround was no longer being hit.  Moving the pollution
workaround to the wrapper around the broken header solves the problem.

* lib/time.in.h: Move pthread workarounds...
* lib/pthread.in.h: ...here.
* m4/pthread.m4 (gl_PTHREAD_CHECK): Also build pthread.h when we
detect macro pollution on mingw.
* doc/posix-headers/pthread.texi (pthread.h): Document the problems.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqacl: check for fchmod
Paul Eggert [Thu, 23 Jan 2014 02:40:47 +0000 (18:40 -0800)]
qacl: check for fchmod

* m4/acl.m4 (gl_FUNC_ACL): Check for fchmod, since acl-internal.h
and qset-acl.c both use HAVE_FCHMOD.

11 years agoFix typo in ChangeLog.
Paul Eggert [Tue, 21 Jan 2014 06:16:38 +0000 (22:16 -0800)]
Fix typo in ChangeLog.

11 years agofdopen-tests: port to Tru64
Paul Eggert [Tue, 21 Jan 2014 06:12:56 +0000 (22:12 -0800)]
fdopen-tests: port to Tru64

* tests/test-fdopen.c (main): Don't invoke fdopen on a file
descriptors that is not open, as POSIX doesn't specify the
resulting behavior and the test does not work on Tru64.
Problem reported by Steven M. Schweda in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-01/msg00079.html

11 years agostdalign: port to HP-UX compilers
Paul Eggert [Mon, 20 Jan 2014 20:36:30 +0000 (12:36 -0800)]
stdalign: port to HP-UX compilers

* lib/stdalign.in.h (_Alignas): Use __attribute__ (__aligned__ (x))
if __HP_cc or __HP_aCC are nonzero.

11 years agostrtoimax: port to platforms lacking 'long long'
Paul Eggert [Thu, 16 Jan 2014 21:01:07 +0000 (13:01 -0800)]
strtoimax: port to platforms lacking 'long long'

VMS's pre-C99 compiler lacks 'long long', so 'configure' doesn't
check whether strtoll is declared, which causes the C file to
wrongly report an error.  Problem reported by Steven M. Schweda in:
http://lists.gnu.org/archive/html/bug-diffutils/2014-01/msg00003.html
* lib/strtoimax.c (strtoull):
Declare only if HAVE_UNSIGNED_LONG_LONG_INT.
(strtoll): Declare only if HAVE_LONG_LONG_INT.

11 years agoupdate from texinfo
Karl Berry [Thu, 16 Jan 2014 19:02:33 +0000 (11:02 -0800)]
update from texinfo

11 years agorelocatable-maint.texi: escape braces
Daniel Albers [Thu, 16 Jan 2014 11:56:52 +0000 (12:56 +0100)]
relocatable-maint.texi: escape braces

The change causes makeinfo 5.2 to fail:

env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= makeinfo --no-split
--reference-limit=2000 gnulib.texi
./relocatable-maint.texi:153: misplaced {
...

Escaping the braces as per the attached patch seems to fix this.

11 years agomaint: remove duplicate ChangeLog entry
Jim Meyering [Wed, 15 Jan 2014 16:27:02 +0000 (08:27 -0800)]
maint: remove duplicate ChangeLog entry

* ChangeLog: My 2014-01-03 entry was listed twice.  Remove the latest.
Spotted by Bernhard Voelker.

11 years agomaint.mk: adapt openat.h-include-without-use test
Jim Meyering [Sat, 4 Jan 2014 00:58:50 +0000 (16:58 -0800)]
maint.mk: adapt openat.h-include-without-use test

* top/maint.mk (sc_prohibit_openat_without_use): Also check for
FCHMODAT_INLINE, FCHOWNAT_INLINE and STATAT_INLINE, to avoid
failing on gnulib's own lib/{chmod,chown,stat}at.c files.
With this change, running "make sc_maint" in gnulib's top-level
directory now passes for me.

11 years agorelocatable-perl: like relocatable-script, but for Perl scripts
Reuben Thomas [Thu, 9 Jan 2014 22:31:42 +0000 (22:31 +0000)]
relocatable-perl: like relocatable-script, but for Perl scripts

* build-aux/relocatable.pl.in: Add.
* doc/relocatable-maint.texi: Add documentation.
* modules/relocatable-perl: Add.

11 years agorelocatable-shell: Update suggested usage in maintainer documentation.
Ben Pfaff [Thu, 9 Jan 2014 06:15:21 +0000 (22:15 -0800)]
relocatable-shell: Update suggested usage in maintainer documentation.

Instead of suggesting an inline usage of "sed", that would have to be
cut-and-pasted for every directory to be relocated, suggest a shell
function.

Make the example obviously an example, whereas previously it looked like
it might be literal text.

Thanks to Reuben Thomas <rrt@sc3d.org> for pointing out these issues.  See
http://lists.gnu.org/archive/html/bug-gnulib/2014-01/msg00039.html for
further context.

11 years agotests: fix export bug in previous patch
Paul Eggert [Wed, 8 Jan 2014 05:43:07 +0000 (21:43 -0800)]
tests: fix export bug in previous patch

Problem reported by Jim Meyering.
* tests/init.sh (re_shell): New var, which is exported instead of
re_shell_.

11 years agotests: simplify porting to Solaris 10 /bin/sh
Paul Eggert [Tue, 7 Jan 2014 19:46:27 +0000 (11:46 -0800)]
tests: simplify porting to Solaris 10 /bin/sh

Some test cases in 'grep' need a shell that groks '$(';
export re_shell_ for their benefit.  Problem reported for 'grep'
by Dagobert Michelsen in <http://bugs.gnu.org/16380>.
* tests/init.sh (re_shell_): Export if it's used.

11 years agoupdate from texinfo
Karl Berry [Tue, 7 Jan 2014 14:40:29 +0000 (06:40 -0800)]
update from texinfo

11 years agomd5, sha1, sha256, sha512: support older autoconf
Eric Blake [Mon, 6 Jan 2014 17:26:37 +0000 (10:26 -0700)]
md5, sha1, sha256, sha512: support older autoconf

On RHEL 6 (using autoconf 2.63), './gnulib-tool --test crypto/md5'
fails with this, ever since commit 3386f398:

executing aclocal -I glm4
glm4/gl-openssl.m4:11: error: m4_defn: undefined macro: _m4_divert_diversion
glm4/gl-openssl.m4:11: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: autom4te failed with exit status: 1

Autoconf 2.63b introduced some bug fixes to m4_divert*, including
the ability to use the diversion stack prior to calling m4_init;
and aclocal happens to be a use of autom4te where m4_init was
not invoked prior to the expansion of gl_CRYPTO_CHECK.  The fix
is to copy the trick used in newer autoconf - wrap the entire
execution of autom4te inside one more layer of diversion stack,
where _m4_divert_diversion being defined serves as a nice witness
of whether we are already wrapped.  This workaround has to live
in 00gnulib.m4 in order to come prior to any other m4 file that
might be included by virtue of gnulib.

Then, with my first attempt applied, I still got failures on
RHEL 5 (using autoconf 2.59); it turns out that without the
guaranteed-FIFO behavior of m4_wrap added in 2.62 and newer,
places that _do_ use m4_init got confused if our wrapper pops
its state in an m4_wrap that happens in LIFO order.  It took
some experimenting to find a formula that guarantees we undo
the wrap at the correct moment before the m4_init warning
message can chew us out about an unabalanced diversion stack.

* m4/00gnulib.m4 (m4_divert_push): Wrap diversion stack
on older autoconf.
Reported off-list by Pavel Hrdina.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoinclude_next: port to autoconf 2.63
Eric Blake [Mon, 6 Jan 2014 17:20:59 +0000 (10:20 -0700)]
include_next: port to autoconf 2.63

On RHEL 6.4 (using autoconf 2.63), './gnulib-tool --test math'
fails with the following, since commit 74540d44:
executing autoconf
configure:5693: error: possibly undefined macro: AS_VAR_COPY
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

Since we document that we support out-of-the-box use with autoconf
2.59 and later, the fix is to provide a fallback definition.

* m4/gnulib-common.m4 (AS_VAR_COPY): Define if missing.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: add a gnulib-local rule to keep non-ascii out of .texi files
Jim Meyering [Sat, 4 Jan 2014 18:50:45 +0000 (10:50 -0800)]
maint: add a gnulib-local rule to keep non-ascii out of .texi files

* cfg.mk (sc_keep_gnulib_texi_files_mostly_ascii): New rule,
so that "make sc_maint" will ding anyone who puts non-ascii
in any of gnulib's .texi files.