pathchk.t (1661B)
- #!/usr/bin/env cram
- # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- $ export PATH="$TESTDIR/../cmd:$PATH"
- $ test "$(command -v pathchk)" = "$TESTDIR/../cmd/pathchk"
- Thanks glibc for the broken getconf
- $ POSIX_NAME_MAX=$(getconf _POSIX_NAME_MAX 2>/dev/null || echo 14)
- $ POSIX_PATH_MAX=$(getconf _POSIX_PATH_MAX 2>/dev/null || echo 256)
- $ pathchk "$(printf "foo/%*s/bar" "$(getconf NAME_MAX "$PWD")" | tr ' ' _)"
- $ pathchk "$(printf "foo/s%*s/bar" "$(getconf NAME_MAX "$PWD")" | tr ' ' _)"
- pathchk: Path component \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s_+ (re)
- [1]
- $ pathchk -p "$(printf "foo/%*s/bar" "${POSIX_NAME_MAX}" | tr ' ' _)"
- $ pathchk -p "$(printf "foo/s%*s/bar" "${POSIX_NAME_MAX}" | tr ' ' _)"
- pathchk: Path component \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s_+ (re)
- [1]
- $ pathchk "$(printf "s%*s" "$(getconf PATH_MAX "$PWD")" | tr ' ' /)"
- pathchk: Path \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s/+ (re)
- [1]
- $ pathchk -p "$(printf "%*s" "${POSIX_PATH_MAX}" | tr ' ' /)"
- $ pathchk -p "$(printf "s%*s" "${POSIX_PATH_MAX}" | tr ' ' /)"
- pathchk: Path \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s/+ (re)
- [1]
- $ pathchk /dev/null/foo
- $ pathchk /../foo
- $ pathchk -P ./-foo
- pathchk: Path component starts with an hyphen: -foo
- [1]
- $ pathchk -P ./bar/-foo
- pathchk: Path component starts with an hyphen: -foo
- [1]
- $ pathchk -p "foo$(printf '\01')bar"
- pathchk: Error non-portable character '\x01' (0x01) found in: foo\x01bar (esc)
- [1]