From 3c3e3d2096bdee401ae04aa2bbc375d68e4aeedc Mon Sep 17 00:00:00 2001 From: Stack Date: Mon, 21 Nov 2022 15:11:26 -0600 Subject: [PATCH] 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. --- func/core/pkg_cpio/10-cpio.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/func/core/pkg_cpio/10-cpio.sh b/func/core/pkg_cpio/10-cpio.sh index 77382a9..685eaf3 100755 --- a/func/core/pkg_cpio/10-cpio.sh +++ b/func/core/pkg_cpio/10-cpio.sh @@ -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"