mirror of
https://github.com/xroche/httrack.git
synced 2026-06-29 05:26:32 +03:00
The test scripts mostly ran with no error flags, so a failing command in
the middle would be ignored and the script would limp on to a misleading
result. Turn on strict mode everywhere, guarding the spots that legitimately
expect a non-zero exit:
- the htssafe overflow probes (-#8) deliberately abort, and the strsafe/
cmdline crawls capture an exit code to assert on, so those are run with
`|| true` / `|| rc=$?` rather than letting set -e kill the script first;
- the parser fixture crawl ignores httrack's own exit (it checks the mirrored
files), so it keeps `|| true`;
- 02_update-cache replaced `find ... | grep -q .` with a `-print -quit`
command substitution: under pipefail grep -q can close the pipe early and
leave find killed by SIGPIPE, which would spuriously fail an existing file;
- 12_crawl_https guards $HTTPS_SUPPORT with `${...:-}` for set -u.
02_manpage-regen and 01_engine-cache stay on `set -eu` (no pipefail): both are
run via $(BASH), which can be a plain POSIX /bin/sh where `set -o pipefail`
does not exist.
shellcheck clean; make check: 15 PASS, 7 SKIP (offline).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
29 lines
718 B
Bash
Executable File
29 lines
718 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
# path simplify engine (fil_simplifie): collapses ./ and ../ segments.
|
|
simp() {
|
|
test "$(httrack -O /dev/null -#1 "$1")" == "simplified=$2" || exit 1
|
|
}
|
|
|
|
simp './foo/bar/' 'foo/bar/'
|
|
simp './foo/bar' 'foo/bar'
|
|
simp './foo/./bar' 'foo/bar'
|
|
simp './foo/bar/.././tmp/foobar' 'foo/tmp/foobar'
|
|
simp './foo/bar/.././tmp/foobar/../foobaz' 'foo/tmp/foobaz'
|
|
|
|
# single '..' collapses one segment
|
|
simp './a/../b' 'b'
|
|
simp './a/b/../../c' 'c'
|
|
|
|
# repeated './' is squeezed
|
|
simp './a/./././b' 'a/b'
|
|
|
|
# leading '..' that would go above the root is discarded, per RFC 3986 §5.2.4
|
|
simp './a/../../b' 'b'
|
|
|
|
# empty segments ('//') are not dot-segments and are preserved, per RFC 3986
|
|
simp 'a//b' 'a//b'
|