]> Savannah Git Hosting - gnulib.git/log
gnulib.git
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.

11 years agofreadable, fwritable, fwriting: declare with the "pure" attribute
Jim Meyering [Sat, 4 Jan 2014 01:17:27 +0000 (17:17 -0800)]
freadable, fwritable, fwriting: declare with the "pure" attribute

* lib/freadable.h (freadable): Declare with the "pure" attribute.
* lib/fwritable.h (fwritable): Likewise.
* lib/fwriting.h (fwriting): Likewise.
Suggested by Bruno Haible.

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 agodoc: use ASCII in .texi files where UTF-8 isn't needed
Paul Eggert [Fri, 3 Jan 2014 19:18:07 +0000 (11:18 -0800)]
doc: use ASCII in .texi files where UTF-8 isn't needed

* doc/posix-functions/crypt.texi, doc/posix-functions/encrypt.texi:
* doc/posix-functions/setkey.texi, doc/regex.texi:
Use ASCII input, not UTF-8.

11 years agofreading: declare with attribute "pure"
Jim Meyering [Fri, 22 Nov 2013 16:14:30 +0000 (08:14 -0800)]
freading: declare with attribute "pure"

* lib/freading.h (freading): Declare with the "pure" attribute.

11 years agomanywarnings: remove -Wmudflap
Jim Meyering [Fri, 3 Jan 2014 00:55:04 +0000 (16:55 -0800)]
manywarnings: remove -Wmudflap

* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Remove -Wmudflap, since
it is no longer supported in gcc-4.9-to-be.

11 years agoautoupdate
Karl Berry [Thu, 2 Jan 2014 13:27:21 +0000 (05:27 -0800)]
autoupdate

11 years agorelocatable-script: remove unused code
Paul Eggert [Thu, 2 Jan 2014 05:51:10 +0000 (21:51 -0800)]
relocatable-script: remove unused code

Problem reported by Reuben Thomas in:
http://lists.gnu.org/archive/html/bug-gnulib/2013-12/msg00117.html
* build-aux/relocatable.sh.in (func_tmpdir): Remove unused function.

11 years agomaint: fix public-submodule-commit to work with newer git
Jim Meyering [Thu, 2 Jan 2014 04:25:44 +0000 (20:25 -0800)]
maint: fix public-submodule-commit to work with newer git

* top/maint.mk (public-submodule-commit): Remove excess quoting.
We were over-quoting the test arguments, and somewhere prior to
version 1.8.5.2.229, git stopped removing those excess quotes,
which made the test fail, since the unexpanded strings would
always differ; using GIT_TRACE=1 confirmed that the git merge-base
command wasn't even being run.

11 years agoautoupdate
Karl Berry [Wed, 1 Jan 2014 13:19:01 +0000 (05:19 -0800)]
autoupdate

11 years agodoc: update main copyright year
Paul Eggert [Wed, 1 Jan 2014 07:28:25 +0000 (07:28 +0000)]
doc: update main copyright year

* doc/gnulib.texi: Update copyright date.

11 years agomaint: update copyright
Eric Blake [Wed, 1 Jan 2014 07:04:40 +0000 (00:04 -0700)]
maint: update copyright

I ran 'make update-copyright'.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoversion-etc: new year
Eric Blake [Wed, 1 Jan 2014 07:04:18 +0000 (00:04 -0700)]
version-etc: new year

* lib/version-etc.c (COPYRIGHT_YEAR): Bump to 2014.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoautoupdate
Karl Berry [Wed, 25 Dec 2013 14:30:36 +0000 (06:30 -0800)]
autoupdate

11 years agopassfd: give nicer error for recvfd at eof
Eric Blake [Tue, 24 Dec 2013 18:16:07 +0000 (11:16 -0700)]
passfd: give nicer error for recvfd at eof

I noticed that recvfd() fails with errno set to EACCES if the
other end of the socket has closed (such as if it calls _exit());
but "Permission denied" as the strerror() message doesn't read
very well.  This improves things to give the nicer message:
"Transport endpoint is not connected".

* lib/passfd.c (recvfd): Fake ENOTCONN if other end closes early.
* tests/test-passfd.c (main): Enhance test to cover this.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoautoupdate
Karl Berry [Wed, 18 Dec 2013 00:00:22 +0000 (16:00 -0800)]
autoupdate

