From 9907004a1bb047e0644bf6d180aeb8b6ac23b1bb Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 2 Oct 2023 12:57:26 -0400 Subject: tests: Don't cd into paths longer than PATH_MAX This fixes a warning on at least Alpine Linux that looks like cd: error retrieving current directory: getcwd: cannot access parent directories: Filename too long --- tests/tests.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/tests.sh b/tests/tests.sh index 66a79a8..121cd85 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -393,18 +393,14 @@ function make_deep() { local names="$name/$name/$name/$name" for i in {0..9} A B C D E F; do - ( - mkdir "$1/$i" - cd "$1/$i" - - # 4 * 1024 == 4096 == PATH_MAX - for _ in {1..4}; do - mkdir -p "$names" - cd "$names" - done - - "$XTOUCH" "$name" - ) + "$XTOUCH" -p "$1/$i/$name" + + # 4 * 1024 == 4096 == PATH_MAX + for _ in {1..4}; do + mv "$1/$i/$name" "$1/" + mkdir -p "$1/$i/$names" + mv "$1/$name" "$1/$i/$names/" + done done } make_deep "$TMP/deep" -- cgit v1.2.3