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.
Bruno Haible [Sun, 21 May 2017 23:39:59 +0000 (01:39 +0200)]
gnulib-tool: Add options to create hard links.
* gnulib-tool (func_usage): Document options --hardlink,
--local-hardlink, --more-hardlinks.
(func_symlink): Renamed from func_ln.
(func_symlink_if_changed): Renamed from func_ln_if_changed.
(func_hardlink): New function.
(copymode, lcopymode): New variables.
(symbolic, lsymbolic): Remove variables.
(Options): Implement options --hardlink, --local-hardlink,
--more-hardlinks.
(func_should_link): Renamed from func_should_symlink. Set copyaction.
(func_add_file, func_update_file): Update invocation of
func_should_link. Invoke func_hardlink when appropriate.
(func_import): Update comments.
(func_create_testdir): Update invocation of func_should_link. Invoke
func_hardlink when appropriate.
Finally, invoke 'git update-index --refresh' to mitigate the effects of
the hard links on git.
Jim Meyering [Thu, 18 May 2017 15:36:27 +0000 (08:36 -0700)]
fallthrough: update for GCC 7/8
* lib/quotearg.c (FALLTHROUGH): New macro.
Use it whenever one switch case falls through into the next,
replacing "/* Fall through */" comments. This exposed one
instance of an unwarranted "fall through" comment: unwarranted
because it preceded a "goto" label not a case statement.
* lib/freopen-safer.c (freopen_safer): Likewise.
* lib/fts.c (leaf_optimization_applies): Likewise.
* lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise.
* tests/test-getopt_long.h (getopt_long_loop): Likewise.
* tests/test-tsearch.c (mangle_tree): Likewise. Also include
tests/macros.h for the definition.
* tests/test-argp.c (group1_parser): Likewise.
* tests/test-getopt.h (getopt_loop): Likewise.
Paul Eggert [Fri, 19 May 2017 22:35:24 +0000 (15:35 -0700)]
argp: fix pointer-subtraction bug
* lib/argp-help.c (hol_append): Don’t subtract pointers to
different arrays, as this can run afoul of -fcheck-pointer-bounds.
See the thread containing Bruno Haible’s report in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00171.html
Paul Eggert [Fri, 19 May 2017 15:52:38 +0000 (08:52 -0700)]
closeout: don’t close stderr when sanitizing
* NEWS: Document this.
* lib/closeout.c (__has_feature): New macro, if not already defined.
(SANITIZE_ADDRESS): New constant.
(close_stdout): Don’t close stderr if sanitizing addresses.
Paul Eggert [Tue, 16 May 2017 16:23:52 +0000 (09:23 -0700)]
manywarnings: update for GCC 7
* build-aux/gcc-warning.spec:
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Add GCC 7 warnings, notably -Wimplicit-fallthrough=5, which
requires a non-comment fallthrough attribute. This is a bit
cleaner than the comment versions.
* lib/strftime.c, lib/dfa.c, lib/fnmatch.c, lib/mbrtowc.c:
* lib/vasnprintf.c, tests/macros.h (FALLTHROUGH): New macro.
Use it whenever one switch case falls through into the next.
Bruno Haible [Sun, 14 May 2017 12:20:01 +0000 (14:20 +0200)]
windows-stat-inodes: New module.
* m4/windows-stat-inodes.m4: New file.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Set WINDOWS_STAT_INODES.
* modules/sys_types (Makefile.am): Substitute WINDOWS_STAT_INODES.
* lib/sys_types.in.h [WINDOWS_STAT_INODES]: Override dev_t and ino_t.
(_GL_WINDOWS_STAT_INODES): New macro.
* lib/stat-w32.c: Set _WIN32_WINNT. Include <string.h>, verify.h.
(GetFileInformationByHandleExFunc): New variable.
(initialize): Initialize it.
(_gl_fstat_by_handle) [_GL_WINDOWS_STAT_INODES]: Initialize st_dev and
st_ino appropriately.
* lib/stat.c (rpl_stat): Use the directory entry based approach only as
a fallback, because it does not provide st_dev and st_ino values.
* modules/fstat (Depends-on): Add 'verify'.
* modules/windows-stat-inodes: New file.
* doc/windows-stat-inodes.texi: New file.
* doc/gnulib.texi: Include it.
* doc/posix-headers/sys_stat.texi: Mention the new module.
Bruno Haible [Sun, 14 May 2017 15:37:31 +0000 (17:37 +0200)]
stat-time tests: Workaround for native Windows.
* tests/test-stat-time.c: Include <stdio.h>, <time.h>.
(filename_stamp1, filename_testfile, filename_stamp2, filename_stamp3):
New variables.
(initialize_filenames): New function.
(main): Invoke it.
(cleanup, prepare_test): Update.
Bruno Haible [Sat, 13 May 2017 01:03:07 +0000 (03:03 +0200)]
largefile: Improve and document.
* m4/largefile.m4 (gl_LARGEFILE): Set WINDOWS_64_BIT_ST_SIZE to 0 if
the mingw headers already define 'stat' appropriately.
* modules/largefile (Description): Clarify.
* doc/largefile.texi: New file.
* doc/gnulib.texi: Include it.
* doc/posix-headers/sys_types.texi: Update.
Bruno Haible [Sat, 13 May 2017 00:51:05 +0000 (02:51 +0200)]
windows-stat-timespec: New module.
* modules/windows-stat-timespec: New file.
* m4/windows-stat-timespec.m4: New file.
* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Set WINDOWS_STAT_TIMESPEC.
* modules/sys_stat (Makefile.am): Substitute WINDOWS_STAT_TIMESPEC.
* lib/sys_stat.in.h (struct stat) [WINDOWS_STAT_TIMESPEC]: Declare with
fields st_atim, st_mtim, st_ctim.
(st_atime, st_mtime, st_ctime): Define as macros.
(_GL_WINDOWS_STAT_TIMESPEC): New macro.
* lib/stat-w32.h (_gl_convert_FILETIME_to_timespec)
[_GL_WINDOWS_STAT_TIMESPEC]: New declaration.
* lib/stat-w32.c (_gl_convert_FILETIME_to_timespec)
[_GL_WINDOWS_STAT_TIMESPEC]: New function.
(_gl_convert_FILETIME_to_POSIX): Adjust coding style.
(_gl_fstat_by_handle): If _GL_WINDOWS_STAT_TIMESPEC, convert the
FILETIME to 'struct timespec', not 'time_t'.
* lib/stat.c (rpl_stat): If _GL_WINDOWS_STAT_TIMESPEC, convert the
FILETIME to 'struct timespec', not 'time_t'.
* lib/stat-time.h (STAT_TIMESPEC): Define also if
_GL_WINDOWS_STAT_TIMESPEC.
* doc/windows-stat-timespec.texi: New file.
* doc/gnulib.texi: Include it.