11 years agogettimeofday: port recent C++ fix to Emacs
Paul Eggert [Tue, 17 Dec 2013 20:38:54 +0000 (12:38 -0800)]
gettimeofday: port recent C++ fix to Emacs

Without this further patch, Emacs won't build due to
the portcheck failing.  Also, this simplifies the patch a bit.
* lib/time.in.h (localtime, gmtime): Don't replace unless
GNULIB_GETTIMEOFDAY.  Treat them more like mktime.
* lib/time.in.h (localtime, gmtime):
* m4/gettimeofday.m4 (gl_GETTIMEOFDAY_REPLACE_LOCALTIME):
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS):
* modules/time (time.h):
Don't worry about about the possibility of localtime and gmtime
being absent; they're present in all C libraries we know about.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS):
Don't assume sys_time is present and has been initialized.
Instead, use a hack that should work even if it hasn't been.
Don't use a portcheck for gmtime or localtime; this supports
the hack.
* modules/time (time.h): Substitute GNULIB_GETTIMEOFDAY.

11 years agogettimeofday: fix C++ crosscompilation
John W. Eaton [Tue, 17 Dec 2013 19:04:37 +0000 (11:04 -0800)]
gettimeofday: fix C++ crosscompilation

Never replace gmtime and localtime by macros when compiling with
C++, this prevents <ctime> from being included.

* m4/gettimeofday.m4 (gl_GETTIMEOFDAY_REPLACE_LOCALTIME): Do not
define gmtime and localtime as preprocessor macros.  Instead
define some HAVE_GMTIME, HAVE_LOCALTIME, REPLACE_GMTIME, and
REPLACE_LOCALTIME substitutions.
* lib/time.in.h: Declare gmtime and localtime when needed.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): AC_SUBST HAVE_GMTIME,
HAVE_LOCALTIME, REPLACE_GMTIME, and REPLACE_LOCALTIME.
* modules/time: Depend on gettimeofday, and substitute the above
variables in time.h.

11 years agoqacl: port to Windows better
Paul Eggert [Tue, 17 Dec 2013 18:49:01 +0000 (10:49 -0800)]
qacl: port to Windows better

See Eli Zaretskii in
<http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00593.html>.
* lib/file-has-acl.c (acl_access_nontrivial):
Return -1 and set errno if !HAVE_ACL_FIRST_ENTRY &&
!HAVE_ACL_TO_SHORT_TEXT && !HAVE_ACL_FREE_TEXT.

11 years agomd5, sha1, sha256, sha512: fix compile error in c++ mode
Alexander V. Lukyanov [Thu, 12 Dec 2013 11:19:29 +0000 (11:19 +0000)]
md5, sha1, sha256, sha512: fix compile error in c++ mode

* lib/gl_openssl.h: Cast void pointers to a specific type.

11 years agoopen-tests: fix build failure with -Werror=old-style-declaration
Pádraig Brady [Mon, 9 Dec 2013 14:23:07 +0000 (14:23 +0000)]
open-tests: fix build failure with -Werror=old-style-declaration

* tests/test-open.h: Reorder the inline to avoid the issue.

11 years agomd5, sha1, sha256, sha512: fix link error with partial libcrypto
Pádraig Brady [Sun, 8 Dec 2013 23:19:29 +0000 (23:19 +0000)]
md5, sha1, sha256, sha512: fix link error with partial libcrypto

* m4/gl-openssl.m4 (gl_CRYPTO_CHECK): Only clear LIB_CRYPTO at
init time, so that if early checks find crypto routines,
while the last does not, then @LIB_CRYPTO@ is replaced correctly,
avoiding link failures.

11 years agomd5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT
Paul Eggert [Sun, 8 Dec 2013 07:43:23 +0000 (23:43 -0800)]
md5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT

This provides a new way to specify the default for
gl_CRYPTO_CHECK, one that is reflected in the --help message.
Emacs uses this, as well as the old way.
This attempts to implement a suggestion by Pádraig Brady in
<http://lists.gnu.org/archive/html/coreutils/2013-12/msg00080.html>.
* m4/gl-openssl.m4(gl_SET_CRYPTO_CHECK_DEFAULT): New macro.
(gl_CRYPTO_CHECK): Use it.  Mention the default in --help output.

