Skip to content

Commit

Permalink
Avoid subshell hiding failure report from testfilestats
Browse files Browse the repository at this point in the history
We remove the working directory from the found file names as these paths
could contain a lot of funny characters confusing the for loop like
spaces… we just readd it later in the actual calls to be safe.
  • Loading branch information
DonKult committed Mar 30, 2024
1 parent db79731 commit 0185347
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/integration/framework
Original file line number Diff line number Diff line change
Expand Up @@ -2094,11 +2094,12 @@ testfilestats() {
else
local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output"
{
echo
ls -ld "$1" || true
echo -n "stat(1) reports for $2: "
stat --format "$2" "$1" || true
} >"$OUTPUT" 2>&1
msgfailoutput '' "$OUTPUT"
msgfailoutput '' "$OUTPUT" stat --format "$2" "$1"
fi
msggroup
}
Expand Down Expand Up @@ -2261,8 +2262,8 @@ aptautotest_aptget_update() {
# all copied files are properly chmodded
local backupIFS="$IFS"
IFS="$(printf "\n\b")"
cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | while read file; do
testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do
testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
done
IFS="$backupIFS"
if [ "$TESTCALL" = 'testsuccess' ]; then
Expand Down

0 comments on commit 0185347

Please sign in to comment.