Paul Eggert [Thu, 19 Oct 2017 20:03:40 +0000 (13:03 -0700)]
quotearg: pacify compiler re unsigned
* lib/quotearg.c (quotearg_n_options):
Rewrite to avoid diagnostic from overly-picky compiler.
Problem reported by Sami Kerola in:
https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00060.html
Paul Eggert [Thu, 19 Oct 2017 19:39:45 +0000 (12:39 -0700)]
glob: fix heap buffer overflow
* lib/glob.c (glob): Fix off-by-one error introduced into
glibc in commit dd7d45e838a42b0ed470c44b55901ea98d0c2bab
dated 1997-10-29 20:33:40. Problem reported by Tim Rühsen in:
https://sourceware.org/bugzilla/show_bug.cgi?id=22320
Fix suggested by Bruno Haible.
Paul Eggert [Wed, 18 Oct 2017 17:19:35 +0000 (10:19 -0700)]
glob: pacify fuzzer for mempcpy
Problem reported by Tim Rühsen in:
https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00054.html
* lib/glob.c (glob): Do not pass NULL to mempcpy.
Bruno Haible [Thu, 12 Oct 2017 21:18:12 +0000 (23:18 +0200)]
doc: Update for Solaris 11.3.
* doc/**/*.texi: For bugs that exist in both Solaris 11.0 and 11.3,
mention Solaris 11.3.
* m4/log2.m4: Fix comments.
* m4/log2f.m4: Likewise.
* m4/printf.m4: Update comments.
* m4/rename.m4: Likewise.
* m4/strncat.m4: Likewise.
Bruno Haible [Mon, 9 Oct 2017 14:33:00 +0000 (16:33 +0200)]
getopt-posix: Fix build failure when using ac_cv_header_getopt_h=no.
Reported by Christian Ehrhardt <christian.ehrhardt@canonical.com>
and Daniel P. Berrange <berrange@redhat.com>.
* lib/unistd.in.h (getopt): Don't attempt to avoid namespace pollution
on glibc systems. The getopt-pfx-core.h file declares exactly what
unistd.h needs, nothing more.
Bruno Haible [Sat, 7 Oct 2017 12:07:41 +0000 (14:07 +0200)]
vma-iter: Fix truncated result on Linux (regression from 2017-09-26).
* lib/vma-iter.c (MIN_LEFTOVER): New macro.
(STACK_ALLOCATED_BUFFER_SIZE): Set to a minimal value if not needed.
(rof_open): On Linux, do multiple read() calls and make sure
MIN_LEFTOVER bytes are left when read() returns.
Bruno Haible [Fri, 6 Oct 2017 19:51:53 +0000 (21:51 +0200)]
getopt-posix: Clarify copyright header.
* lib/getopt.in.h: Don't state that gnulib is under LGPL.
* lib/getopt-pfx-core.h: Likewise.
* lib/getopt-pfx-ext.h: Likewise.
* lib/getopt-cdefs.in.h: Likewise.
Bruno Haible [Tue, 3 Oct 2017 20:01:42 +0000 (22:01 +0200)]
doc: warn about misuse of strncpy and wcsncpy.
* doc/posix-functions/strcpy.texi: Describe requirements on prior
memory allocation.
* doc/posix-functions/wcscpy.texi: Likewise.
* doc/posix-functions/strncpy.texi: Describe what this function is not
useful for.
* doc/posix-functions/wcsncpy.texi: Likewise.
Paul Eggert [Mon, 2 Oct 2017 03:35:53 +0000 (20:35 -0700)]
fsusage: remove SVR2 support
SVR2 was obsolete by 1986 and is no longer supported by anybody,
and its code was getting in the way of use of this module by
Emacs, which has its own ‘read’ function anyway.
* lib/fsusage.c: Do not include sys/filsys.h.
(get_fs_usage): Remove SVR2-specific code.
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE):
Do not test for sys/filsys.h or set STAT_READ_FILSYS.
* modules/fsusage (Depends-on): Do not depend on full-read.
Bruno Haible [Sat, 30 Sep 2017 16:16:03 +0000 (18:16 +0200)]
vma-iter: Make it work on 32-bit Solaris with module 'largefile'.
* modules/vma-iter: Don't test for sys/procfs.h, as this test would
fail when module 'largefile' is in use.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Don't test HAVE_SYS_PROCFS_H.
* lib/vma-iter.c: Undefine _FILE_OFFSET_BITS early.
Don't test HAVE_SYS_PROCFS_H.
Bruno Haible [Tue, 26 Sep 2017 17:48:39 +0000 (19:48 +0200)]
vma-iter: Improvements for Linux and BSD platforms.
- Add support for DragonFly BSD.
- Make it more reliable on Linux, GNU/kFreeBSD, FreeBSD, NetBSD.
* lib/vma-iter.c (struct rofile, rof_open, rof_peekchar, rof_close):
Read the entire file into memory in a single system call.
(vma_iterate): Update. Read from /proc on DragonFly BSD like on FreeBSD.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on DragonFly BSD.
Paul Eggert [Tue, 26 Sep 2017 01:11:25 +0000 (18:11 -0700)]
parse-datetime, posixtm: avoid uninit access
* lib/parse-datetime.y (parse_datetime2):
* lib/posixtm.c (posixtime):
Do not access uninitialized storage, even though the resulting
value is never used.
Bruno Haible [Mon, 25 Sep 2017 19:31:25 +0000 (21:31 +0200)]
vma-iter: Improvements for BSD platforms.
- Add support for GNU/kFreeBSD.
- Make it work on FreeBSD and NetBSD even when /proc is not mounted.
- Speed up on OpenBSD.
* lib/vma-iter.c (struct rofile, rof*): Define also on GNU/kFreeBSD.
(vma_iterate_bsd): New function.
(vma_iterate): Use it as fallback on FreeBSD and NetBSD. Use it as
first choice on OpenBSD. Treat GNU/kFreeBSD like Linux.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on GNU/kFreeBSD.
* modules/vma-iter (configure.ac): Require AC_C_INLINE.
Bruno Haible [Sat, 23 Sep 2017 10:22:17 +0000 (12:22 +0200)]
strfmon_l: New module.
* modules/strfmon_l: New file.
* lib/strfmon_l.c: New file.
* m4/strfmon_l.m4: New file.
* doc/posix-functions/strfmon_l.texi: Mention the new module.
* modules/strfmon_l-tests: New file.
* tests/test-strfmon_l.c: New file.
Bruno Haible [Sat, 23 Sep 2017 07:26:48 +0000 (09:26 +0200)]
monetary: New module.
* modules/monetary: New file.
* lib/monetary.in.h: New file.
* m4/monetary_h.m4: New file.
* doc/posix-headers/monetary.texi: Mention the new module.
* modules/monetary-tests: New file.
* tests/test-monetary.c: New file.
* modules/monetary-c++-tests: New file.
* tests/test-monetary-c++.cc: New file.
* modules/duplocale-tests (configure.ac): Use AC_CHECK_HEADERS_ONCE.
Paul Eggert [Fri, 22 Sep 2017 04:39:59 +0000 (21:39 -0700)]
mktime: port to OpenVMS
Problem reported by John E. Malmberg in:
https://lists.gnu.org/archive/html/bug-gnulib/2017-09/msg00100.html
* m4/mktime.m4 (TIME_T_IS_SIGNED): Default to 0.
Paul Eggert [Sun, 17 Sep 2017 06:21:43 +0000 (23:21 -0700)]
manywarnings: port to GCC on 64-bit MS-Windows
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Work better if
LONG_MAX < PTRDIFF_MAX. Problem reported by Richard Copley in:
https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00392.html
Bruno Haible [Fri, 8 Sep 2017 08:02:47 +0000 (10:02 +0200)]
stddef: Avoid conflict with system-defined max_align_t.
The configure-determined HAVE_MAX_ALIGN_T may not always be accurate.
Reported by Werner Lemberg <wl@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2017-08/msg00185.html>.
* lib/stddef.in.h (rpl_max_align_t): Renamed from max_align_t.
(max_align_t): Define as a macro.
(GNULIB_defined_max_align_t): New macro. Guards against multiple
definitions of rpl_max_align_t in different copies of gnulib-generated
<stddef.h>.
Paul Eggert [Wed, 6 Sep 2017 06:32:59 +0000 (23:32 -0700)]
libc-config: port to MSVC
Problems reported by Gisle Vanem in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-09/msg00016.html
* lib/libc-config.h (__inline): Don't define if HAVE___INLINE.
(libc_hidden_proto): Stick to Standard C syntax for varargs macro.
* m4/__inline.m4: New file.
* modules/libc-config (Files): Add it.
(Depends-on): Use it.
Paul Eggert [Wed, 6 Sep 2017 01:58:50 +0000 (18:58 -0700)]
glob: fix for use in glibc
Problem reported by Adhemerval Zanella in:
https://sourceware.org/ml/libc-alpha/2017-09/msg00213.html
* lib/glob.c (DT_UNKNOWN, DT_DIR, DT_LINK):
Do not redefine if _LIBC.
Paul Eggert [Sat, 2 Sep 2017 22:39:16 +0000 (15:39 -0700)]
glob: fix bugs with long login names
Problem reported by Adhemerval Zanella in:
https://sourceware.org/ml/libc-alpha/2017-08/msg00455.html
* lib/glob.c (GET_LOGIN_NAME_MAX): Remove.
(glob): Use the same scratch buffer for both getlogin_r and
getpwnam_r. Don’t require preallocation of the login name. This
simplifies storage allocation, and corrects the handling of
long login names.