11 years agomd5, sha1, sha256, sha512: add 'auto', and a way to specify default
Paul Eggert [Sun, 8 Dec 2013 01:00:44 +0000 (17:00 -0800)]
md5, sha1, sha256, sha512: add 'auto', and a way to specify default

* m4/gl-openssl.m4 (gl_CRYPTO_CHECK):
Add support for a new option, --with-openssl=auto, which causes
the library to be used if available and silently ignored if not.
Add support to allow allow configure.ac to specify its own
default, by setting with_openssl_default before invoking gl_INIT.

11 years agoautoupdate
Karl Berry [Fri, 6 Dec 2013 14:13:00 +0000 (06:13 -0800)]
autoupdate

11 years agobootstrap: warn about BSD toolchain snafu
Eric Blake [Wed, 4 Dec 2013 00:42:38 +0000 (17:42 -0700)]
bootstrap: warn about BSD toolchain snafu

With my help on IRC, Roman Bogorodskiy identified a bug where the
BSD autoconf wrapper script eats stdin[1], which in turn causes
autopoint from gettext 0.18.3 to fail to find AM_GNU_GETTEXT_VERSION
out of configure.ac[2], with this error:

./bootstrap: autopoint --force
autopoint: *** Missing version: please specify in configure.ac through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using

[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/184479
[2] http://git.sv.gnu.org/cgit/gettext.git/commit/gettext-tools/misc/autopoint.in?id=eea2dddde

The workaround would be painful to automate (because gettext
hardcodes the use of autom4te rather than honoring ${AUTOM4TE},
we'd have to create a temporary wrapper earlier in $PATH that
forwards to the real autom4te-x.yz - basically, repeating the
logic of what a wrapper script was supposed to do).  Further,
while the broken autom4te definitely hurts gettext 0.18.3, it
tends to have no issues with gettext 0.18.2; and since the
problem has been identified, it will not be long before fixed
autom4te and/or improved gettext that is not so stubborn
about using exactly 'autom4te' will be available.  Therefore,
for now we just warn about the situation.

* build-aux/bootstrap: Alert users to a broken autom4te.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoopen-tests: port to glibc with _FORTIFY_SOURCE and -O1
Paul Eggert [Thu, 5 Dec 2013 17:22:20 +0000 (09:22 -0800)]
open-tests: port to glibc with _FORTIFY_SOURCE and -O1

Problem reported by Daiki Ueno in:
http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00052.html
* tests/test-open.h (__always_inline):
New macro, if not already defined.
(test_open): Use it.

11 years agoinclude_next: minimize code duplication
Eric Blake [Wed, 4 Dec 2013 17:00:00 +0000 (10:00 -0700)]
include_next: minimize code duplication

I noticed some code duplication while trying to resolve a bug
originally reported by Rhys Ulerich:
https://lists.gnu.org/archive/html/bug-gnulib/2013-10/msg00049.html

* modules/include_next (Depends-on): Add absolute-header.
* m4/include_next.m4 (gl_NEXT_HEADERS_INTERNAL): Reuse
gl_ABSOLUTE_HEADER_ONE instead of open-coding it.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agogetcwd: fix compile error in configure check
Pádraig Brady [Wed, 4 Dec 2013 12:33:54 +0000 (12:33 +0000)]
getcwd: fix compile error in configure check

Introduced in commit ca369c8d, 2013-02-03

* m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Include errno.h

11 years agoregex: suppress core dumps from detection code
Pádraig Brady [Wed, 4 Dec 2013 12:11:40 +0000 (12:11 +0000)]
regex: suppress core dumps from detection code

* m4/regex.m4 (gl_REGEX): Catch the SIGABRT and convert to SIGTERM
to suppress core dumps that may well occur on glibc systems.
These core dumps might not be cleaned up automatically, or could
trigger some system core dump handling logic.

11 years agomd5, sha1, sha256, sha512: support mandating use of openssl
Pádraig Brady [Tue, 3 Dec 2013 13:53:03 +0000 (13:53 +0000)]
md5, sha1, sha256, sha512: support mandating use of openssl

* m4/gl-openssl.m4 (gl_CRYPTO_CHECK): Adjust the --with-openssl
description, to list the now 3 separate options.  Also don't
mention the default=no, since this is implicit given the option
is described as --with-openssl rather than --without-openssl.
If projects change the default they're free to document that.
With --with-openssl[=yes] we now error out when the specified
hash algorithm is not available in libcrypto.

11 years agotest-xvasprintf: disable some -Wformat-security diagnostics
Ivailo [Tue, 3 Dec 2013 14:20:22 +0000 (14:20 +0000)]
test-xvasprintf: disable some -Wformat-security diagnostics

* tests/test-xvasprintf.c: Disable -Wformat-zero-length and
-Wformat-nonliteral checks, as these edge cases are part of the test.

11 years agoregex: avoid glibc deadlock during configure
Eric Blake [Tue, 3 Dec 2013 17:34:13 +0000 (10:34 -0700)]
regex: avoid glibc deadlock during configure

glibc has a known bug where certain corruptions of the heap can
cause malloc to default to printing a debug message that includes
a backtrace, but the act of getting the backtrace uses dlopen
which in turn calls into malloc, causing a recursive lock ending
in deadlock.  Thus, when configure is probing for a known glibc
heap corruption bug, the overall configure would hang.

The solution suggested by glibc developers is to force malloc
to quit printing debug messages, which avoids recursive malloc.

* m4/regex.m4 (gl_REGEX): Avoid recursive malloc deadlock when
glibc bug 15078 in turn triggers bug 16159.
Reported by Michal Privoznik.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomd5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady [Sat, 30 Nov 2013 05:19:32 +0000 (05:19 +0000)]
md5, sha1, sha256, sha512: use openssl routines if available

--with-openssl the libcrypto md5, sha1, sha224, sha256, sha384, sha256
routines will be used if available, requiring apps to link @LIB_CRYPTO@

* lib/gl_openssl.h: Provide wrappers for specified openssl hash.
* m4/gl-openssl.m4 (gl_CRYPTO_CHECK): New function to lookup libcrypto
in the standard system location.
* m4/sha1.m4: Call gl_CRYPTO_CHECK() for SHA1.
* m4/sha256.m4: Likewise with SHA256.
* m4/sha512.m4: Likewise with SHA512.
* m4/md5.m4: Likewise with MD5.
* m4/gc.m4: Ensure @LIB_CRYPTO@ set for tests.
* lib/sha1.h: Include wrappers if HAVE_OPENSSL_SHA1.
* lib/sha256.h: Likewise with SHA256.
* lib/sha512.h: Likewise with SHA512.
* lib/md5.h: Likewise with MD5.
* lib/sha1.c: Exlude functionality if HAVE_OPENSSL_SHA1.
* lib/sha256.c: Likewise with SHA256.
* lib/sha512.c: Likewise with SHA512.
* lib/md5.c: Likewise with MD5.
* modules/crypto/sha1 (Link:): Add the new optional lib.
(Depends-on:): Add dependency on extern-inline.
* modules/crypto/sha256: Likewise.
* modules/crypto/sha512: Likewise.
* modules/crypto/md5: Likewise.
* modules/crypto/sha1-tests: Reference the lib here too.
* modules/crypto/md5-tests: Likewise.
* modules/crypto/gc-des-tests: Likewise.
* modules/crypto/gc-hmac-md5-tests: Likewise.
* modules/crypto/gc-hmac-sha1-tests: Likewise.
* modules/crypto/gc-hmac-sha256-tests: Likewise.
* modules/crypto/gc-hmac-sha512-tests: Likewise.
* modules/crypto/gc-md5-tests: Likewise.
* modules/crypto/gc-pbkdf2-sha1-tests: Likewise.
* modules/crypto/gc-sha1-tests: Likewise.
* modules/crypto/gc-tests: Likewise.
* modules/crypto/hmac-md5-tests: Likewise.
* modules/crypto/hmac-sha1-tests: Likewise.
* modules/crypto/hmac-sha256-tests: Likewise.
* modules/crypto/hmac-sha512-tests: Likewise.

11 years agobase64: fix recent compilation regression on some compilers
RV971 [Fri, 29 Nov 2013 15:35:33 +0000 (15:35 +0000)]
base64: fix recent compilation regression on some compilers

This fixes a compile failure with
  "Sun C 5.8 Patch 121015-05 2007/08/01"
which returns:
  "base64.c", line 99: void function cannot return value

* lib/base64.c: Don't return the void function,
instead split to a separate return statement.

11 years agoautoupdate
Karl Berry [Thu, 28 Nov 2013 22:39:26 +0000 (14:39 -0800)]
autoupdate

11 years agoautoupdate
Karl Berry [Thu, 28 Nov 2013 16:46:55 +0000 (08:46 -0800)]
autoupdate

11 years agoignore-value: revert previous code change
Paul Eggert [Thu, 28 Nov 2013 08:46:06 +0000 (00:46 -0800)]
ignore-value: revert previous code change

* lib/ignore-value.h (ignore_value): Use __extension__ and
__typeof__ only for GCC 3.4 and later.  Reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-11/msg00102.html>.
Change the comment to try to explain this better.

11 years agoselinux-h: improve stub types and add more stub functions
Pádraig Brady [Wed, 27 Nov 2013 21:53:19 +0000 (21:53 +0000)]
selinux-h: improve stub types and add more stub functions

* lib/se-selinux.in.h: Change security_context_t to a typedef
rather than a define, as it's a pointer type and so is better
as a typedef to avoid issues declaring multiple variables
with the comma operator.  Also add stub for string_to_security_class().
* lib/se-context.in.h: Add stub functions for
context_{type,range,role,user}_get().

11 years agoignore-value: prefer GCC version back through 2.0
Paul Eggert [Wed, 27 Nov 2013 22:52:17 +0000 (14:52 -0800)]
ignore-value: prefer GCC version back through 2.0

The code didn't match the comments, so I did a bit of software
archaeology.  GCC 2.0 seems to support __extension__ and
__typeof__, so fix both code and comments to use 2.0.
* lib/ignore-value.h (ignore_value): Use __extension__ and
__typeof__ for GCC 2.0 through 3.3, too.

11 years agopty: Activate the signature wrapper of forkpty.
Mats Erik Andersson [Wed, 27 Nov 2013 15:20:43 +0000 (16:20 +0100)]
pty: Activate the signature wrapper of forkpty.

The intended preprocessor macro HAVE_FORKPTY is
never defined, yet `lib/forkpty.c' depends on it.

* m4/pty.m4 (gl_FUNC_FORKPTY): At completed analysis,
apply AC_DEFINE_UNQUOTED to HAVE_FORKPTY with value
$HAVE_FORKPTY for access to wrapper in `lib/forkpty.c'.

11 years agomaint: fix gendocs.sh permissions
Eric Blake [Wed, 27 Nov 2013 15:41:15 +0000 (08:41 -0700)]
maint: fix gendocs.sh permissions

* build-aux/gendocs.sh: Restore executable bit.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoautoupdate
Karl Berry [Tue, 26 Nov 2013 13:18:07 +0000 (05:18 -0800)]
autoupdate

11 years agoquotearg: don't attempt to store 1 << 31 into an "int"
Jim Meyering [Tue, 19 Nov 2013 01:35:01 +0000 (17:35 -0800)]
quotearg: don't attempt to store 1 << 31 into an "int"

* lib/quotearg.c (quotearg_buffer_restyled): Building coreutils with
gcc's new -fsanitize=undefined and running its tests triggered some
new test failures due to undefined behavior, all with this diagnostic:
  lib/quotearg.c:629:62: runtime error: left shift of 1 by 31 places \
    cannot be represented in type int
Rather than shifting "1" left to form a mask, shift the bits right and
simply use "1" as the mask.
Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
11 years agoerror: depend on stdio
Paul Eggert [Thu, 21 Nov 2013 20:12:45 +0000 (12:12 -0800)]
error: depend on stdio

Problem reported by Nikos Mavrogiannopoulos in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-11/msg00084.html>
* modules/error (Depends-on): Add stdio.

11 years agodoc: Improve wording in relocatable-maint.texi.
Ben Pfaff [Tue, 19 Nov 2013 06:17:47 +0000 (22:17 -0800)]
doc: Improve wording in relocatable-maint.texi.

Reported by Reuben Thomas <rrt@sc3d.org>.

11 years agoFix indentation in previous patch.
Paul Eggert [Wed, 13 Nov 2013 15:55:37 +0000 (07:55 -0800)]
Fix indentation in previous patch.