Paul Eggert [Mon, 7 Aug 2017 06:24:10 +0000 (23:24 -0700)]
git-version-gen: another fix for tags with "-"
* build-aux/git-version-gen: Improve fix for tags containing "-".
Suggested by Markus Armbruster in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-08/msg00034.html
Bruno Haible [Sun, 6 Aug 2017 22:40:41 +0000 (00:40 +0200)]
warnings, manywarnings: Add support for multiple languages, not just C.
* warnings.m4 (gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL): Renamed from
gl_UNKNOWN_WARNINGS_ARE_ERRORS.
(gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)): New macro.
(gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)): New macro.
(gl_UNKNOWN_WARNINGS_ARE_ERRORS): Dispatch to
gl_UNKNOWN_WARNINGS_ARE_ERRORS(_AC_LANG).
(gl_WARN_ADD): Require the gl_UNKNOWN_WARNINGS_ARE_ERRORS specialization
of the current language. If C++ is the current language, modify
WARN_CXXFLAGS instead of WARN_CFLAGS.
* manywarnings.m4 (gl_MANYWARN_ALL_GCC(C)): New macro, extracted from
gl_MANYWARN_ALL_GCC.
(gl_MANYWARN_ALL_GCC): Dispatch to gl_MANYWARN_ALL_GCC(_AC_LANG).
Really old versions of git-describe (before v1.5.0, Feb 2007) don't
have the number of commits in their long format output, i.e. where
modern 'git describe --abbrev=4 --match="v*"' prints
"v0.1-1494-g124b9", they print "v0.1-1494-g124b9". git-version-gen
recognizes both patterns, and normalizes the old format to the new
one.
Unfortunately, this normalization code gets confused when the tag
contains '-'. Reproducer:
We take exact tag "v0.2-rc1" for the old format, extract the presumed
tag "v0.2" from it, then run "git rev-list v0.2..HEAD" to count
commits since tha tag. Fails, because tag "v0.2" does not exist.
* git-version-gen: We could perhaps drop support for versions from more
than a decade ago. But tightening the pattern match is easy enough,
so do that. Still breaks when you use version tags ending in something
matching -g????, but you arguably get what you deserve then.
Paul Eggert [Fri, 4 Aug 2017 22:14:59 +0000 (15:14 -0700)]
manywarnings: port to 64-bit GCC builds of Emacs
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Compute max safe
object size rather than hardwiring 2147483647. This is needed to
build GNU Emacs, which has one conditional (and used
only-in-theory) call to malloc with a literal greater than 2147483647.
Paul Eggert [Thu, 3 Aug 2017 23:28:18 +0000 (16:28 -0700)]
renameat2: port to RHEL 7 + NFS
* lib/renameat2.c (renameat2) [SYS_renameat2]:
Port to RHEL 7 + NFS. Problem reported by Ted Zlatanov in:
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00082.html
Paul Eggert [Wed, 2 Aug 2017 18:06:33 +0000 (11:06 -0700)]
renameat2: port to non-renameat platforms
Problem reported for MSVC-2015 by Gisle Vanem in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-08/msg00001.html
* lib/renameat2.c [!HAVE_RENAMEAT]: Include <sys/stat.h> here too.
(renameat2) [!HAVE_RENAMEAT]: Fix typo in arg passing.
Paul Eggert [Tue, 1 Aug 2017 16:52:40 +0000 (09:52 -0700)]
manywarnings: port to 32-bit GCC bug
Problem reported by Pino Toscano in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00150.html
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Use 2**31 - 1,
not 2**63 - 1, to work around the following GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81650
Paul Eggert [Sun, 30 Jul 2017 22:38:56 +0000 (15:38 -0700)]
canonicalize: fix EOVERFLOW commentary
Problem reported by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00147.html
* lib/canonicalize.c (canonicalize_filename_mode):
* lib/canonicalize-lgpl.c (__realpath): Fix comments.
Paul Eggert [Sun, 30 Jul 2017 20:06:41 +0000 (13:06 -0700)]
Don't interpret EOVERFLOW to mean nonexistence
* lib/fts.c (fts_stat): If lstat fails, report its errno, which
may be EOVERFLOW; this is likely more useful than reporting the
stat errno.
* lib/glob.c (link_stat): Rename from link_exists2_p and
return -1/0 instead of 0/1. Caller changed.
* lib/glob.c (link_exists_p):
* lib/renameat2.c (rename_noreplace, renameat2):
* lib/tempname.c (try_nocreate):
If errno == EOVERFLOW then the directory entry exists, so do not
act as if it does not exist.
Paul Eggert [Sun, 30 Jul 2017 17:53:32 +0000 (10:53 -0700)]
backup-rename: new module
It is like backupfile, except it avoids some race conditions,
and it does not output to stderr or exit.
* MODULES.html.sh: Add backup-rename.
* lib/backup-find.c, lib/backup-internal.h, lib/backup-rename.c:
* modules/backup-rename: New files.
* lib/backupfile.c: Turn this into an internals file, which
contains code common to backupfile and backup_rename. Do not
include argmatch.h or xalloc.h: include xalloc-oversized.h.
Include renameat2.h and fcntl.h.
(BACKUP_NOMEM): New constant.
(numbered_backup): New args BASE_OFFSET and *DIRPP. Do not exit
on memory exhaustion; just return BACKUP_NOMEM. Caller changed.
(backupfile_internal): Rename from find_backup_file_name.
Support new arg RENAME.
(backup_args, backup_types, get_version, xget_version):
Move to lib/backup-find.c.
* lib/backupfile.h (backup_file_rename): New decl.
* modules/backupfile (Files): Add lib/backup-internal.h,
lib/backup-find.c.
(Depends-on): Add dirfd, fcntl, renameat2.
(lib_SOURCES): Add backup-find.c.
Reuben Thomas [Sun, 30 Jul 2017 11:16:11 +0000 (13:16 +0200)]
relocatable: Make the license on the sources the GPL.
* lib/relocatable.h, lib/relocatable.c: Change the copyright notice from
LGPL, which was a special case so that the relocatable source files
could be used without gnulib-tool, to GPL. They can still be used under
the LGPL, using the --lgpl option to gnulib-tool.
Bruno Haible [Sun, 30 Jul 2017 10:39:01 +0000 (12:39 +0200)]
host-cpu-c-abi: Detect ILP32 ABI on IA-64 HP-UX.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Distinguish ia64-ilp32
from ia64. For arm64, test only __aarch64__, as __ARM_64BIT_STATE and
__ARM_PCS_AAPCS64 are not reliable indicators: they are not defined on
Ubuntu 14.04 (gcc 4.8.4) and Debian 8 (gcc 4.9.2).
Paul Eggert [Thu, 27 Jul 2017 23:36:03 +0000 (16:36 -0700)]
renameat2: port to Solaris 10
* lib/renameat2.c (rename_noreplace): Use lstat, not faccessat
with AT_SYMLINK_NOFOLLOW (which is not portable).
(renameat): Undef before using, to avoid endless recursion when
the replacement renameat calls renameat2 which calls the
replacement renameat.
(renameat2): Use lstatat, not faccessat with AT_SYMLINK_NOFOLLOW.
* modules/renameat2 (Depends-on): Remove faccessat.
* modules/renameat-tests (test_renameat_LDADD):
* modules/renameat2-tests (test_renameat2_LDADD):
Remove $(LIB_EACCESS).
Paul Eggert [Thu, 27 Jul 2017 19:08:39 +0000 (12:08 -0700)]
renameat2: new module
Although the Linux syscall renameat2 is not in glibc (yet?), it is
useful to have access to its RENAME_NOREPLACE flag.
* MODULES.html.sh (func_all_modules): Add renameat2.
* lib/renameat2.c, lib/renameat2.h, modules/renameat2:
* modules/renameat2-tests, tests/test-renameat2.c: New files.
* lib/renameat.c (renameat): Move most of the implementation
to renameat2, and just call renameat2.
* modules/renameat (Files): Remove lib/at-func2.c.
(Depends-on): Depend only on renameat2.
(Include): Remove <fcntl.h>.
* modules/renameat-tests (test_renameat_LDADD): Add $(LIB_EACCESS),
since renameat (via renameat2) might use faccessat.
Erik Skultety [Thu, 27 Jul 2017 11:47:23 +0000 (13:47 +0200)]
vc-list-files: Adjust the script to support git worktrees
Git's worktree feature creates a ".git" which refers to references from
the original (main) repository. This makes vc-list-files to fail for
worktrees since it checks for both file's existence and the file being a
directory. Checking for existence should be okay in this case, since the
script doesn't touch anything within ".git" directly. Instead, it
invokes git commands, which work from within a worktree nicely.
Paul Eggert [Wed, 26 Jul 2017 18:57:37 +0000 (11:57 -0700)]
maint: bring MODULES.html.sh up to date
Somehow a few months ago we stopped updating MODULES.html.sh.
I don’t recall explicitly deciding this, so I updated it now.
Alternatively I suppose we could remove it.
* MODULES.html.sh: Add builtin-expect, c99, ctime, explicit_bzero,
localtime, localtime-buffer, noreturn, nstrftime, strftime-fixes,
truncate, utime, utime-h, windows-stat-inodes,
windows-stat-override, windows-stat-timespec, year2038. Sort.
Paul Eggert [Tue, 25 Jul 2017 06:54:00 +0000 (23:54 -0700)]
fts: three levels of leaf optimization
* lib/fts.c (enum leaf_optimization): New type with three values.
(S_MAGIC_AFS): New macro. Sort them.
(leaf_optimization): Rename from leaf_optimization_applies, and
return enum leaf_optimization instead of bool. All uses changed.
Add cases for unknown type and for AFS.
(fts_build): Don’t rely on link counts if NO_LEAF_OPTIMIZATION.
Paul Eggert [Tue, 25 Jul 2017 06:44:05 +0000 (23:44 -0700)]
fts: cache dirent_inode_sort_may_be_useful too
* lib/fts.c (struct dev_type): New struct.
(DEV_TYPE_HT_INITIAL_SIZE): New constant.
(dev_type_hash, dev_type_compare, filesystem_type): New functions.
(dirent_inode_sort_may_be_useful, leaf_optimization_applies):
Now takes FTSENT const *, not int. All uses changed. Use
filesystem_type to cache.
(link_count_optimize_ok): Remove. Caller changed to use
leaf_optimization_applies, which now uses shared cache.
Paul Eggert [Tue, 25 Jul 2017 06:21:57 +0000 (23:21 -0700)]
fts: nlink_t signedness fixups
* lib/fts.c (fts_open): Set rootparent n_dirs_remaining to -1
so that root need not be a special case later.
(fts_read): Remove now-redundant test for fts_level.
Do not assume that nlink_t is signed.
(fts_build): Remove useless decrement of nlinks.
(fts_stat): Avoid unlikely signed integer overflow later, if
nlink_t is signed.
Paul Eggert [Sun, 16 Jul 2017 14:26:16 +0000 (07:26 -0700)]
explicit_bzero: new module
The explicit_bzero function has been added to glibc.
This module is intended to supports its use in GNU programs.
* doc/glibc-functions/explicit_bzero.texi, lib/explicit_bzero.c:
* m4/explicit_bzero.m4, modules/explicit_bzero:
New files.
* doc/gnulib.texi (Glibc string.h): Link to new doc.
* lib/string.in.h (explicit_bzero): Declare.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Add defaults for it.
* modules/string (string.h): Substitute its vars.
Bruno Haible [Sun, 16 Jul 2017 12:21:55 +0000 (14:21 +0200)]
unicase/locale-language: Fix link dependencies.
* modules/unicase/locale-language (Link): New section.
* modules/unicase/locale-language-tests (Makefile.am): Link
test-locale-language program with $(LIBTHREAD).
Bruno Haible [Sat, 15 Jul 2017 15:00:37 +0000 (17:00 +0200)]
getdtablesize: Add minimal support for OpenVMS.
Reported by John E. Malmberg <wb8tyw@qsl.net>.
* modules/getdtablesize (Description): Fix.
* lib/getdtablesize.c: Fix comment.
* m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Don't replace the
getdtablesize() function, even though the test fails.
* doc/glibc-functions/getdtablesize.texi: Reference SUSv2. Describe
limitation on OpenVMS.
Paul Eggert [Mon, 10 Jul 2017 18:56:48 +0000 (11:56 -0700)]
getlogin: don’t assume one name per uid
Problem reported by Wolfgang F. Muthmann (Bug#27640).
* modules/getlogin-tests (Files): Add tests/test-getlogin_r.c.
(ttyname): Remove test.
* modules/getlogin_r-tests (ttyname): Remove test.
* tests/test-getlogin.c: Replace this near-clone of test-getlogin_r.c
with ‘#define TEST_LOGIN’ followed by ‘#include "test-getlogin_r.c"’.
* tests/test-getlogin_r.c: If TEST_GETLOGIN is defined, test
getlogin rather than getlogin_r. This avoids code duplication.
(main): Use isatty and fstat rather than ttyname and stat.
Use getpwnam instead of getpwuid, to be portable to test platforms
that have multiple login names for the same uid.
Paul Eggert [Fri, 7 Jul 2017 21:10:20 +0000 (14:10 -0700)]
vasnprintf: port to macOS 10.13
Problem reported by comex in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00056.html
* lib/vasnprintf.c (VASNPRINTF): Don’t use %n on macOS.
Paul Eggert [Thu, 6 Jul 2017 21:08:24 +0000 (14:08 -0700)]
parse-datetime: fix uninit var bug
Reported by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00038.html
* lib/parse-datetime.y (parse_datetime2): Do not use
uninitialized.
Paul Eggert [Sun, 25 Jun 2017 06:48:31 +0000 (23:48 -0700)]
xalloc-oversized: port to icc
* lib/xalloc-oversized.h (xalloc_oversized): Do not use
__builtin_mul_overflow if ICC is defined, as this results in
"undefined reference to `__builtin_mul_overflow'" with icc 17.0.2 20170213.
Bruno Haible [Mon, 19 Jun 2017 14:54:55 +0000 (16:54 +0200)]
sched: Fix compilation failure on OpenVMS.
* m4/sched_h.m4 (gl_SCHED_H): Require AC_CANONICAL_HOST. On OpenVMS,
test whether <pthread.h> exists and defines struct sched_param.
* lib/sched.in.h: On OpenVMS, include <pthread.h>.
Paul Eggert [Sat, 17 Jun 2017 19:16:27 +0000 (12:16 -0700)]
diffseq: port to GCC 7 with --enable-gcc-warnings
* lib/diffseq.h (diag): Use an if, not an ifdef, for most of the
heuristic check. This way, GCC 7 with --enable-gcc-warnings does
not complain about big_snake being defined but not used.
Bruno Haible [Thu, 15 Jun 2017 20:58:28 +0000 (22:58 +0200)]
gettext-h: Update theoretical condition for use of variable size arrays.
Reported by Paul Eggert.
* lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Extend comment
to include the theoretical condition for availability of variable size
arrays, if we could trust the value of __STDC_VERSION__.
Paul Eggert [Sun, 11 Jun 2017 22:53:09 +0000 (15:53 -0700)]
getopt-posix: port to glibc 2.25.90
Problem reported by Daniel P. Berrange in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00003.html
* lib/getopt-pfx-core.h (_GETOPT_CORE_H):
* lib/getopt-pfx-ext.h (_GETOPT_EXT_H):
#undef if __GETOPT_PREFIX is defined.
Jim Meyering [Sat, 10 Jun 2017 17:11:47 +0000 (10:11 -0700)]
maint: update to work with GCC7's -Werror=implicit-fallthrough=
* lib/savewd.c (FALLTHROUGH): Define.
(savewd_save, savewd_restore): Use this, rather than a comment,
whenever one switch case falls through into the next.
Bruno Haible [Wed, 7 Jun 2017 13:23:38 +0000 (15:23 +0200)]
canonicalize-lgpl: Avoid conflict with gnulib 'getcwd' module on VMS.
Reported by John E. Malmberg <wb8tyw@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00029.html>.
* lib/canonicalize-lgpl.c (__getcwd): On VMS, when using gnulib's getcwd
override, pass 2 arguments to getcwd, not 3.
Paul Eggert [Sun, 4 Jun 2017 21:25:43 +0000 (14:25 -0700)]
same-inode: port better to VMS 8.2 and later
Problem reported by John E. Malmberg in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00005.html
* lib/same-inode.h (SAME_INODE) [__VMS && 80200000 <= __CRTL_VER]:
Use the usual POSIX definition.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Define _USE_STD_STAT.
Paul Eggert [Thu, 1 Jun 2017 21:08:00 +0000 (14:08 -0700)]
error: fix POSIX violation for va_end
Problem reported by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00001.html
* lib/error.c (error_tail): Do not call va_end here.
(error, error_at_line): Call it here instead.
Jim Meyering [Fri, 26 May 2017 04:25:37 +0000 (21:25 -0700)]
quotearg: fix compilation failure due to FALLTHROUGH misuse
* lib/quotearg.c (quotearg_buffer_restyled): Revert one FALLTHROUGH
macro back to /* fall through */ comment. The macro can apply only
to a following case statement. Reported by Assaf Gordon.
Paul Eggert [Thu, 25 May 2017 07:08:09 +0000 (00:08 -0700)]
intprops: port to recent icc
Port to icc (ICC) 17.0.4 20170411, which defines __GNUC__ to be 5
but does not support __builtin_add_overflow etc.
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW) [__ICC]:
Define to 0.