logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

pathchk.t (1661B)


  1. #!/usr/bin/env cram
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. $ export PATH="$TESTDIR/../cmd:$PATH"
  5. $ test "$(command -v pathchk)" = "$TESTDIR/../cmd/pathchk"
  6. Thanks glibc for the broken getconf
  7. $ POSIX_NAME_MAX=$(getconf _POSIX_NAME_MAX 2>/dev/null || echo 14)
  8. $ POSIX_PATH_MAX=$(getconf _POSIX_PATH_MAX 2>/dev/null || echo 256)
  9. $ pathchk "$(printf "foo/%*s/bar" "$(getconf NAME_MAX "$PWD")" | tr ' ' _)"
  10. $ pathchk "$(printf "foo/s%*s/bar" "$(getconf NAME_MAX "$PWD")" | tr ' ' _)"
  11. pathchk: Path component \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s_+ (re)
  12. [1]
  13. $ pathchk -p "$(printf "foo/%*s/bar" "${POSIX_NAME_MAX}" | tr ' ' _)"
  14. $ pathchk -p "$(printf "foo/s%*s/bar" "${POSIX_NAME_MAX}" | tr ' ' _)"
  15. pathchk: Path component \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s_+ (re)
  16. [1]
  17. $ pathchk "$(printf "s%*s" "$(getconf PATH_MAX "$PWD")" | tr ' ' /)"
  18. pathchk: Path \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s/+ (re)
  19. [1]
  20. $ pathchk -p "$(printf "%*s" "${POSIX_PATH_MAX}" | tr ' ' /)"
  21. $ pathchk -p "$(printf "s%*s" "${POSIX_PATH_MAX}" | tr ' ' /)"
  22. pathchk: Path \([0-9]+ octets\) is over the maximum size \([0-9]+ octets\): s/+ (re)
  23. [1]
  24. $ pathchk /dev/null/foo
  25. $ pathchk /../foo
  26. $ pathchk -P ./-foo
  27. pathchk: Path component starts with an hyphen: -foo
  28. [1]
  29. $ pathchk -P ./bar/-foo
  30. pathchk: Path component starts with an hyphen: -foo
  31. [1]
  32. $ pathchk -p "foo$(printf '\01')bar"
  33. pathchk: Error non-portable character '\x01' (0x01) found in: foo\x01bar (esc)
  34. [1]