Fix error when /tmp is empty; ls is not always a good way to pipe into cpio because cpio does not know how to deal with things like symlinks and empty directories very well so switched to find.

This commit is contained in:
Chris Stackpole 2022-11-21 15:11:26 -06:00
parent d58f252e70
commit 3c3e3d2096
Signed by untrusted user: stack
GPG Key ID: 8B8BF0341BB1A1D5
1 changed files with 3 additions and 1 deletions

View File

@ -11,8 +11,10 @@ PASSER=/var/tmp/cpio/pass
r_log "cpio" "Test basic copy out"
mkdir -p "$OUTTER" "$INNER" "$PASSER"
# Ensure at least one file exists in /tmp to prevent errors.
echo 1 > $(mktemp)
# shellcheck disable=2012
ls /tmp | cpio -o > "$OUTTER"/cpio.out
find /tmp -type f | cpio -o > "$OUTTER"/cpio.out 2> /dev/null
r_checkExitStatus $?
r_log "cpio" "Test basic copy in"