mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 22:53:35 +00:00
btrfs-progs: tests: use SUDO_HELPER in convert tests for temp files
While running make test-convert as a normal user I ran into this problem where we do sudo find <blah> into a mktemp file that's created as the normal user. This results in find getting a EPERM while trying to mess with that temp file. Fix this by using $SUDO_HELPER for all the tempfile manipulations so that root is the owner of everything, which allows the convert tests to run as a normal user. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
78e5887fea
commit
4c078a8536
@ -113,32 +113,32 @@ convert_test_perm() {
|
||||
|
||||
_assert_path "$1"
|
||||
PERMTMP="$1"
|
||||
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
|
||||
FILES_LIST=$($SUDO_HELPER mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
|
||||
|
||||
run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/test" "bs=$nodesize" \
|
||||
count=1 status=noxfer >/dev/null 2>&1
|
||||
run_check_stdout $SUDO_HELPER find "$TEST_MNT" -type f ! -name 'image' -fprint "$FILES_LIST"
|
||||
# Fix directory entries order
|
||||
sort "$FILES_LIST" -o "$FILES_LIST"
|
||||
for file in `cat "$FILES_LIST"` ;do
|
||||
$SUDO_HELPER sort "$FILES_LIST" -o "$FILES_LIST"
|
||||
for file in `$SUDO_HELPER cat "$FILES_LIST"` ;do
|
||||
run_check_stdout $SUDO_HELPER getfacl --absolute-names "$file" >> "$PERMTMP"
|
||||
done
|
||||
rm -- "$FILES_LIST"
|
||||
$SUDO_HELPER rm -- "$FILES_LIST"
|
||||
}
|
||||
# list acls of files on $TEST_MNT
|
||||
# $1: path where the acls will be stored
|
||||
convert_test_acl() {
|
||||
local ACLSTMP
|
||||
ACLTMP="$1"
|
||||
FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
|
||||
FILES_LIST=$($SUDO_HELPER mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
|
||||
|
||||
run_check_stdout $SUDO_HELPER find "$TEST_MNT/acls" -type f -fprint "$FILES_LIST"
|
||||
# Fix directory entries order
|
||||
sort "$FILES_LIST" -o "$FILES_LIST"
|
||||
for file in `cat "$FILES_LIST"`;do
|
||||
$SUDO_HELPER sort "$FILES_LIST" -o "$FILES_LIST"
|
||||
for file in `$SUDO_HELPER cat "$FILES_LIST"`;do
|
||||
run_check_stdout $SUDO_HELPER getfattr --absolute-names -d "$file" >> "$ACLTMP"
|
||||
done
|
||||
rm -- "$FILES_LIST"
|
||||
$SUDO_HELPER rm -- "$FILES_LIST"
|
||||
}
|
||||
|
||||
# do conversion with given features and nodesize, fsck afterwards
|
||||
|
Loading…
Reference in New Issue
Block a user