summary refs log tree commit diff
path: root/lib/path
diff options
context:
space:
mode:
authorSilvan Mosberger <silvan.mosberger@tweag.io>2023-01-10 14:18:35 +0100
committerSilvan Mosberger <silvan.mosberger@tweag.io>2023-01-10 14:18:35 +0100
commit041b044a663a52e1c885c00496b44c5ba5982597 (patch)
tree78006e6e206200c47a704b25557d4bfcdaf684ed /lib/path
parentb326f62dcf5713f1d10b4c03da36dfa06ee7a72d (diff)
downloadnixpkgs-041b044a663a52e1c885c00496b44c5ba5982597.tar
nixpkgs-041b044a663a52e1c885c00496b44c5ba5982597.tar.gz
nixpkgs-041b044a663a52e1c885c00496b44c5ba5982597.tar.bz2
nixpkgs-041b044a663a52e1c885c00496b44c5ba5982597.tar.lz
nixpkgs-041b044a663a52e1c885c00496b44c5ba5982597.tar.xz
nixpkgs-041b044a663a52e1c885c00496b44c5ba5982597.tar.zst
nixpkgs-041b044a663a52e1c885c00496b44c5ba5982597.zip
lib/path/tests: Fix property tests when "-n" is generated
When "-n" is generated by the property tests, it causes `echo` to not
output the string since it's interpreted as an option. Apparently
there's no good way to print "-n" with `echo` [1], so switching to
`printf` instead

[1]: https://unix.stackexchange.com/questions/85846/how-can-i-print-n-with-echo
Diffstat (limited to 'lib/path')
-rwxr-xr-xlib/path/tests/prop.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/path/tests/prop.sh b/lib/path/tests/prop.sh
index c956e55bbfa..e48c6667fa0 100755
--- a/lib/path/tests/prop.sh
+++ b/lib/path/tests/prop.sh
@@ -55,7 +55,7 @@ fi
 declare -a strings=()
 mkdir -p "$tmp/strings"
 while IFS= read -r -d $'\0' str; do
-    echo -n "$str" > "$tmp/strings/${#strings[@]}"
+    printf "%s" "$str" > "$tmp/strings/${#strings[@]}"
     strings+=("$str")
 done < <(awk \
     -f "$SCRIPT_DIR"/generate.awk \