summaryrefslogtreecommitdiff
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize C++ tests for stdbool and stdbool-c99.Bruno Haible2022-09-103-2/+22
| | | | | | | | | | | * tests/test-stdbool-c++.cc: Don't include <stdbool.h> if TEST_STDBOOL_H is not defined. Add a couple of simple tests, from test-stdbool.c. * tests/test-stdbool-c99-c++.cc: New file. * modules/stdbool-c99-c++-tests: New file, based on modules/stdbool-c++-tests. * modules/stdbool-c99-tests (Depends-on): Add stdbool-c99-c++-tests. Remove stdbool-c++-tests. * modules/stdbool-tests (Depends-on): Add stdbool-c++-tests.
* Rely on new stdbool behaviorPaul Eggert2022-09-1017-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefer the C23 style to the C99 style, since the stdbool module now supports C23. * lib/acl-internal.h, lib/acl.h, lib/argmatch.c, lib/argmatch.h: * lib/argp-help.c, lib/argv-iter.h, lib/asyncsafe-spin.c: * lib/backup-internal.h, lib/backupfile.c, lib/base32.h: * lib/base64.h, lib/basename-lgpl.c, lib/bitset/base.h: * lib/c-ctype.h, lib/c-strcasestr.c, lib/canonicalize-lgpl.c: * lib/canonicalize.c, lib/chdir-long.c, lib/chown.c: * lib/classpath.h, lib/clean-temp-private.h: * lib/clean-temp-simple.c, lib/clean-temp-simple.h: * lib/clean-temp.c, lib/clean-temp.h, lib/cloexec.h: * lib/close-stream.c, lib/closein.c, lib/closeout.c, lib/closeout.h: * lib/csharpcomp.h, lib/csharpexec.h, lib/cycle-check.c: * lib/cycle-check.h, lib/des.h, lib/dfa.h, lib/diffseq.h: * lib/dirname.h, lib/exclude.c, lib/exclude.h, lib/execute.c: * lib/execute.h, lib/execvpe.c, lib/fatal-signal.c, lib/fchdir.c: * lib/file-set.h, lib/filevercmp.c, lib/findprog-in.c: * lib/findprog.c, lib/findprog.h, lib/fma.c, lib/fnmatch.c: * lib/fopen.c, lib/freadable.h, lib/freading.h, lib/freopen-safer.c: * lib/fstrcmp.c, lib/fsusage.h, lib/fts.c, lib/fwritable.h: * lib/fwriteerror.c, lib/fwriting.h, lib/gen-uni-tables.c: * lib/getaddrinfo.c, lib/getcwd.c, lib/getloadavg.c: * lib/getndelim2.c, lib/getpass.c, lib/getrandom.c: * lib/git-merge-changelog.c, lib/gl_list.h, lib/gl_map.h: * lib/gl_omap.h, lib/gl_oset.h, lib/gl_set.h, lib/glob.c: * lib/glthread/cond.h, lib/hamt.h, lib/hard-locale.h: * lib/hash-triple.h, lib/hash.h, lib/human.h, lib/i-ring.h: * lib/isapipe.c, lib/javacomp.h, lib/javaexec.h, lib/javaversion.c: * lib/lchown.c, lib/localeinfo.h, lib/localename.c: * lib/long-options.h, lib/malloc/dynarray.h, lib/mbchar.h: * lib/mbfile.h, lib/mbiter.h, lib/mbmemcasecoll.h, lib/mbscasestr.c: * lib/mbsstr.c, lib/mbuiter.h, lib/mkdir-p.h, lib/modechange.h: * lib/mountlist.h, lib/nanosleep.c, lib/nonblocking.h: * lib/nstrftime.c, lib/openat.c, lib/openat.h, lib/os2-spawn.c: * lib/parse-datetime.h, lib/pipe-filter-aux.c, lib/pipe-filter-gi.c: * lib/pipe-filter-ii.c, lib/pipe-filter.h, lib/posixtm.h: * lib/priv-set.c, lib/progreloc.c, lib/propername.c: * lib/pthread-spin.c, lib/quotearg.c, lib/readtokens.c: * lib/readtokens0.h, lib/readutmp.c, lib/regex-quote.h: * lib/regex_internal.h, lib/relocwrapper.c, lib/rename.c: * lib/renameatu.c, lib/rpmatch.c, lib/same.c, lib/same.h: * lib/save-cwd.c, lib/savewd.c, lib/savewd.h, lib/spawn-pipe.h: * lib/spawni.c, lib/stack.h, lib/stat.c, lib/stdckdint.in.h: * lib/strcasestr.c, lib/strfmon_l.c, lib/striconveh.c: * lib/striconveha.h, lib/string-buffer.h, lib/strptime.c: * lib/strstr.c, lib/strtod.c, lib/supersede.h, lib/system-quote.c: * lib/tempname.c, lib/term-style-control.c: * lib/term-style-control.h, lib/textstyle.in.h, lib/time_rz.c: * lib/tmpdir.c, lib/tmpdir.h, lib/tmpfile.c, lib/unicase.in.h: * lib/unicase/caseprop.h, lib/unicase/invariant.h: * lib/unicase/u16-casemap.c, lib/unicase/u16-ct-totitle.c: * lib/unicase/u16-is-invariant.c, lib/unicase/u32-casemap.c: * lib/unicase/u32-ct-totitle.c, lib/unicase/u32-is-invariant.c: * lib/unicase/u8-casemap.c, lib/unicase/u8-ct-totitle.c: * lib/unicase/u8-is-invariant.c, lib/unictype.in.h: * lib/unigbrk.in.h, lib/unigbrk/u16-grapheme-breaks.c: * lib/unigbrk/u32-grapheme-breaks.c: * lib/unigbrk/u8-grapheme-breaks.c: * lib/unigbrk/uc-grapheme-breaks.c, lib/uniname/uniname.c: * lib/unistr.in.h, lib/unlinkdir.h, lib/userspec.h, lib/utime.c: * lib/utimecmp.c, lib/utimens.c, lib/wait-process.h: * lib/windows-cond.c, lib/windows-spawn.c, lib/windows-spawn.h: * lib/windows-timedrwlock.c, lib/write-any-file.h, lib/xbinary-io.c: * lib/xstrtod.h, lib/yesno.h: * tests/nap.h, tests/qemu.h, tests/test-areadlink-with-size.c: * tests/test-areadlink.c, tests/test-areadlinkat-with-size.c: * tests/test-areadlinkat.c, tests/test-base32.c: * tests/test-base64.c, tests/test-ceil2.c, tests/test-ceilf2.c: * tests/test-chown.c, tests/test-dirname.c, tests/test-dup-safer.c: * tests/test-dup3.c, tests/test-exclude.c: * tests/test-execute-child.c, tests/test-execute-main.c: * tests/test-execute-script.c, tests/test-explicit_bzero.c: * tests/test-fchownat.c, tests/test-fcntl-safer.c: * tests/test-fcntl.c, tests/test-fdutimensat.c: * tests/test-filenamecat.c, tests/test-floor2.c: * tests/test-floorf2.c, tests/test-fstatat.c, tests/test-fstrcmp.c: * tests/test-futimens.c, tests/test-getlogin.h, tests/test-getopt.h: * tests/test-hard-locale.c, tests/test-hash.c: * tests/test-idpriv-drop.c, tests/test-idpriv-droptemp.c: * tests/test-immutable.c, tests/test-intprops.c: * tests/test-lchown.c, tests/test-link.c, tests/test-linkat.c: * tests/test-lstat.c, tests/test-mbmemcasecmp.c: * tests/test-mbmemcasecoll.c, tests/test-mkdir.c: * tests/test-mkdirat.c, tests/test-mkfifo.c, tests/test-mkfifoat.c: * tests/test-mknod.c, tests/test-nonblocking-pipe-child.c: * tests/test-nonblocking-pipe-main.c: * tests/test-nonblocking-socket-child.c: * tests/test-nonblocking-socket-main.c, tests/test-open.c: * tests/test-openat.c, tests/test-pipe.c, tests/test-pipe2.c: * tests/test-poll.c, tests/test-posix_spawn-chdir.c: * tests/test-posix_spawn-dup2-stdin.c: * tests/test-posix_spawn-dup2-stdout.c: * tests/test-posix_spawn-fchdir.c, tests/test-posix_spawn-open1.c: * tests/test-posix_spawn-open2.c, tests/test-quotearg-simple.c: * tests/test-quotearg.c, tests/test-readlink.c: * tests/test-readlinkat.c, tests/test-readtokens.c: * tests/test-rename.c, tests/test-renameat.c: * tests/test-renameatu.c, tests/test-rmdir.c, tests/test-round2.c: * tests/test-select.h, tests/test-spawn-pipe-child.c: * tests/test-spawn-pipe-main.c, tests/test-spawn-pipe-script.c: * tests/test-stack.c, tests/test-stat.c, tests/test-supersede.c: * tests/test-symlink.c, tests/test-symlinkat.c: * tests/test-system-quote-main.c: * tests/test-term-style-control-hello.c: * tests/test-term-style-control-yes.c, tests/test-timespec.c: * tests/test-trunc2.c, tests/test-truncf2.c, tests/test-unlink.c: * tests/test-unlinkat.c, tests/test-userspec.c, tests/test-utime.c: * tests/test-utimens.c, tests/test-utimensat.c: * tests/unictype/test-categ_byname.c: * tests/unigbrk/test-uc-is-grapheme-break.c: Don’t include stdbool.h. * modules/acl, modules/xgetcwd: Don’t depend on stdbool, as these modules don’t use bool. * modules/argp, modules/bitset, modules/diffseq, modules/file-has-acl: * modules/gen-uni-tables, modules/getrandom: * modules/hash-triple-simple, modules/posix_spawn-internal: * modules/strcasestr, modules/supersede, modules/system-quote: * modules/uniconv/base, modules/uniname/uniname, modules/utime: * modules/windows-timedrwlock: Depend on stdbool, as these modules use bool.
* stdbool: upgrade from C99 to C23Paul Eggert2022-09-104-28/+66
| | | | | | | | | | | Change the stdbool module so that it now emulates C23. The module now assumes C99. The old module (which assumes C89 and emulates C99) is still available as stdbool-c99, but is deprecated. * tests/test-stdbool.c [TEST_STDBOOL_H]: Do not include stdbool.h. (WORKING_BOOL): Depend on HAVE_C_BOOL, not __STDC_VERSION__. * m4/c-bool.m4, modules/c-bool, modules/c-bool-tests: * tests/test-c-bool.c: New files.
* posix_spawn_file_actions_addclose tests: Fix mistake from 2022-09-07.Bruno Haible2022-09-091-0/+1
| | | | | * modules/posix_spawn_file_actions_addclose-tests (Files): Add m4/musl.m4.
* posix_spawn_file_actions_addclose tests: Avoid test failure on musl.Bruno Haible2022-09-071-0/+1
| | | | | | | | | | Reported by Valery Ushakov <uwe@stderr.spb.ru> in <https://lists.gnu.org/archive/html/bug-gnulib/2022-09/msg00041.html>. * modules/posix_spawn_file_actions_addclose-tests (configure.ac): Invoke gl_MUSL_LIBC. * tests/test-posix_spawn_file_actions_addclose.c (main): Skip one of the tests on musl libc.
* Fix various test link errors on MSVC.Bruno Haible2022-09-0519-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * modules/crypto/gc-arcfour-tests (Makefile.am): Link test-gc-arcfour with $(LIB_GETRANDOM). * modules/crypto/gc-arctwo-tests (Makefile.am): Link test-gc-arctwo with $(LIB_GETRANDOM). * modules/crypto/gc-des-tests (Makefile.am): Link test-gc-des with $(LIB_GETRANDOM). * modules/crypto/gc-hmac-md5-tests (Makefile.am): Link test-gc-hmac-md5 with $(LIB_GETRANDOM). * modules/crypto/gc-hmac-sha1-tests (Makefile.am): Link test-gc-hmac-sha1 with $(LIB_GETRANDOM). * modules/crypto/gc-hmac-sha256-tests (Makefile.am): Link test-gc-hmac-sha256 with $(LIB_GETRANDOM). * modules/crypto/gc-hmac-sha512-tests (Makefile.am): Link test-gc-hmac-sha512 with $(LIB_GETRANDOM). * modules/crypto/gc-md2-tests (Makefile.am): Link test-gc-md2 with $(LIB_GETRANDOM). * modules/crypto/gc-md4-tests (Makefile.am): Link test-gc-md4 with $(LIB_GETRANDOM). * modules/crypto/gc-md5-tests (Makefile.am): Link test-gc-md5 with $(LIB_GETRANDOM). * modules/crypto/gc-pbkdf2-tests (Makefile.am): Link test-gc-pbkdf2 with $(LIB_GETRANDOM). * modules/crypto/gc-pbkdf2-sha1-tests (Makefile.am): Link test-gc-pbkdf2-sha1 with $(LIB_GETRANDOM). * modules/crypto/gc-rijndael-tests (Makefile.am): Link test-gc-rijndael with $(LIB_GETRANDOM). * modules/crypto/gc-sha1-tests (Makefile.am): Link test-gc-sha1 with $(LIB_GETRANDOM). * modules/crypto/gc-sha256-tests (Makefile.am): Link test-gc-sha256 with $(LIB_GETRANDOM). * modules/crypto/gc-sha512-tests (Makefile.am): Link test-gc-sha512 with $(LIB_GETRANDOM). * modules/crypto/gc-sm3-tests (Makefile.am): Link test-gc-sm3 with $(LIB_GETRANDOM). * modules/sys_stat-c++-tests (Makefile.am): Link test-sys_stat-c++ with $(LIB_GETRANDOM). * modules/unistd-c++-tests (Makefile.am): Link test-unistd-c++ with $(LIB_GETRANDOM).
* glob tests: Fix link error on mingw.Bruno Haible2022-09-051-1/+1
| | | | * modules/glob-tests (Makefile.am): Link test-glob with $(LIBINTL).
* Fix compilation errors of C++ tests on Solaris 10 with Sun C++.Bruno Haible2022-09-042-2/+2
| | | | | | | * modules/string-c++-tests (Makefile.am): Link test-string-c++ with $(LIBUNISTRING). * modules/wchar-c++-tests (Makefile.am): Link test-wchar-c++ with $(LIBUNISTRING).
* sysexits: Add C++ tests.Bruno Haible2022-09-042-0/+18
| | | | | | * tests/test-sysexits-c++.cc: New file. * modules/sysexits-c++-tests: New file. * modules/sysexits-tests (Depends-on): Add sysexits-c++-tests.
* sys_utsname: Add C++ tests.Bruno Haible2022-09-042-0/+18
| | | | | | * tests/test-sys_utsname-c++.cc: New file. * modules/sys_utsname-c++-tests: New file. * modules/sys_utsname-tests (Depends-on): Add sys_utsname-c++-tests.
* sys_uio: Add C++ tests.Bruno Haible2022-09-042-0/+18
| | | | | | * tests/test-sys_uio-c++.cc: New file. * modules/sys_uio-c++-tests: New file. * modules/sys_uio-tests (Depends-on): Add sys_uio-c++-tests.
* sys_times: Add C++ tests.Bruno Haible2022-09-042-0/+22
| | | | | | * tests/test-sys_times-c++.cc: New file. * modules/sys_times-c++-tests: New file. * modules/sys_times-tests (Depends-on): Add sys_times-c++-tests.
* sys_file: Add C++ tests.Bruno Haible2022-09-042-0/+18
| | | | | | * tests/test-sys_file-c++.cc: New file. * modules/sys_file-c++-tests: New file. * modules/sys_file-tests (Depends-on): Add sys_file-c++-tests.
* stdckdint: Add C++ tests.Bruno Haible2022-09-042-0/+18
| | | | | | * tests/test-stdckdint-c++.cc: New file. * modules/stdckdint-c++-tests: New file. * modules/stdckdint-tests (Depends-on): Add stdckdint-c++-tests.
* stdalign: Add C++ tests.Bruno Haible2022-09-042-0/+18
| | | | | | * tests/test-stdalign-c++.cc: New file. * modules/stdalign-c++-tests: New file. * modules/stdalign-tests (Depends-on): Add stdalign-c++-tests.
* sched: Add C++ tests.Bruno Haible2022-09-042-0/+20
| | | | | | * tests/test-sched-c++.cc: New file. * modules/sched-c++-tests: New file. * modules/sched-tests (Depends-on): Add sched-c++-tests.
* netinet_in: Add C++ tests.Bruno Haible2022-09-032-0/+18
| | | | | | * tests/test-netinet_in-c++.cc: New file. * modules/netinet_in-c++-tests: New file. * modules/netinet_in-tests (Depends-on): Add netinet_in-c++-tests.
* net_if: Add C++ tests.Bruno Haible2022-09-032-0/+20
| | | | | | | * tests/test-net_if-c++.cc: New file. * modules/net_if-c++-tests: New file. * modules/net_if-tests (Depends-on): Add net_if-c++-tests. * doc/posix-headers/net_if.texi: Fix documentation.
* tempname: fix multithreading, ASLR leak etc.Paul Eggert2022-08-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix problems with tempname and multithreading, entropy loss, and missing clock data (this last on non-GNU platforms). See analysis by Bruno Haible in: https://bugs.gnu.org/57129#149 While looking into this, I noticed that tempname can leak info derived from ASLR into publicly-visible file names, which is a no-no. Fix that too. * lib/tempname.c: Don't include stdalign.h. (HAS_CLOCK_ENTROPY): Remove. (mix_random_values): New function. (random_bits): Use it. Args are now new value address and old value, and this function now returns a success indicator. Omit old USE_GETRANDOM argument: always try getrandom now, as there is no good reason not to now that GRND_NONBLOCK is used. Caller changed. Use CLOCK_REALTIME for for ersatz entropy, as CLOCK_MONOTONIC doesn't work on some platforms. Also, mix in ersatz entropy from tv_sec and from clock (). (try_tempname_len): Do not mix in ASLR-based entropy, as the result is published to the world and ASLR should be private. Do not try to use a static var as that has issues if multithreaded. Instead, simply generate new random bits. Worry about bias only with high-quality random bits. * modules/tempname (Depends-on): Do not depend on stdalign.
* tempname: Add more tests.Bruno Haible2022-08-161-0/+3
| | | | | | | | Based on scenario described by Eli Zaretskii in <https://lists.gnu.org/archive/html/bug-gnulib/2022-08/msg00043.html>. * tests/test-tempname.c (main): Add another test. * modules/tempname-tests (Status): Mark the test as unportable.
* tempname: Add tests.Bruno Haible2022-08-161-0/+13
| | | | | * tests/test-tempname.c: New file. * modules/tempname-tests: New file.
* stdckdint: fix dependencyPaul Eggert2022-08-101-0/+1
| | | | | * modules/stdckdint (Depends-on): Add stdbool. Reported by Bruno Haible.
* stdckdint: prefer to intprops when easyPaul Eggert2022-08-1010-9/+10
| | | | | | | | | | | | | | | | | stdckdint.h is part of draft C23 and therefore is more likely to be familiar to programmers in the future, so prefer it to intprops.h in files that don’t need non-_WRAPV intprops.h macros. * lib/alignalloc.c, lib/backupfile.c, lib/fnmatch.c, lib/fnmatch_loop.c: * lib/group-member.c, lib/malloca.c, lib/posixtm.c, lib/reallocarray.c: * lib/xmalloc.c: For files that can use stdckdint.h just as easily as intprops.h, include the former instead of the latter, and use the former’s ckd_* macros instead of the latter’s *_WRAPV macros. * modules/alignalloc, modules/backup-rename, modules/backupfile: * modules/fnmatch, modules/group-member, modules/malloca: * modules/posixtm, modules/reallocarray: * modules/relocatable-prog-wrapper, modules/xalloc: Depend on stdckdint instead of intprops.
* stdckdint-h: new modulePaul Eggert2022-08-102-0/+60
| | | | | | | | | | | | | | | | | | | | | | | This supports draft C23 <stdckdint.h>. * doc/posix-headers/stdckdint.texi: * lib/stdckdint.in.h, modules/stdckdint: * modules/stdckdint-tests, tests/test-stdckdint.c: New files. * MODULES.html.sh, doc/gnulib.texi: Update for new module. * lib/intprops-internal.h: Include <stdckdint.h> if C23 and its macros would help and our substitute has not already started to be included. (_GL_INT_ADD_WRAPV, _GL_INT_SUBTRACT_WRAPV) (_GL_INT_MULTIPLY_WRAPV): Use ckd_add, ckd_sub, ckd_mul if they are defined and would help. * lib/intprops-internal.h, lib/intprops.h: Improve comments. The C23 restrictions on stdckdint macros already mostly applied to intprops.h, so these are clarifications, not further restrictions. * tests/test-intprops.c: If TEST_STDCKDINT is defined, include <stdckdint.h> instead of "intprops.h", and test it instead. (VERIFY) [TEST_STDCKDINT]: Ignore the arg in this case. (main) [TEST_STDCKDINT]: Skip tests irrelevant to stdckdint.h.
* intprops: refactor intprops.h into twoPaul Eggert2022-08-101-0/+1
| | | | | | | | | | | | | | | | | | | | * lib/intprops.h: Include new file intprops-internal.h. (_GL_INT_CONVERT, _GL_INT_NEGATE_CONVERT, _GL_INT_MINIMUM) (_GL_INT_MAXIMUM, _GL_SIGNED_INT_MAXIMUM, LLONG_MAX, LLONG_MIN) (_GL_HAVE___TYPEOF__, _GL_SIGNED_TYPE_OR_EXPR) (_GL_HAS_BUILTIN_ADD_OVERFLOW, _GL_HAS_BUILTIN_MUL_OVERFLOW) (_GL_HAS_BUILTIN_OVERFLOW_P, _GL__GENERIC_BOGUS) (_GL_INT_OP_WRAPV, _GL_INT_OP_WRAPV_LONGISH, _GL_INT_OP_CALC) (_GL_INT_OP_WRAPV_VIA_UNSIGNED, _GL_INT_ADD_RANGE_OVERFLOW) (_GL_INT_SUBTRACT_RANGE_OVERFLOW) (_GL_INT_MULTIPLY_RANGE_OVERFLOW): Move to intprops-internal.h. (TYPE_SIGNED, EXPR_SIGNED, TYPE_WIDTH, INT_NEGATE_RANGE_OVERFLOW) (INT_NEGATE_OVERFLOW, INT_ADD_WRAPV, INT_SUBTRACT_WRAPV) (INT_MULTIPLY_WRAPV): Rename to _GL_ prefix, move to intprops-internal.h, and define here in terms of the _GL_ name. * lib/intprops-internal.h: New file, containing the above. * modules/intprops (Files): Add lib/intprops-internal.h.
* fchmodat: Fix test failure on native Windows.Bruno Haible2022-06-221-0/+1
| | | | * modules/fchmodat (Depends-on): Add 'chmod'.
* chmod: Add tests.Bruno Haible2022-06-221-0/+13
| | | | | * tests/test-chmod.c: New file, based on tests/test-lchmod.c. * modules/chmod-tests: New file.
* chmod: New module.Bruno Haible2022-06-222-0/+34
| | | | | | | | | | | | | | * lib/sys_stat.in.h (chmod): Declare when GNULIB_CHMOD is 1. * lib/chmod.c: New file, based on lib/lchmod.c. * m4/chmod.m4: New file, based on m4/fchmodat.m4. * m4/sys_stat_h.m4 (gl_SYS_STAT_H): Test whether chmod is declared. (gl_SYS_STAT_H_REQUIRE_DEFAULTS): Initialize GNULIB_CHMOD. (gl_SYS_STAT_H_DEFAULTS): Initialize REPLACE_CHMOD. * modules/sys_stat (Makefile.am): Substitute GNULIB_CHMOD, REPLACE_CHMOD. * modules/chmod: New file, based on modules/lchmod. * doc/posix-functions/chmod.texi: Mention the new module and the problems on IRIX and Windows.
* lchmod: port back to AIX 7.2Paul Eggert2022-06-191-0/+1
| | | | | | | | | | | Problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2022-06/msg00075.html * lib/lchmod.c: Include string.h, for strlen. (lchmod): Do not depend on HAVE_READLINK since we now depend on the readlink module. Check for AIX 7.2 bug. * m4/lchmod.m4 (gl_PREREQ_LCHMOD): Do not check for readlink since we now depend on the readlink module. * modules/lchmod (Depends-on): Depend on readlink.
* fchmodat: port better to MS-Windows etc.Paul Eggert2022-06-122-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | MS-Windows problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2022-06/msg00041.html Although I don’t use MS-Windows I see some related fstatat etc. problems and am trying to fix them with this further patch. * lib/fchmodat.c (fchmodat): * lib/lchmod.c (lchmod): * lib/lchown.c (lchown) [!HAVE_LCHOWN && HAVE_CHOWN && !CHOWN_MODIFIES_SYMLINK]: * lib/renameatu.c (renameatu) [HAVE_RENAME && RENAME_TRAILING_SLASH_SOURCE_BUG]: Use readlinkat/readlink instead of fstatat/lstat to test merely whether a string names a symlink, as this avoids problems with EOVERFLOW. Also, I hope it works around the MS-Windows issues that Bruno noted. * m4/fchmodat.m4 (gl_PREREQ_FCHMODAT): Check for readlinkat, not lchmod. * m4/lchmod.m4 (gl_FUNC_LCHMOD): Do not require AC_CANONICAL_HOST or check for lstat. (gl_PREREQ_LCHMOD): Check for readlink. * modules/lchown (Depends-on): Add readlink. Do not depend on lstat merely because !HAVE_LCHOWN. * modules/renameatu (Depends-on): Add fstatat, readlinkat.
* fchmodat: port to old Linux kernel + newer headersPaul Eggert2022-06-111-1/+0
| | | | | | | | | | | | | | | | | | | | Problem reported by Lance Fredrickson in: https://lists.gnu.org/r/bug-gnulib/2022-06/msg00038.html * lib/fchmodat.c (fchmodat): * lib/lchmod.c (lchmod): Do not rely on AT_EMPTY_PATH as to whether syscalls work on ""; instead, if a call fails with ENOENT assume that those syscalls do not work. Do not use fstatat to determine whether a file is a symlink, as this has problems with EOVERFLOW. Use readlinkat instead, and if it fails with EINVAL then the file is not a symlink. Remove #if tests on __linux__ || __ANDROID__ || __CYGWIN__ as this has been a maintenance hassle and it’s unlikely these days that a new platform would #define O_PATH without also either supporting /proc or keeping it absent. * modules/fchmodat (Depends-on): Remove fstatat. There should be no need for either fchmodat or lchmod to depend on readlinkat, since they use readlinkat only in contexts where it should work without Gnulib intervention.
* fopen-gnu: Make this module work again (regression 2022-01-03).Bruno Haible2022-06-061-0/+1
| | | | | | | Reported by Nelson H. F. Beebe <beebe@math.utah.edu> in <https://lists.gnu.org/archive/html/platform-testers/2022-04/msg00005.html>. * modules/fopen-gnu (configure.ac): Invoke gl_STDIO_MODULE_INDICATOR.
* getlogin, getlogin_r tests: Avoid test failure in specific environments.Bruno Haible2022-06-062-0/+2
| | | | | | | | | | | Reported by Letu Ren <fantasquex@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2022-06/msg00001.html>. * modules/getlogin-tests (Depends-on): Add stdbool. * modules/getlogin_r-tests (Depends-on): Likewise. * tests/test-getlogin.h: Include stdbool.h. (test_getlogin_result): On Linux, skip the test if /proc/self/loginuid contains "-1".
* glob tests: Fix a warning (regression from 2022-03-23).Bruno Haible2022-05-141-0/+1
| | | | | * tests/test-glob.c: Include <fcntl.h>. * modules/glob-tests (Depends-on): Add fcntl-h.
* Say that it is not the old interfacePaul Eggert2022-05-091-0/+3
|
* glob: improve config and test cleanupPaul Eggert2022-04-281-0/+5
| | | | | | | | | | Config problem reported by Benno Schulenberg in: https://lists.gnu.org/r/bug-gnulib/2022-04/msg00071.html * m4/glob.m4 (gl_GLOB): Clean up temporary file. Also, name it conf$$-file not conf-file, so it’s cleaned up on interrupt. * modules/glob-tests (MOSTLYCLEANFILES): Append test-glob.tglobfile, test-glob.tgloblink[123].
* gettime-res: add testsPaul Eggert2022-04-191-0/+12
| | | | * modules/gettime-res-tests, tests/test-gettime-res.c: New files.
* glob: fix symlink and // issues; improve speedPaul Eggert2022-03-231-2/+3
| | | | | | | | | | | | | | | | * lib/glob.c: Include fcntl.h. (dirfd) [_LIBC]: New macro. (GLOB_STAT64, GLOB_LSTAT64): Remove. Replace all uses with ... (GLOB_FSTATAT64): ... this new macro. (glob_in_dir): Treat DT_LNK like DT_UNKNOWN. Use directory-relative fstatat unless GLOB_ALTDIRFUNC, or dirfd fails. Avoid duplicate strlen (directory). Work even if directory is "/", without turning it into "//". Use a scratch buffer instead of by-hand alloca stuff. Use mempcpy and memcpy instead of stpcpy and strcpy. * modules/glob (Depends-on): Add dirfd, fstatat. Remove stat. (License): Change from LGPLv2+ to GPL, since it depends on fstatat.
* sigsegv: Add support for Linux/PowerPC (32-bit) with musl libc.Bruno Haible2022-03-131-0/+3
| | | | | | | | | | Reported by Khem Raj <raj.khem@gmail.com> in <https://lists.gnu.org/archive/html/m4-patches/2022-03/msg00000.html>. * src/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): In the Linux/PowerPC 32-bit case, handle musl libc differently. * modules/sigsegv (Files): Add m4/musl.m4. (configure.ac): Invoke gl_MUSL_LIBC.
* statat: now obsoletePaul Eggert2022-03-094-3/+7
| | | | | | | | | * lib/openat.h (statat, lstatat): Now deprecated. All uses removed, and replaced with fstatat. * modules/statat: Mark as obsolete, because it’s confusing: it’s not clear whether it should use AT_NO_AUTOMOUNT, which is implied by stat and by lstat, but not by fstatat. * tests/test-statat.c: Disable deprecated-declarations warnings.
* modules/unicase/special-casing: Fix compilation errorDarshit Shah2022-02-251-1/+1
| | | | | | * modules/unicase/special-casing: Don't prepend $(AM_V_at) to the second part of a compound command. It causes make to try and execute the command "@sed" which doesn't exist.
* nanosleep: simplify by using pselectPaul Eggert2022-02-251-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | GNU Emacs avoids Gnulib’s ‘select’ module and uses only pselect, which it implements in a special way on MS-DOS. Unfortunately, though, nanosleep uses ‘select’; problem reported by Lars Ingebrigtsen (Bug#32452#74). As far as I can tell, Gnulib nanosleep's use of ‘select’ with signals is only for ancient platforms that Gnulib no longer cares about, so remove that use of ‘select’. I don’t know of any platforms that still need this fallback code, but just in case, fall back to pselect instead, while removing signal handling that it shouldn’t be needed nowadays. * lib/nanosleep.c: Do not include sig-handler.h, sys/time.h. (SIGCONT, suspended, sighandler, my_usleep): Remove. (nanosleep) [!HAVE_BUG_BIG_NANOSLEEP && !(_WIN32 && !__CYGWIN__)]: Just call pselect. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Do not check for sys/time.h or call gl_FUNC_SELECT. Do not include sys/time.h or worry about LIBSOCKET. (gl_PREREQ_NANOSLEEP): Remove as it’s no longer needed. All uses removed. * modules/nanosleep (Depends-on): Add pselect. Remove select, sigaction, sys_time.
* close-stream: don't depend on fclosePaul Eggert2022-02-211-1/+0
| | | | | | | | This reverts 2022-01-26T17:33:03Z!eggert@cs.ucla.edu. Depending on fclose broke Emacs, and since this dependency didn't help GNU m4 let's remove it for now. Problem reported by Lars Ingebrigtsen <https://bugs.gnu.org/32452#47>. * modules/close-stream (Depends-on): Remove fclose.
* filevercmp: fix several unexpected resultsPaul Eggert2022-02-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problems reported by Michael Debertol in <https://bugs.gnu.org/49239>. While looking into this, I spotted some more areas where the code and documentation did not agree, or where the documentation was unclear. The biggest change needed by coreutils is a new function filenvercmp that can compare byte strings containing NUL. * lib/filevercmp.c: Do not include sys/types.h, stdlib.h, string.h. Include idx.h, verify.h. (match_suffix): Remove, replacing all uses with calls to ... (file_prefixlen): ... this new function. Simplify it by avoiding the need for a confusing READ_ALPHA state variable. Change its API to something more useful, with a *LEN arg. it with a new *LEN arg. (file_prefixlen, verrevcmp): Prefer idx_t to size_t where either will do. (order): Change args to S, POS, LEN instead of just S[POS]. This lets us handle NUL bytes correctly. Callers changed. Verify that ints are sufficiently wide for its API. (verrevcmp): Don't assume that S1[S1_LEN] is a non-digit, and likewise for S2[S2_LEN]. The byte might not be accessible if filenvercmp is being called. (filevercmp): Reimplement by calling filenvercmp. (filenvercmp): New function, rewritten without the assumption that the inputs are null-terminated. Remove "easy comparison to see if strings are identical", as the use of it later (a) was undocumented, and (b) caused sort -V to be unstable. When both strings start with ".", do not skip past the "."s before looking for suffixes, as this disagreed with the documentation. * lib/filevercmp.h: Fix comments, which had many mistakes. (filenvercmp): New decl. * modules/filevercmp (Depends-on): Add idx, verify. Remove string. * tests/test-filevercmp.c: Include string.h. (examples): Reorder examples ".0" and ".9" that matched the code but not the documentation. The code has been fixed to match the documentation. Add some examples involving \1 so that they can be tried with both \1 and \0. Add some other examples taken from the bug report. (equals): New set of test cases. (sign, test_filevercmp): New functions. (main): Remove test case where the fixed filevercmp disagrees with strverscmp. Use test_filevercmp instead of filevercmp, so that we also test filenvercmp. Test the newly-introduced EQUALS cases.
* unictype/category-byname: Fix test failure.Bruno Haible2022-02-091-1/+1
| | | | | * modules/unictype/category-byname (configure.ac): Bump required libunistring version.
* termcap, termcap-h: Deprecate.Bruno Haible2022-02-062-0/+14
| | | | | * modules/termcap (Status, Notice): Add deprecation. * modules/termcap-h (Status, Notice): Likewise.
* terminfo: Add tests.Bruno Haible2022-01-301-0/+13
| | | | | * tests/test-terminfo.c: New file. * modules/terminfo-tests: New file.
* terminfo, terminfo-h: New modules.Bruno Haible2022-01-302-0/+50
| | | | | | | * lib/terminfo.h: New file, from GNU gettext. * m4/terminfo.m4: New file, from GNU gettext. * modules/terminfo: New file, from GNU gettext. * modules/terminfo-h: New file, from GNU gettext.
* termcap: Add tests.Bruno Haible2022-01-301-0/+13
| | | | | * tests/test-termcap.c: New file. * modules/termcap-tests: New file.
* termcap, termcap-h: New modules.Bruno Haible2022-01-302-0/+50
| | | | | | | | | | * lib/termcap.h: New file, from GNU gettext. * lib/tparm.c: New file, from GNU gettext. * lib/tputs.c: New file, from GNU gettext. * m4/termcap.m4: New file, from GNU gettext. * m4/curses.m4: New file, from GNU gettext. * modules/termcap: New file, from GNU gettext. * modules/termcap-h: New file, from GNU gettext.