Paul Eggert [Tue, 20 Feb 2018 17:06:51 +0000 (09:06 -0800)]
utimecmp: new function utimecmpat
* lib/utimecmp.c: Include fcntl.h, sys/stat.h and dirname.h.
Do not include utimens.h.
(utimecmpat): New function, generalizing utimecmp.
(utimecmp): Now a thin layer around utimecmpat.
* modules/utimecmp (Depends-on): Depend on dirname-lgpl, fstatat,
utimensat instead of on lstat and utimens.
Paul Eggert [Tue, 20 Feb 2018 17:05:48 +0000 (09:05 -0800)]
same: new function same_nameat
* lib/same.c: Include fcntl.h.
* lib/same.c (same_nameat): New function, generalizing same_name.
(same_name): Now a thin layer around same_nameat.
* m4/same.m4 (gl_SAME): Check for fpathconf, not pathconf.
* modules/same (Depends-on): Depend on fstatat, openat.
Bruno Haible [Sat, 17 Feb 2018 08:55:43 +0000 (09:55 +0100)]
thread: Fix compilation error on IRIX.
* lib/glthread/thread.h: Include <unistd.h>. Include <signal.h> when
needed; include it outside the C++ extern "C" {} block.
* doc/posix-headers/pthread.texi: Mention the problem with
pthread_atfork on IRIX.
Bruno Haible [Sun, 4 Feb 2018 09:42:45 +0000 (10:42 +0100)]
signal-h, monetary, strings: Fix build failure in some cases.
Reported by Tim Rühsen <tim.ruehsen@gmx.de>.
* modules/signal-h (Makefile.am): In the GNULIB_* substitutions, use '/'
as delimiter in sed command, not '|'.
* modules/monetary (Makefile.am): Likewise.
* modules/strings (Makefile.am): Likewise.
Bruno Haible [Sat, 3 Feb 2018 13:05:45 +0000 (14:05 +0100)]
stdlib: Fix compilation error on OpenIndiana.
* lib/stdlib.in.h: Before including <sys/loadavg.h>, include
<sys/time.h>.
* m4/stdlib_h.m4 (gl_STDLIB_H): Likewise.
* m4/getloadavg.m4 (gl_GETLOADAVG): Likewise.
Bruno Haible [Sat, 3 Feb 2018 11:50:17 +0000 (12:50 +0100)]
host-cpu-c-abi: Avoid use of 'grep -E' on OpenIndiana.
* m4/asm-underscore.m4 (gl_ASM_SYMBOL_PREFIX): Require AC_PROG_EGREP,
and use $EGREP instead of 'grep -E'.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Use 'grep' instead of
'grep -E'.
Bruno Haible [Fri, 2 Feb 2018 18:32:02 +0000 (19:32 +0100)]
malloca, xmalloca: Make multithread-safe.
Reported by Florian Weimer <fweimer@redhat.com>.
Implements an idea by Ondřej Bílka <neleai@seznam.cz>.
* lib/malloca.h (malloca): In the stack allocation case, return a
pointer that is a multiple of 2 * sa_alignment_max.
(sa_increment): Remove enum item.
* lib/xmalloca.h (xmalloca): In the stack allocation case, return
a pointer that is a multiple of 2 * sa_alignment_max.
* lib/malloca.c (NO_SANITIZE_MEMORY): Remove macro.
(MAGIC_NUMBER, MAGIC_SIZE, preliminary_header, HEADER_SIZE, header,
HASH_TABLE_SIZE, mmalloca_results): Remove.
(small_t): New type.
(mmalloca, free): Rewritten.
* lib/malloca.valgrind: Remove file.
* modules/malloca (Files): Remove it.
(Depends-on): Remove verify.
Bruno Haible [Wed, 31 Jan 2018 08:04:52 +0000 (09:04 +0100)]
environ: Fix link error on 64-bit Cygwin.
* lib/unistd.in.h (environ): On Cygwin, redeclare with the
__declspec(dllimport) attribute.
* doc/posix-functions/environ.texi: Mention the Cygwin problem.
Bruno Haible [Sat, 27 Jan 2018 07:52:31 +0000 (08:52 +0100)]
getsockname tests: More tests.
* tests/test-getsockname.c (open_server_socket): New function, mostly
copied from test-poll.c.
(main): Check that getsockname fills in addr.
* modules/getsockname-tests (Depends-on): Add the necessary
dependencies.
(test_getsockname_LDADD): Link with $(INET_PTON_LIB).
Paul Eggert [Tue, 23 Jan 2018 08:42:04 +0000 (00:42 -0800)]
Merge strftime.c changes from glibc
This incorporates:
2017-11-14 [BZ #10871] Implement alternative month names
2017-11-14 [BZ #10871] Abbreviated alternative month names (%Ob)
2017-06-20 Use locale_t, not __locale_t, throughout glibc
* lib/nstrftime.c (ABALTMON_1) [!COMPILE_WIDE]: New macro.
(LOCALE_PARAM) [_LIBC && USE_IN_EXTENDED_LOCALE_MODEL]:
Use locale_t, not __locale_t.
(a_altmonth, f_altmonth, aam_len) [_NL_CURRENT]: New macros.
(__strftime_internal): Add support for alternate months.
Paul Eggert [Sun, 14 Jan 2018 21:27:20 +0000 (13:27 -0800)]
filenamecat: make base a suffix of result
* lib/filenamecat-lgpl.c (longest_relative_suffix): Remove.
(mfile_name_concat): Always make BASE a suffix of the result, as
cp expects this. To implement this, separate with '.' instead of
'/' in some rare cases. Clarify spec to say ./BASE not BASE.
* tests/test-filenamecat.c (main): Adjust tests to match
current behavior. Check that BASE_IN_RESULT points to
a copy of BASE and is a suffix of the resultk, and that DIR
is a prefix of the result that is no longer than the prefix
indicated by BASE_IN_RESULT.
To determine the file list that need the marker, I used the command:
for f in `find . -type f | grep -v '^\./\.git/' | grep -v '^\./tests/'`; do
if iconv -f ASCII -t ASCII < $f > /dev/null 2>&1 ; then : ; else
if iconv -f UTF-8 -t UTF-8 < $f > /dev/null 2>&1 ; then
if grep 'The GNU C Library is' $f > /dev/null; then :; else
if grep 'coding: utf-8' $f > /dev/null; then :; else
echo $f
fi
fi
fi
fi
done | LC_ALL=C sort
Paul Eggert [Wed, 3 Jan 2018 21:29:49 +0000 (13:29 -0800)]
test-framework-sh: ‘ps -ef’, not ‘ps ef’
* tests/init.sh (rand_bytes_): Put ‘-’ before new-style ps options.
Suggested by Bob Proulx (Bug#29968).
* build-aux/mktempd (rand_bytes): Make it like tests/init.sh.
Eric Blake [Tue, 2 Jan 2018 21:49:27 +0000 (15:49 -0600)]
stat-time: silence -Wunused-parameter regression
Commit 2c5d5587 causes warnings on non-Sun systems when compiled
under -Wunused-parameter; we've previously tweaked code in commit 81eb8486 to avoid such warnings. Prefer an attribute rather than
a cast to void (the attribute is always okay to apply; gcc
interprets it as 'may be unused', not 'must not be used', precisely
to cater to #if chains where determining whether or not the
parameter is used gets hairy).
* lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime):
Prefer attribute over cast-to-void.
(stat_time_normalize): Mark st as potentially unused.
Paul Eggert [Wed, 3 Jan 2018 03:05:05 +0000 (19:05 -0800)]
test-framework-sh: avoid netstat
Problem reported by Kristýna Streitová (Bug#29947).
* tests/init.sh (rand_bytes_): Stop using netstat, as it's
deprecated on SuSE and it's not that important anyway.
Jim Meyering [Tue, 2 Jan 2018 00:12:39 +0000 (16:12 -0800)]
update-copyright: add code to handle more special cases
After running "make update-copyright" this year, five files
required additional manual changes. Automate those adjustments
for next year.
* Makefile (_year_and_prev): Define.
(update-copyright): Add perl commands to induce this year's post-
update-copyright adjustments.
Paul Eggert [Mon, 1 Jan 2018 00:57:25 +0000 (00:57 +0000)]
version-etc: new year
* build-aux/gendocs.sh (version):
* doc/gendocs_template:
* doc/gendocs_template_min:
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR):
Update copyright dates by hand in templates and the like.
Paul Eggert [Tue, 19 Dec 2017 23:53:47 +0000 (15:53 -0800)]
regex: use re_malloc etc. consistently
Problem and original patch reported by Arnold Robbins in:
https://sourceware.org/ml/libc-alpha/2017-12/msg00241.html
* lib/regcomp.c (re_comp):
* lib/regexec.c (push_fail_stack, build_trtable, match_ctx_clean):
Use re_malloc/re_realloc/re_free instead of malloc/realloc/free.
Reuben Thomas [Mon, 11 Dec 2017 10:27:52 +0000 (10:27 +0000)]
doc: Improve explanation of supporting relocatable libraries.
* doc/relocatable-maint.texi (Supporting Relocation): Explain
properly how to build the relocatable module for
libraries. (Method and example code from Bruno Haible.)
Paul Eggert [Tue, 28 Nov 2017 22:30:25 +0000 (14:30 -0800)]
Port better to CentOS 5
Problems reported by Tom G. Christensen in:
https://lists.gnu.org/r/bug-gnulib/2017-11/msg00053.html
* doc/glibc-functions/strverscmp.texi (strverscmp):
Document strverscmp bug with glibc 2.9 and earlier.
* doc/posix-functions/tzset.texi (tzset):
Document that TZ with angle brackets is POSIX-2001 and later.
* tests/test-nstrftime.c: Include unistd.h.
(TZ_ANGLE_BRACKETS_SHOULD_WORK): New macro.
(TZ): Use it to skip tests with angle brackets in TZ,
for older systems.
Jim Meyering [Tue, 28 Nov 2017 15:52:47 +0000 (07:52 -0800)]
test-faccessat.c: correct BASE definition to avoid parallel test failure
* tests/test-faccessat.c (BASE): Define using this file's name, not
that of test-lstat.c. Using the latter caused this test to fail
sometimes when run concurrently with test-lstat.
Paul Eggert [Fri, 24 Nov 2017 08:29:04 +0000 (00:29 -0800)]
posixtm: remove PDS_LEADING_YEAR
This changes the API slightly, in a hopefully-innocuous way.
Without this change the code had undefined behavior when a
caller specified neither PDS_LEADING_YEAR nor PDS_TRAILING_YEAR.
Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/bug-gnulib/2017-11/msg00048.html
* NEWS: Mention this.
* lib/posixtm.c (posix_time_parse): Treat the absence of
PDS_TRAILING_YEAR as if PDS_LEADING_YEAR were present.
* lib/posixtm.h (PDS_LEADING_YEAR): Remove (actually, leave it
present, but define it as zero, for compatibility with existing
source code). All other PDS_* values moved up.
* tests/test-posixtm.c (LY): New macro.
(T): Use it. Do not expect a particular numeric encoding
for PDS_CENTURY etc.
Paul Eggert [Sun, 12 Nov 2017 06:33:38 +0000 (22:33 -0800)]
faccessat: port to macOS (Bug#29231)
macOS faccessat has the same bug that lstat does: if the file
name ends in '/' it ignores the trailing slash.
Problem reported for Emacs by Vincent Zhang.
* doc/posix-functions/faccessat.texi (faccessat): Document this.
* lib/faccessat.c (_GL_INCLUDING_UNISTD_H): Define and undef
around the initial includes. Include errno.h, string.h, sys/stat.h.
(orig_faccessat) [HAVE_FACCESSAT]: New function.
Include "unistd.h" after defining it.
(rpl_faccessat) [HAVE_FACCESSAT]: New implementation.
* lib/unistd.in.h (faccessat) [REPLACE_FACCESSAT]:
Handle in the usual way.
* m4/faccessat.m4 (gl_FUNC_FACCESSAT): Replace faccessat if
lstat dereferences symlinks, since faccessat is likely to
have the same problem.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Default REPLACE_ACCESSAT.
* modules/faccessat (Depends-on): Add fstatat.
Depend if REPLACE_FACCESSAT is 1, too.
(configure.ac): Link if REPLACE_FACCESSAT is 1.
* modules/faccessat-tests (Depends-on): Add symlink.
* modules/unistd (unistd.h): Substitute REPLACE_FACCESSAT.
* tests/test-faccessat.c (main): Test for the bug.