tests


Log

Author Commit Date CI Message
Jia Zhang 12ad1d14 2017-10-07T04:31:27 New module: crypto/sm3 This new module can be used to compute SM3 message digest of files or memory blocks according to the specification GM/T 004-2012 Cryptographic Hash Algorithm SM3, published by State Cryptography Administration, China. The official SM3 cryptographic hash algorithm specification is available at http://www.sca.gov.cn/sca/xwdt/2010-12/17/content_1002389.shtml * lib/sm3.h: Declare the APIs of sm3 module. * lib/sm3.c: Implement SM3 hash algorithm. * m4/sm3.m4: m4 file for sm3 module. * modules/crypto/sm3: Define sm3 module. * tests/test-sm3.c: Implement SM3 test case. * modules/crypto/sm3-tests: Define sm3 test module. * MODULES.html.sh: List sm3 module.
Bruno Haible 2464dbce 2017-10-12T17:40:54 all: Write "Solaris 11.0" instead of "Solaris 11 2011-11".
KO Myung-Hun ca973635 2017-10-07T19:21:07 tests: fix 'invalid path dir' error On OS/2, a path separator is ';' not ':'. And ':' is used as a separator between a drive letter and directory parts. As a result, an absolute path such as x:/path/to/dir on OS/2 is treated as an invalid path dir. * tests/init.sh (PATH_SEPARATOR): Set at startup. (path_prepend_): '?:*' is also an absolute path. Use $PATH_SEPARATOR instead of hard coded ':'.
Bruno Haible 235d203a 2017-10-07T11:52:45 test-framework-sh: Don't require bash on Windows and OS/2. Reported by KO Myung-Hun. * tests/test-init.sh: Use 'shopt' only when running in bash.
Bruno Haible 7244c6bb 2017-09-27T01:59:12 uniname/uniname-tests: Tighten code. * tests/uniname/test-uninames.c (fill_names, fill_aliases): Merge two local variables into one.
Paul Eggert c4cf0d48 2017-09-25T18:26:25 uniname/uniname-tests: integer overflow fix * tests/uniname/test-uninames.c (fill_names, fill_aliases): Check for integer overflow.
Paul Eggert e819a9ea 2017-09-25T18:22:59 duplocale-tests: fix unlikely crash * tests/test-duplocale.c (get_locale_dependent_values): Don’t crash with absurdly long month names.
Paul Eggert 8f87a591 2017-09-25T18:20:44 maint: fix overflow checking in nap.h * modules/chown-tests: * modules/fchownat-tests, modules/fdutimensat-tests: * modules/futimens-tests, modules/lchown-tests: * modules/stat-time-tests, modules/utime-tests: * modules/utimens-tests, modules/utimensat-tests: Depend on intprops. * tests/nap.h: Include intprops.h. (diff_timespec): Handle overflow properly.
Bruno Haible 19882ec1 2017-09-23T12:22:17 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 b2fc4a43 2017-09-23T09:26:48 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.
Bruno Haible 96335dc0 2017-09-23T16:01:33 duplocale tests: Fix test crash on Linux/x86. * tests/test-duplocale.c (test_with_uselocale): Disconnect the mixed2 locale from the current thread before freeing it.
Bruno Haible 03eac9d3 2017-09-14T00:35:56 all: Replace many more http URLs by https URLs. Update stale URLs. * users.txt: Remove mention of 'newts'. * lib/localename.c: Update comment about LANG_SOTHO.
Paul Eggert ca35d468 2017-09-13T00:48:18 all: prefer https: URLs
Paul Eggert fd1daf4e 2017-08-31T14:34:25 glob: match dangling symlinks This fixes a bug I inadvertently introduced to Gnulib when I merged glibc glob back into gnulib on 2007-10-16. This fix is inspired by a patch proposed for glibc by Adhemerval Zanella in: https://sourceware.org/ml/libc-alpha/2017-08/msg00446.html * doc/posix-functions/glob.texi: Update list of affected platforms. * lib/glob.c (__lstat64): New macro. (is_dir): New function. (glob, glob_in_dir): Match symlinks even if they are dangling. (link_stat, link_exists_p): Remove. All uses removed. * lib/glob.in.h (__attribute_noinline__): Remove; no longer used. * m4/glob.m4 (gl_PREREQ_GLOB): Do not check for fstatat. * modules/glob (Depends-on): Remove dirfd. * modules/glob-tests (Depends-on): Add symlink. * tests/test-glob.c: Include errno.h, unistd.h. (BASE): New macro. (main): Test dangling symlinks, if symlinks are supported.
Bruno Haible 5408b0e0 2017-08-17T22:15:10 hypot tests: Fix test failure on FreeBSD 11.0/x86. * tests/test-hypot.h (test_function): Declare z as 'volatile'.
Bruno Haible 47f5e07e 2017-08-16T11:04:30 nonblocking-socket tests: Fix failure on OpenBSD 6.0. * tests/test-nonblocking-socket.h (SOCKET_DATA_BLOCK_SIZE): Increase value for OpenBSD.
Paul Eggert 6536b952 2017-08-15T16:47:22 futimens: don’t assume struct timespec layout * m4/futimens.m4 (gl_FUNC_FUTIMENS): * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): * tests/test-fdutimensat.c (main): * tests/test-futimens.h (test_futimens): * tests/test-lutimens.h (test_lutimens): * tests/test-utimens.h (test_utimens): * tests/test-utimensat.c (main): Don’t assume that struct timespec is a two-member structure in tv_sec, tv_nsec order. Although this is true on all platforms we know about, POSIX does not guarantee it.
Paul Eggert 9a6c7d3f 2017-08-15T15:53:50 rename: document+test NetBSD rename Test failure reported by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2017-08/msg00104.html This is an area where NetBSD is better-behaved than POSIX, so allow the NetBSD behavior in tests. * doc/posix-functions/rename.texi: * doc/posix-functions/renameat.texi: Document NetBSD behavior. * tests/test-rename.h (test_rename): Allow NetBSD behavior.
Bruno Haible a71158ab 2017-08-15T20:23:00 duplocale tests: Verify use with *_l functions. * modules/duplocale-tests (configure.ac): Test for uselocale and some *_l functions. * tests/test-duplocale.c (test_with_uselocale): New function, extracted from main. (get_locale_dependent_values_from, test_with_locale_parameter): New functions. (main): Test both test_with_uselocale and test_with_locale_parameter.
Paul Eggert aa459ef4 2017-08-13T10:55:55 reallocarray: minor fixes * doc/glibc-functions/reallocarray.texi: Update version numbers. * m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Don't trust _cv_ contents. * modules/reallocarray (License): Change from GPL to LGPL. * tests/test-reallocarray.c (main): Fix ENOMEM typo. Indent properly and don't use tabs.
Darshit Shah 98756762 2017-08-13T10:13:33 reallocarray: New module reallocarray is a new function in glibc 2.26 to safely allocate an array of memory locations with integer overflow protection. * MODULES.html.sh: Add reallocarray. * doc/glibc-functions/reallocarray.texi: Documentation for reallocarray. * lib/reallocarray.c: New file to implement module reallocarray. * lib/stdlib.in.h: Add function declarations for reallocarray. * m4/reallocarray.m4: New file. * m4/stdlib_h.m4: Declare reallocarray. * modules/reallocarray: New file. * modules/reallocarray-test: New file. * modules/stdlib: Coerce stdlib.h to export reallocarray. * tests/test-reallocarray.c: New test.
Paul Eggert 0474f8e6 2017-08-12T11:34:50 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.
Paul Eggert f668e12f 2017-07-30T10:53:32 fts-tests: port to gcc -Wwrite-strings * tests/test-fts.c (base, base_d): New static vars. (argv, remove_tree, main): Use them.
Paul Eggert ec046e66 2017-07-27T12:08:39 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.
Paul Eggert b7363b49 2017-07-24T23:12:59 fts-tests: new module * modules/fts-tests, tests/test-fts.c: New files.
Bruno Haible a742bdb3 2017-07-24T01:19:36 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.
Bruno Haible 7f1ef184 2017-07-11T00:53:04 getlogin tests: Avoid #ifdefs when sharing code between modules. * modules/getlogin_r-tests (Files): Add tests/test-getlogin.h. * modules/getlogin-tests (Files): Likewise. Remove tests/test-getlogin_r.c. * tests/test-getlogin.h: Extracted from tests/test-getlogin_r.c. * tests/test-getlogin.c: Extracted from tests/test-getlogin_r.c. * tests/test-getlogin_r.c: Include test-getlogin.h. Omit code that tests getlogin().
Paul Eggert 24605b2f 2017-07-10T11:56:48 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.
Bruno Haible a0018024 2017-07-07T01:40:07 imaxdiv tests: Fix logic. * tests/test-imaxdiv.c (main): Use == instead of =. Reported by Coverity.
Bruno Haible 2c9d4191 2017-05-20T12:12:16 getopt-posix tests: Remove redundant include. * tests/test-getopt.h: Don't include "macros.h". It's already included by tests/test-getopt-main.h.
Jim Meyering 11fdf80b 2017-05-18T08:36:27 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.
Bruno Haible 5e0faf88 2017-05-19T19:27:51 printf-posix tests: Avoid test failure with "gcc --coverage". Reported by Tim Rühsen <tim.ruehsen@gmx.de>. * tests/test-printf-posix2.c (main): Test a width of 10000000 rather than 5000000. * tests/test-fprintf-posix2.c (main): Likewise.
Bruno Haible fa529e84 2017-05-19T09:06:39 get-rusage-data tests: Avoid failure on Linux/glibc. * tests/test-get-rusage-data.c (main): Don't expect a strict increase on glibc systems.
Paul Eggert 5e22aee7 2017-05-16T09:23:52 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 da830b51 2017-05-14T21:32:41 stat-time tests: Improve comment. * tests/test-stat-time.c: Add hyperlink, from Paul Eggert.
Bruno Haible d75a6cfc 2017-05-14T17:37:31 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 63e26828 2017-05-13T02:55:24 truncate-tests: New module. * tests/test-truncate.c: New file. * modules/truncate-tests: New file.
Bruno Haible f4d71054 2017-05-13T02:54:37 truncate: New module. * lib/unistd.in.h (truncate): New declaration. * lib/truncate.c: New file. * m4/truncate.m4: New file. * m4/unistd_h.m4 (gl_UNISTD_H): Test whether 'truncate' is declared. (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_TRUNCATE, HAVE_TRUNCATE, REPLACE_TRUNCATE. * modules/unistd (Makefile.am): Substitute GNULIB_TRUNCATE, HAVE_TRUNCATE, REPLACE_TRUNCATE. * modules/truncate: New file. * tests/test-unistd-c++.cc (truncate): Test signature. * doc/posix-functions/truncate.texi: Mention the new module.
Bruno Haible 03c3f38b 2017-05-10T21:52:21 Implement a way to opt out from MSVC support. This is useful for Emacs. * modules/msvc-nothrow (configure.ac): Invoke gl_MODULE_INDICATOR. * lib/accept4.c: Include <io.h> as an alternative to msvc-nothrow.h. * lib/error.c: Likewise. * lib/fcntl.c: Likewise. * lib/flock.c: Likewise. * lib/fstat.c: Likewise. * lib/fsync.c: Likewise. * lib/ioctl.c: Likewise. * lib/isapipe.c: Likewise. * lib/lseek.c: Likewise. * lib/nonblocking.c: Likewise. * lib/poll.c: Likewise. * lib/select.c: Likewise. * lib/sockets.h: Likewise. * lib/sockets.c: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/utimens.c: Likewise. * lib/w32sock.h: Likewise. * lib/w32spawn.h: Likewise. * tests/test-cloexec.c: Likewise. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * lib/ftruncate.c: Likewise. (chsize_nothrow): Renamed from chsize. * lib/msvc-nothrow.c: Don't include msvc-inval.h if HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined. * lib/close.c: Likewise. * lib/dup.c: Likewise. * lib/fclose.c: Likewise. * lib/raise.c: Likewise. * tests/test-fgetc.c: Likewise. * tests/test-fputc.c: Likewise. * tests/test-fread.c: Likewise. * tests/test-fwrite.c: Likewise. * lib/getdtablesize.c: Likewise. (_setmaxstdio_nothrow): Renamed from _setmaxstdio. * lib/isatty.c: Don't include msvc-inval.h if HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined. Include <io.h> as an alternative to msvc-nothrow.h. * lib/read.c: Likewise. * lib/write.c: Likewise. * lib/dup2.c: Likewise. (dup2_nothrow): New function. (ms_windows_dup2): Use it. * m4/close.m4 (gl_FUNC_CLOSE): Invoke gl_MSVC_INVAL and test HAVE_MSVC_INVALID_PARAMETER_HANDLER only if gl_MSVC_INVAL is defined. * m4/dup.m4 (gl_FUNC_DUP): Likewise. * m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise. * m4/raise.m4 (gl_FUNC_RAISE): Likewise. * m4/read.m4 (gl_FUNC_READ): Likewise. * m4/write.m4 (gl_FUNC_WRITE): Likewise. * doc/windows-without-msvc.texi: New file. * doc/gnulib.texi (Native Windows Support without MSVC Support): New section.
Paul Eggert d9c44b2b 2017-05-08T10:37:48 intprops: don’t depend on ‘verify’ Problem reported by Ævar Arnfjörð Bjarmason in: http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00054.html * lib/intprops.h: Do not include verify.h, and move compile-time checks from here ... * tests/test-intprops.c (main): ... to here, if they’re not here already. Check widths of other standard integer types. * modules/intprops (Depends-on): Remove ‘verify’.
Bruno Haible 7a10cf55 2017-05-05T23:21:33 wctype-h-c++-tests: Update. * tests/test-wctype-h-c++.cc: Reorder to match lib/wchar.in.h.
Bruno Haible 2c3911f5 2017-05-05T23:19:40 wchar-c++-tests: Update. * tests/test-wchar-c++.cc (wcsftime): Declare, missing since 2017-04-30.
Bruno Haible 308880d8 2017-05-05T23:16:31 utime-h-c++-tests: New module. * tests/test-utime-h-c++.cc: New file. (utime): Declare, missing since 2017-04-30. * modules/utime-h-c++-tests: New file.
Bruno Haible 22760ce6 2017-05-05T23:11:12 unistd-c++-tests: Update. * tests/test-unistd-c++.cc (isatty): Declare, missing since 2012-01-03. (read): Declare, missing since 2011-04-15. (sethostname): Declare, missing since 2011-12-03.
Bruno Haible 8f4aa684 2017-05-05T23:04:27 time-c++-tests: Update. * tests/test-time-c++.cc (tzset): Declare, missing since 2017-05-01. (localtime, gmtime): Declare, missing since 2017-04-30. (ctime): Declare, missing since 2017-04-30. (strftime): Declare, missing since 2017-04-30. (tzalloc, tzfree, localtime_rz, mktime_z): Declare, missing since 2015-07-24.
Bruno Haible f614b66a 2017-05-05T22:43:41 sys_resource-c++-tests: New module. * tests/test-sys_resource-c++.cc: New file. (getrusage): Declare, missing since 2012-04-13. * modules/sys_resource-c++-tests: New file.
Bruno Haible e31d3f5c 2017-05-05T22:40:19 strings-c++-tests: New module. * tests/test-strings-c++.cc: New file. (ffs): Declare, missing since 2011-07-12. * modules/strings-c++-tests: New file.
Bruno Haible ec17d752 2017-05-05T22:36:48 string-c++-tests: Update. * tests/test-string-c++.cc (ffsl): Declare, missing since 2011-07-15. (ffsll): Declare, missing since 2011-07-15.
Bruno Haible b8af9e17 2017-05-05T22:29:18 stdlib-c++-tests: Update. * tests/test-stdlib-c++.cc (posix_openpt): Declare, missing since 2011-10-18. (ptsname_r): Declare, missing since 2011-11-07. (qsort_r): Declare, missing since 2014-08-29. (random, srandom, initstate, setstate): Declare, missing since 2012-01-14. (secure_getenv): Declare, missing since 2013-02-05.
Bruno Haible dc3abe2b 2017-05-05T22:13:37 stdio-c++-tests: Update. * tests/test-stdio-c++.cc (pclose): Declare, missing since 2011-09-18.
Bruno Haible 532cc565 2017-05-05T22:08:05 signal-h-c++-tests: Update. * tests/test-signal-h-c++.cc (raise): Remove redundant declaration.
Bruno Haible b42edb72 2017-05-05T22:03:49 math-c++-tests: Update. * tests/test-math-c++.cc (fmaf): Declare, missing since 2011-10-17. (fma): Declare, missing since 2011-10-17. (fmal): Declare, missing since 2011-10-17.
Bruno Haible b2ed664d 2017-05-05T21:57:14 locale-c++-tests: Update. * tests/test-locale-c++.cc (localeconv): Declare, missing since 2012-03-25.
Bruno Haible f33c4869 2017-05-05T21:50:57 inttypes-c++-tests: New module. * tests/test-inttypes-c++.cc: New file. (strtoimax): Declare, missing since 2012-01-05. (strtoumax): Declare, missing since 2012-01-05. * modules/inttypes-c++-tests: New file.
Bruno Haible 89b335be 2017-05-05T21:38:07 dirent-c++-tests: Update. * tests/test-dirent-c++.cc (readdir): Declare, missing since 2011-09-13. (rewinddir): Declare, missing since 2011-09-13. (dirfd): Declare, missing since 2010-03-08.
Bruno Haible dc2bc508 2017-04-30T11:13:56 utime-tests: New module. * tests/test-utime.c: New file, based on tests/test-utimens.h. * tests/test-utimens-common.h: Include <sys/stat.h>. * modules/utime-tests: New file.
Bruno Haible 8dac05d2 2017-04-30T10:21:22 utime-h: New module. * m4/utime_h.m4: New file. * lib/utime.in.h: New file. * modules/utime-h: New file. * doc/posix-headers/utime.texi: Mention the new module. * tests/test-utime-h.c: New file. * modules/utime-h-tests: New file.
Bruno Haible 62f2dba6 2017-04-26T23:25:11 noreturn: New module. * lib/noreturn.h: New file. * modules/noreturn: New file. * tests/test-noreturn.c: New file. * modules/noreturn-tests: New file. * tests/test-noreturn-c++.cc: New file. * modules/noreturn-c++-tests: New file.
Pádraig Brady efb84214 2017-04-26T21:46:55 nap.h: Fix compilation on non windows platforms * tests/nap.h: Move misplaced endif.
Pádraig Brady 94e01571 2017-04-24T01:43:36 time_rz: fix heap buffer overflow vulnerability This issue has been assigned CVE-2017-7476 and was detected with American Fuzzy Lop 2.41b run on the coreutils date(1) program with ASAN enabled. ERROR: AddressSanitizer: heap-buffer-overflow on address 0x... WRITE of size 8 at 0x60d00000cff8 thread T0 #1 0x443020 in extend_abbrs lib/time_rz.c:88 #2 0x443356 in save_abbr lib/time_rz.c:155 #3 0x44393f in localtime_rz lib/time_rz.c:290 #4 0x41e4fe in parse_datetime2 lib/parse-datetime.y:1798 A minimized reproducer is the following 120 byte TZ value, which goes beyond the value of ABBR_SIZE_MIN (119) on x86_64. Extend the aa...b portion to overwrite more of the heap. date -d $(printf 'TZ="aaa%020daaaaaab%089d"') localtime_rz and mktime_z were affected since commit 4bc76593. parse_datetime was affected since commit 4e6e16b3f. * lib/time_rz.c (save_abbr): Rearrange the calculation determining whether there is enough buffer space available. The rearrangement ensures we're only dealing with positive numbers, thus avoiding the problematic promotion of signed to unsigned causing an invalid comparison when zone_copy is more than ABBR_SIZE_MIN bytes beyond the start of the buffer. * tests/test-parse-datetime.c (main): Add a test case written by Paul Eggert, which overwrites enough of the heap so that standard glibc will fail with "free(): invalid pointer" without the patch applied. Reported and analyzed at https://bugzilla.redhat.com/1444774
Bruno Haible be36311d 2017-04-23T19:19:35 nap.h: Port to native Windows. * tests/nap.h (nap_get_stat): Renamed from get_stat. Remove argument fd; use nap_fd instead. On native Windows, close and reopen nap_fd. (nap_works): Don't compare the ctimes, because on native Windows, these are the creation times. (nap): Update.
Bruno Haible 5f72078b 2017-04-23T19:09:32 nap.h: Fix logic. * tests/nap.h (nap): Avoid signed integer overflow in loop.
Bruno Haible 430c2ba5 2017-04-23T13:18:16 stat-time: Update comments. * lib/stat-time.h: Fix reference regarding st_ctime on Windows. * tests/test-utimens-common.h: Add reference regarding st_ctime on Windows.
Bruno Haible e27c6387 2017-04-22T14:51:37 vasnprintf tests: Avoid warnings. * tests/test-vasnprintf-posix3.c (test_function, my_asnprintf, test_vasnprintf, test_asnprintf): Don't define if there's nothing to test.
Bruno Haible d44db1a8 2017-04-22T14:43:23 sys_file tests: Avoid warning. * tests/test-sys_file.c (main): Add a default clause to the switch statement.
Bruno Haible bc800241 2017-04-22T14:24:36 quotearg tests: Avoid warnings. * tests/test-quotearg.c: Don't include test-quotearg.h if ENABLE_NLS is false.
Bruno Haible 00ab0938 2017-04-21T16:55:49 mbrtowc tests: Fix test failures on MSVC 14. * tests/test-mbrtowc-w32.c (test_one_locale): Accept MSVC's conversion behaviour for invalid input.
Bruno Haible a7bd2403 2017-04-20T21:27:40 verify tests: Fix spurious failure with parallel make. * gnulib-tool (func_emit_tests_Makefile_am): Emit initialization of EXTRA_PROGRAMS. * tests/test-verify.sh: Build test-verify-try.o, not test-verify.o. * tests/test-verify-try.c: New file. * modules/verify-tests (Files): Add it. (EXTRA_PROGRAMS): Add test-verify-try. (MOSTLYCLEANFILES): Update accordingly. Reported by Adam James Stewart <ajstewart@anl.gov>.
Paul Eggert 92869eca 2017-03-19T09:34:23 stdalign: tweak version# and test for HP-UX IA64 Problems reported by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00078.html * lib/stdalign.in.h (_Alignas): * m4/stdalign.m4 (gl_STDALIGN_H): Use octal, not decimal, for __HP_cc version. Perhaps HP formerly used octal (as that is how they document it), but it is decimal in practice now and the ancient implementations no longer matter. * tests/test-stdalign.c (main) [__HP_cc && __ia64]: Skip test.
Bruno Haible 69fabe94 2017-03-15T20:32:45 Fix test failures on DragonFlyBSD. * tests/test-localeconv.c (main): Treat DragonFlyBSD like FreeBSD. * tests/test-select.h (test_bad_fd): Likewise. * tests/test-get-rusage-data.c (main): Treat DragonFlyBSD like OpenBSD.
Bruno Haible 8250f4c6 2017-03-05T02:17:00 test-calloc-gnu: Reenable test also for GCC 7. * tests/test-calloc-gnu.c (eight): New function. (main): Don't skip test; use eight() instead.
Jim Meyering 26034f24 2017-03-04T14:50:41 test-calloc-gnu: port to GCC7 * tests/test-calloc-gnu.c (main) [__GNUC__ >= 7]: Skip a test that attempts to calloc more than SIZE_MAX bytes, because GCC7 and newer would detect that at compilation time.
Bruno Haible bc1d4143 2017-03-04T11:24:37 tests: Avoid compiler warning about uses of null_ptr. * tests/null-ptr.h: New file. * tests/test-canonicalize.c: Include null-ptr.h. (null_ptr): Remove function. * tests/test-canonicalize-lgpl.c: Likewise. * tests/test-memmem.c: Likewise. * tests/test-ptsname_r.c: Likewise. * modules/canonicalize-tests (Files): Add tests/null-ptr.h. * modules/canonicalize-lgpl-tests: Likewise. * modules/memmem-tests: Likewise. * modules/ptsname_r-tests: Likewise. Reported by Jim Meyering.
Bruno Haible 4c50d77c 2017-03-03T12:13:48 lock tests: Fix test failure on Mac OS X (regression from 2017-01-05). Reported by Assaf Gordon <assafgordon@gmail.com> via Pádraig Brady <P@draigBrady.com>. * tests/test-lock.c: On Mac OS X, use named semaphores, not unnamed semaphores. (USE_NAMED_SEMAPHORE, USE_UNNAMED_SEMAPHORE): New macros. (atomic_int_semaphore): New macro.
Bruno Haible c1035211 2017-03-01T00:57:33 perror tests: Tweak for z/OS. Reported by Daniel Richard G. <skunk@iskunk.org>. * tests/test-perror.sh: Don't fail z/OS style perror output.
Bruno Haible 6361efe6 2017-02-20T22:34:24 lock tests: Fix build failure on z/OS. Reported by Daniel Richard G. <skunk@iskunk.org>. * modules/lock-tests (configure.ac): Test for <semaphore.h>. * tests/test-lock.c (USE_SEMAPHORE): Don't set if <semaphore.h> does not exist.
Paul Eggert 820fa6ad 2017-02-16T00:17:56 xbinary-io: rename from xsetmode This patch is taken from suggestions by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2017-02/msg00060.html http://lists.gnu.org/archive/html/bug-gnulib/2017-02/msg00061.html * lib/binary-io.c (__gl_setmode_check): Set errno to EINVAL, not ENOTTY, when it is an inappropriate device. * lib/binary-io.h (SET_BINARY): Resurrect. * lib/xbinary-io.c: Rename from lib/xsetmode.c. (xset_binary_mode_error): Rename from xsetmode_error. * lib/xbinary-io.h: Rename from lib/xsetmode.h. (xset_binary_mode): Rename from xsetmode. All uses changed. * modules/xbinary-io: Rename from modules/xsetmode. Update file names. * tests/test-binary-io.sh (tmpfiles): Remove no-longer-used file name. * NEWS: Update to match revised behavior.
Paul Eggert 87c456bf 2017-02-15T15:33:17 tests: Adjust to recent SET_BINARY change * tests/test-binary-io.c (main): * tests/test-binary-io.sh: Remove test for SET_BINARY. * tests/test-closein.c, tests/test-fflush2.c, tests/test-ftell.c: * tests/test-ftello.c, tests/test-nonblocking-pipe-child.c: * tests/test-yesno.c: Use set_binary_mode, not SET_BINARY.
Bruno Haible d66ababa 2017-02-12T13:05:25 times test: Avoid gcc warnings on Linux/x32. * tests/test-times.c (main): Really cast printf arguments from clock_t to 'long int'.
Paul Eggert 6e345935 2017-02-08T16:41:39 stddef-tests: port to SIZE_MAX <= INT_MAX * tests/test-stddef.c: Include <limits.h>, for INT_MAX. Do not assume that INT_MAX < SIZE_MAX.
Paul Eggert 16f6a8d8 2017-01-30T18:20:43 Port to PGI 16.10 x86-64 This patch fixes one real bug in gl_anylinked_list2.h, along with some minor glitches that are not bugs. It does not silence PGI’s thousands of bogus warnings when compiling test-intprops.c. Fortunately, the warnings do not cause a failure. * lib/c-ctype.h (_C_CTYPE_LOWER_A_THRU_F_N, _C_CTYPE_LOWER_N): Rename parameter to avoid PGI warning about ‘#define f(n) 'n'’. My goodness, PGI goes back a long ways - this predates C89! * lib/gl_anylinked_list2.h (ASYNCSAFE): Fix bug caught by PGI. For example, ASYNCSAFE (const void *) should expand to ‘const void *volatile’, not to ‘volatile const void *’. * lib/spawn.in.h (POSIX_SPAWN_USEVFORK): Don't define if already defined. * lib/verify.h (verify) [!__GNUC__]: Use shorter albeit meaningless string to bypass silly compiler limits. * tests/infinity.h (Infinityf, Infinityd, Infinityl) [__PGI]: * tests/nan.h (NaNf, NaNd, NaNl): Use static functions to avoid misguided compiler diagnostics. Is there some reason we don’t use static functions on all platforms?
Paul Eggert 0e68c6a3 2017-01-14T11:35:34 strftime: %z is -00 if unknown * lib/strftime.c (DO_TZ_OFFSET): Omit arg 'negative'; it's now the caller's responsibility to set 'negative_number'. All uses changed. (__strftime_internal): Put '-' before a zero UTC offset if the time zone abbreviation starts with "-", which is the recently-introduced tzdb convention for an unknown UTC offset that is arbitrarily set to 0. * tests/test-strftime.c: Test for this.
Paul Eggert e89646ad 2017-01-09T11:55:22 maint: time stamp -> timestamp Use the spelling "timestamp", as that is what POSIX uses.
Paul Eggert 6a15cedb 2017-01-06T14:14:43 localename-tests: port to NetBSD 7 Problem reported by Nelson H. F. Beebe. * tests/test-localename.c: Test newlocale and uselocale only if both exist.
Bruno Haible b20e8afb 2017-01-05T23:49:34 lock tests: Prefer semaphore over mutex. * tests/test-lock.c (USE_SEMAPHORE): New constant. (struct atomic_int, init_atomic_int, get_atomic_int_value, set_atomic_int_value) [USE_SEMAPHORE]: Define using a POSIX semaphore. Suggested by Torvald Riegel <triegel@redhat.com>.
Bruno Haible be95b17a 2017-01-05T12:51:36 lock: Provide guarantee to avoid writer starvation for rwlocks. The rationale is: 1) Read-preferring read-write locks are prone to writer starvation if the number of reader threads multiplied by the percentage of time they have the lock held is too high. 2) Write- preferring read-write locks are the only reliable way to avoid this. 3) There have been reports of 'test-lock' hanging on glibc systems http://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00009.html, and glibc indeed implements read-preferring rwlocks by default, see http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html and https://sourceware.org/bugzilla/show_bug.cgi?id=13701 . * m4/pthread_rwlock_rdlock.m4: New file. * m4/lock.m4 (gl_LOCK): Invoke gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. * lib/glthread/lock.h [USE_POSIX_THREADS]: Test HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation of rwlock initialization on glibc systems without HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation of rwlocks altogether on non-glibc systems without HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. [USE_PTH_THREADS]: Use a different implementation of rwlocks altogether. * lib/glthread/lock.c [USE_POSIX_THREADS] (glthread_rwlock_init_for_glibc): New function. [USE_POSIX_THREADS] (glthread_rwlock_rdlock_multithreaded): Update comment. [USE_PTH_THREADS]: New implementation of rwlocks. [USE_WINDOWS_THREADS] (glthread_rwlock_rdlock_func): Prefer writers over readers. * modules/lock (Files): Add m4/pthread_rwlock_rdlock.m4. (Depends-on): Add 'extensions'. * tests/test-rwlock1.c: New file. * lock-tests (Files): Add it. (Depends-on): Add usleep. (Makefile.am): Add test-rwlock1 to the tests.
Paul Eggert a3fd683d 2017-01-01T02:59:23 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. * all files: Run 'make update-copyright'.
Eric Blake b366f53e 2016-12-29T15:05:34 getopt: fix parallel test failure I hit a testsuite failure due to a failure removing test-getopt.tmp, when running tests in parallel. * tests/test-getopt-posix.c (TEST_GETOPT_TMP_NAME): Set name. * tests/test-getopt-gnu.c (TEST_GETOPT_TMP_NAME): Likewise. * tests/test-getopt-main.h (main): Use different file names in case test-getopt-gnu and test-getopt-posix run in parallel. Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible 480d374e 2016-12-24T18:21:59 lock test: Fix performance problem on multi-core machines. * tests/test-lock.c (USE_VOLATILE): New macro. (struct atomic_int): New type. (init_atomic_int, get_atomic_int_value, set_atomic_int_value): New functions. (lock_checker_done, rwlock_checker_done, reclock_checker_done): Define as 'struct atomic_int'. (lock_checker_thread, test_lock, rwlock_checker_thread, test_rwlock, reclock_checker_thread, test_recursive_lock): Use the new functions. Reported by Eric Blake in https://www.redhat.com/archives/libvir-list/2012-March/msg00854.html and by Pádraig Brady in http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00117.html.
Bruno Haible bd70cf69 2016-12-18T14:03:37 Split tests for getopt-posix and getopt-gnu. * tests/test-getopt-posix.c: New file. * tests/test-getopt-gnu.c: New file, with code from test-getopt.c. * tests/test-getopt-main.h: Renamed from tests/test-getopt.c. Remove stuff moved to test-getopt-gnu.c. Test TEST_GETOPT_GNU instead of GNULIB_TEST_GETOPT_GNU. * modules/getopt-posix-tests (Files): Add test-getopt-posix.c, test-getopt-main.h. Remove test-getopt.c, test-getopt_long.h. (Makefile.am): Test test-getopt-posix instead of test-getopt. * modules/getopt-gnu-tests: New file. * modules/getopt-gnu (configure.ac): Don't define GNULIB_TEST_GETOPT_GNU.
Bruno Haible 571d60e6 2016-12-18T13:07:43 getopt: Fix link error for users of getopt() in <unistd.h>. * lib/getopt.in.h (getopt etc.): Do the macro definitions also when __need_getopt is defined. Undefine all macros before defining them. * modules/getopt (Include): Clarify that including <unistd.h> is also OK. * tests/test-getopt.c: Add comment.
Bruno Haible 2ebd13d9 2016-12-18T01:49:50 getaddrinfo tests: Avoid compilation error on MSVC. * tests/test-getaddrinfo.c: Don't check the prototypes of freeaddrinfo, getaddrinfo on native Windows.
Bruno Haible d2443002 2016-12-17T11:02:41 getlogin_r tests: Port to mingw. * tests/test-getlogin_r.c: Don't include <pwd.h> on native Windows.
Bruno Haible 8fe9cd1c 2016-12-17T11:00:30 getlogin: Port to newer mingw. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_DECL_GETLOGIN. * m4/getlogin.m4 (gl_FUNC_GETLOGIN): Set HAVE_DECL_GETLOGIN. * modules/unistd (Makefile.am): Substibute HAVE_DECL_GETLOGIN, not HAVE_GETLOGIN. * lib/unistd.in.h (getlogin): Test HAVE_DECL_GETLOGIN, not HAVE_GETLOGIN. * doc/posix-functions/getlogin.texi: Mention the issue. * tests/test-getlogin.c: Don't include <pwd.h> on native Windows.
Bruno Haible 3044ae7f 2016-12-15T22:26:01 init.sh: Add possibility to not delete temporary files. * tests/init.sh (remove_tmp_): If the environment variable KEEP is set to yes, don't erase the temporary directory.
Paul Eggert b947d052 2016-11-26T14:53:29 freopen: work around glibc bug with closed fd Work around glibc bug#15589, where freopen mishandles the case where stdin etc. are already closed. * doc/posix-functions/freopen.texi (freopen): Document the bug. * lib/freopen.c (_GL_ALREADY_INCLUDING_STDIO_H): Define this instead of __need_FILE, as the latter does not work with glibc. Include <fcntl.h>, for open flags. (rpl_freopen): Work around glibc bug. * m4/freopen.m4 (gl_FUNC_FREOPEN): Check for bug. * modules/freopen (Depends-on): Add fcntl-h. * tests/test-freopen.c (main): Test for bug.
Jim Meyering 19a23ce7 2016-11-20T08:33:38 fix test driver leaks: exclude, malloc, realloc * tests/test-exclude.c (main): Fix trivial leak. * tests/test-malloc-gnu.c (main): Likewise. * tests/test-realloc-gnu.c (main): Likewise. With these changes, grep's tests are now leak free. I.e., running them with ASAN elicits no failure: make CFLAGS='-O0 -ggdb3' AM_CFLAGS=-fsanitize=address \ AM_LDFLAGS='-fsanitize=address -static-libasan' check
Bruno Haible a24dbc4a 2016-11-17T11:51:55 Enable Unicode decoder safety unconditionally. * lib/unistr.in.h (u32_mbtouc_unsafe): Assume CONFIG_UNICODE_SAFETY. * lib/unistr/u8-mblen.c (u8_mblen): Likewise. * lib/unistr/u8-mbtouc-unsafe.c (u8_mbtouc_unsafe): Likewise. * lib/unistr/u8-mbtouc-unsafe-aux.c (u8_mbtouc_unsafe_aux): Likewise. * lib/unistr/u8-prev.c (u8_prev): Likewise. * lib/unistr/u8-strmblen.c (u8_strmblen): Likewise. * lib/unistr/u8-strmbtouc.c (u8_strmbtouc): Likewise. * lib/unistr/u16-mblen.c (u16_mblen): Likewise. * lib/unistr/u16-mbtouc-unsafe.c (u16_mbtouc_unsafe): Likewise. * lib/unistr/u16-mbtouc-unsafe-aux.c (u16_mbtouc_unsafe_aux): Likewise. * lib/unistr/u16-prev.c (u16_prev): Likewise. * lib/unistr/u16-strmblen.c (u16_strmblen): Likewise. * lib/unistr/u16-strmbtouc.c (u16_strmbtouc): Likewise. * lib/unistr/u32-mblen.c (u32_mblen): Likewise. * lib/unistr/u32-mbtouc-unsafe.c (u32_mbtouc_unsafe): Likewise. * lib/unistr/u32-prev.c (u32_prev): Likewise. * lib/unistr/u32-next.c (u32_next): Likewise. * lib/unistr/u32-strmblen.c (u32_strmblen): Likewise. * lib/unistr/u32-strmbtouc.c (u32_strmbtouc): Likewise. * lib/uniconv/u8-conv-to-enc.c (u8_conv_to_encoding): Likewise. * lib/uniconv/u8-strconv-to-enc.c (u8_strconv_to_encoding): Likewise. * tests/unistr/test-u16-prev.c (check_invalid): Enable the CONFIG_UNICODE_SAFETY tests unconditionally. * tests/unistr/test-u32-mblen.c (main): Likewise. * tests/unistr/test-u32-mbtouc.h (test_function): Likewise. * tests/unistr/test-u32-prev.c (check_invalid): Likewise. * tests/unistr/test-u32-next.c (main): Likewise. * tests/unistr/test-u32-strmblen.c (main): Likewise. * tests/unistr/test-u32-strmbtouc.c (main): Likewise. * tests/unistr/test-u32-mbtouc.c (FULL_SAFETY): Remove macro. * lib/unistr/u8-check.c (u8_check): Remove old dead code. * lib/unistr/u8-mbtouc.c (u8_mbtouc): Likewise. * lib/unistr/u8-mbtouc-aux.c (u8_mbtouc_aux): Likewise. * lib/unistr/u8-mbtoucr.c (u8_mbtoucr): Likewise. * lib/unistr/u8-uctomb.c (u8_uctomb): Likewise. * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise. * lib/unistr/u16-check.c (u16_check): Update comment. * NEWS: Mention the changes that callers should be aware of.
Pedro Alves c907efdb 2016-11-14T23:08:21 snippet/c++defs: fix real-floating arg functions in C++ mode Also, define isfinite, isinf, isnan, signbit in the gnulib namespace instead of in the global namespace. * build-aux/snippet/c++defs.h (_GL_BEGIN_NAMESPACE) (_GL_END_NAMESPACE): New. * lib/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Use them. (isfinite, isinf, isnan, signbit) [__cplusplus && GNULIB_NAMESPACE]: Define them in the GNULIB_NAMESPACE namespace instead of in the global namespace. * tests/test-math-c++.cc: Check that the isfinite, isinf, isnan, signbit overloads exist in the GNULIB_NAMESPACE namespace, instead of in the global namespace.
Pádraig Brady 2f8b355a 2016-10-19T14:46:14 strftime,strptime: support %q to represent the quarter * lib/strftime.c (strftime_case_): Add %q case. * lib/strptime.c (__strptime_internal): Likewise. * tests/test-strftime.c (quarter_test): A new test case.