10712 Commits
Author SHA1 Message Date
Paul Eggert 0474f8e6a8 dirent-safer: fix cloexec race
* lib/opendir-safer.c: Include fcntl.h instead of unistd-safer.h.
(opendir_safer): Use F_DUPFD_CLOEXEC.
* modules/dirent-safer (Depends-on): Add fcntl.  Remove unistd-safer.
* tests/test-dirent-safer.c: Do not include unistd-safer.h,
as it is no longer a prerequisite.  Use F_DUPFD_CLOEXEC
instead of dup_safer.
2017-08-12 11:36:11 -07:00
Paul Eggert b1f55699e4 fts: fix cloexec races
* lib/fts.c [!_LIBC]: Do not include dirent--.h, unistd--.h, cloexec.h.
(opendirat, diropen): Use O_CLOEXEC instead of set_cloexec_flag.
(fts_build): Use F_DUPD_CLOEXEC rinstad of set_cloexec_flag.
(fd_ring_check): Set cloexec flag on new file descriptors.
(fts_build, fd_ring_check): While we’re at it, make sure the
resulting file descriptor is not 0, 1, or 2, since that is easy.
* modules/fts (Depends-on): Remove cloexec, dirent-safer, dup,
fcntl-safer, unistd-safer.  Add fcntl.
2017-08-12 11:36:10 -07:00
Bruno Haible 3fae50e084 fts tests: Fix link error.
Reported by Tom G. Christensen in
https://lists.gnu.org/archive/html/bug-gnulib/2017-08/msg00078.html

