Re: [PATCH 5/6] canonicalize: prefer signed integer types

2020-12-02 Thread Bruno Haible
Hi Paul, > (seen_triple, canonicalize_filename_mode): Prefer signed to > unsigned types where either will do, as they avoid some glitches > in comparisons and can trap on overflow when debugging. Please, please, can we have typedef names for these signed types that are supposed to only have value

[PATCH 4/6] canonicalize: fix most of another EOVERFLOW issue

2020-12-02 Thread Paul Eggert
* lib/canonicalize.c (canonicalize_filename_mode): Do not call stat if fewer than 20 symlinks have been traversed. This avoids EOVERFLOW failure in the common case where there are not that many symlinks, while continuing to catch loops (or fail due to EOVERFLOW) in the unusual case when there are m

[PATCH 2/6] canonicalize: fix EOVERFLOW bug

2020-12-02 Thread Paul Eggert
* lib/canonicalize.c (canonicalize_filename_mode): When testing whether a directory entry is a symbolic link, or a directory or other, do not use lstat or stat or areadlink_with_size. Just use areadlink, as this suffices and it avoids the EOVERFLOW problem that lstat and stat have. * modules/canon

[PATCH 6/6] canonicalize: refactor can_mode flag

2020-12-02 Thread Paul Eggert
* lib/canonicalize.c (MULTIPLE_BITS_SET): Remove, replacing with ... (multiple_bits_set): ... this new static function. Uses changed. (canonicalize_filename_mode): Refactor for clarity to avoid modifying the CAN_MODE argument. --- ChangeLog | 6 ++ lib/canonicalize.c | 24 ++

[PATCH 5/6] canonicalize: prefer signed integer types

2020-12-02 Thread Paul Eggert
* lib/canonicalize.c: Include stddef.h, for ptrdiff_t. (seen_triple, canonicalize_filename_mode): Prefer signed to unsigned types where either will do, as they avoid some glitches in comparisons and can trap on overflow when debugging. --- ChangeLog | 6 ++ lib/canonicalize.c | 21 ++

[PATCH 1/6] canonicalize-lgpl: fix EOVERFLOW bug

2020-12-02 Thread Paul Eggert
* lib/canonicalize-lgpl.c: Do not include . (__realpath): Do not use lstat. Just use readlink, as this suffices and it avoids the EOVERFLOW problem that lstat has. * modules/canonicalize-lgpl (Depends-on): Remove lstat, sys_stat. --- ChangeLog | 8 +++ lib/canonicalize-lgpl.c

[PATCH 3/6] canonicalize: do not assume symlinks have st_ino

2020-12-02 Thread Paul Eggert
* lib/canonicalize.c (canonicalize_filename_mode): When checking for loops, use st_dev and st_ino from the parent directory not from the symlink, as pre-2017 POSIX says these members are not reliable for symlinks. Couple this with START (the remaining file name to be resolved), not NAME (the whole

Re: strsignal on macOS

2020-12-02 Thread Bruno Haible
Martin Storsjö wrote: > FAIL: test-strsignal The cause is that strsignal (SIGHUP) here is "Hangup 1", not just "Hangup". This patch fixes the test. 2020-12-02 Bruno Haible strsignal-tests: Fix test failure on macOS 10.13. Reported by Martin Storsjö in

Fix compilation errors in test-math-c++.cc on FreeBSD 12.2/arm64

2020-12-02 Thread Bruno Haible
On FreeBSD 12.2/arm64, when compiling a testdir of the POSIX modules with C++ tests included, I get compilation errors in test-math-c++.cc. The error flood starts with In file included from ../../gltests/test-math-c++.cc:22: In file included from ../gllib/math.h:27: In file included from /usr/incl

Re: Issues with posix functions on modern macOS/Xcode

2020-12-02 Thread Bruno Haible
Hi Martin, > On macOS 10.15.7 (Catalina) on x86_64, both with Xcode 11.7 and 12.2, the > following tests fail: > > FAIL: test-fprintf-posix3.sh > FAIL: test-futimens > FAIL: test-renameat > FAIL: test-renameatu > FAIL: test-strsignal > FAIL: test-utime > FAIL: test-utimens > FAIL: test-utimensat

execute, spawn-pipe: Allow caller to specify directory for the subprocess

2020-12-02 Thread Bruno Haible
It has been noted [1] that when spawning a child process, it is useful to be able to specify in which directory to execute this child process. The "obvious" solution, to do a chdir() before spawning the child process and chdir() or fchdir() back afterwards, has two drawbacks: - It is not multith