* modules/fts-tests (Makefile.am): Link test-fts against LIBINTL.
2017-08-11 20:43:35 +02:00
Paul Eggert 8af35ddc83 fts: port recent changes to CentOS 6
Problem reported by Tom G. Christensen in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-08/msg00064.html
* lib/fts.c (fsword): New type.
(struct dev_type, filesystem_type): Use it.
* m4/fts.m4 (gl_FUNC_FTS_CORE): Check for __fsword_t.
Also, check for f_type only if fstatfs and sys/vfs.h work.
2017-08-10 06:07:03 -07:00
Paul Eggert 5befc656ff tempname: do not depend on secure_getenv
Excess dependency noted by Eli Zaretskii (Bug#28023#17).
* lib/tempname.c (__secure_getenv) [!_LIBC]: Remove; unused.
* modules/tempname (Depends-on): Remove secure_getenv.
2017-08-09 11:31:00 -07:00
Paul Eggert f88e6fc61e extensions: add _OPENBSD_SOURCE
* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Define _OPENBSD_SOURCE.
2017-08-08 11:07:29 -07:00
Reuben Thomas aae6a4227b manywarnings: Add support for C++.
* build-aux/g++-warning.spec: New file.
* m4/manywarnings-c++.m4: New file.
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C++)): New macro, that
redirects to manywarnings-c++.m4.
* modules/manywarnings (Files): Add m4/manywarnings-c++.m4.
2017-08-07 22:08:13 +02:00
Reuben Thomas ddbba9b3b8 manywarnings: Add support for C++.
* build-aux/g++-warning.spec: New file.
* m4/manywarnings-c++.m4: New file.
* modules/manywarnings (Files): Add it.
2017-08-07 17:32:18 +02:00
Paul Eggert d93aa1d57d 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
2017-08-06 23:24:39 -07:00
Bruno Haible 461664a6be 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).
2017-08-07 00:40:41 +02:00
Markus Armbruster 875d74694c git-version-gen: Fix for tags containing '-'
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:

    $ git-tag -m test v0.2-rc1
    $ build-aux/git-version-gen .tarball-version; echo
    build-aux/git-version-gen: WARNING: git rev-list failed
    UNKNOWN

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.
2017-08-06 09:02:25 -07:00
Paul Eggert 124b93cd24 valgrind-tests: use ls, and cache
* m4/valgrind-tests.m4: Test ls, not bash.
Problem reported by Reuben Thomas.
Also, cache the result so that it can be overridden.
2017-08-05 11:45:42 -07:00
Paul Eggert 9cfe2a3983 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.
2017-08-04 15:15:31 -07:00
Bruno Haible 7c6893ba0b Relax the license of some modules with no runtime code. 2017-08-04 11:57:20 +02:00
Paul Eggert ac2fdcad66 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
2017-08-03 16:28:54 -07:00
Paul Eggert 123f3ec733 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.
2017-08-02 11:07:06 -07:00
Paul Eggert dbeec5dcb3 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
2017-08-01 09:53:18 -07:00
Paul Eggert 324b77834b backupfile: new function to validate backup suffix
* lib/backupfile.c (set_simple_backup_suffix): New function.
Also, reject suffixes containing "/".
(backupfile_internal): Use it.
2017-07-30 17:08:08 -07:00
Paul Eggert b2a1529ee6 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.
2017-07-30 15:39:20 -07:00
Paul Eggert 1dc82a77fa 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.
2017-07-30 13:07:48 -07:00
Paul Eggert b6ac7d133c 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.
2017-07-30 11:08:43 -07:00
Paul Eggert d274292d1b renameat2: port better to older Solaris
* lib/renameat2.c (renameat2): Set ret_val properly on old Solaris.
Add goto to use a label, to silence picky compilers.
2017-07-30 11:08:43 -07:00
Paul Eggert f668e12f7f fts-tests: port to gcc -Wwrite-strings
* tests/test-fts.c (base, base_d): New static vars.
(argv, remove_tree, main): Use them.
2017-07-30 11:08:43 -07:00
Reuben Thomas c2dce527f7 relocatable-lib{,-lgpl}: improve documentation
* doc/relocatable-maint.texi: Document use of relocatable-lib{,-lgpl}.
Various other updates.
2017-07-30 13:54:08 +02:00
Reuben Thomas 1e8195cc6f relocatable-lib{,-lgpl}: add Valgrind suppressions
* lib/relocatable.valgrind: New file.
* modules/relocatable-lib (Files): Add relocatable.valgrind.
* modules/relocatable-lib-lgpl: Likewise.
2017-07-30 13:38:09 +02:00
Reuben Thomas c402c78aa6 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.
2017-07-30 13:16:11 +02:00
Bruno Haible 97d98703d4 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).
2017-07-30 12:39:01 +02:00
Paul Eggert f42d5af5ba faccessat: document AT_SYMLINK_NOFOLLOW issue
* doc/posix-functions/faccessat.texi: Modernize platform list.
Document AT_SYMLINK_NOFOLLOW limitation.
2017-07-27 18:02:51 -07:00
Paul Eggert a6749d9692 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).
2017-07-27 18:02:50 -07:00
Paul Eggert ec046e6685 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.
2017-07-27 12:10:18 -07:00
Erik Skultety e97dce1b84 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.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Message-Id: <0ad867fe1a1e0999e6666ef75398630f28e78e35.1501156018.git.eskultet@redhat.com>
2017-07-27 07:16:50 -05:00
Paul Eggert e20e345193 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.
2017-07-26 11:59:06 -07:00
Jim Meyering e8b8e6566e fprintftime: fix build-break caused by recent renaming
* lib/fprintftime.c: Include "nstrftime.c", not the now-renamed
"strftime.c".
* modules/fprintftime: Depend directly on nstrftime.
2017-07-26 11:33:49 -07:00
Paul Eggert f779576077 regex: work with GCC7's -Werror=implicit-fallthrough=
* lib/regex_internal.h (FALLTHROUGH): New macro.
* lib/regcomp.c (peek_token_bracket, parse_expression):
* lib/regexec.c (check_node_accept): Use it.
2017-07-26 09:13:07 -07:00
Paul Eggert e66b0b94e7 fts: simplify fts_build
* lib/fts.c (fts_build): Simplify, and be lazier about
calling leaf_optimization.
2017-07-25 00:27:47 -07:00
Paul Eggert b446700e06 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.
2017-07-25 00:27:47 -07:00
Paul Eggert 2649851d04 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.
2017-07-25 00:27:47 -07:00
Paul Eggert f7eb1b99e3 fts: introduce MIN_DIR_NLINK
* lib/fts.c (MIN_DIR_NLINK): New constant.
Use it instead of 2, whenever we are talking about link counts.
2017-07-25 00:27:46 -07:00
Paul Eggert 9c7ef4eef9 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.
2017-07-25 00:27:46 -07:00
Paul Eggert b7363b496c fts-tests: new module
* modules/fts-tests, tests/test-fts.c: New files.
2017-07-25 00:27:46 -07:00
Bruno Haible 06c7d3b65b Rename module 'strftime' to 'nstrftime'.
* NEWS: Mention the change.
2017-07-24 10:34:25 +02:00
Bruno Haible a742bdb3fd Rename module 'strftime' to 'nstrftime'.
* m4/nstrftime.m4: Renamed from m4/strftime.m4.
* lib/nstrftime.c: Renamed from lib/strftime.c.
* modules/nstrftime: Renamed from modules/strftime.
(Files, Makefile.am): Update.
* tests/test-nstrftime.c: Renamed from tests/test-strftime.c.
Fix comment.
* modules/nstrftime-tests: Renamed from modules/strftime-tests.
(Files, Makefile.am): Update.
* modules/strftime: New file, an obsolete indirection.
* doc/posix-functions/strftime.texi: Update reference.
* config/srclist.txt: Update info.
2017-07-24 01:23:42 +02:00
Tim Rühsen fe5d815487 malloca: Silence a warning from clang's memory sanitizer.
* lib/malloca.c (NO_SANITIZE_MEMORY): New macro.
(freea): Use it.
2017-07-21 23:18:21 +02:00
Bruno Haible 10ccf9015e host-cpu-c-abi: Fix detection of MIPS ABI.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): For MIPS, really test the
ABI, not the CPU instruction set.
2017-07-19 02:35:23 +02:00
Paul Eggert 276416a1ae 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.
2017-07-16 07:27:49 -07:00
Bruno Haible 7d71a30f14 threadlib: Support static linking.
* m4/threadlib.m4 (gl_THREADLIB_BODY): When static linking is in use,
set gl_cv_have_weak to 'no'.
2017-07-16 14:49:21 +02:00
Bruno Haible d6be976d4c 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).
2017-07-16 14:21:55 +02:00
John E. Malmberg 418a494eaa sys_socket: Add support for OpenVMS.
* lib/sys_socket.in.h [__VMS]: Define CMSG_SPACE, CMSG_LEN.
* doc/posix-headers/sys_socket.texi: Mention OpenVMS issues.
2017-07-15 23:11:44 +02:00
John E. Malmberg 4abebc63f3 sys_resource: Add support for OpenVMS.
* lib/resource.in.h [__VMS]: Define RUSAGE_SELF, RUSAGE_CHILDREN.
* doc/posix-headers/sys_resource.texi: Mention OpenVMS issues.
2017-07-15 17:30:13 +02:00
John E. Malmberg 9d63a16e7f math: Add support for OpenVMS.
* lib/math.in.h [__VMS]: Include <fp.h>.
* doc/posix-headers/math.texi: Mention OpenVMS issues.
2017-07-15 17:10:51 +02:00