Skip to contentSkip to conversation

xfstests-bld: correct file permissions on test appliance files

PATCH Superseded Eric Biggers 1 participant 2 messages Dec 28, 2016 – Jan 5, 2017

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xfstests-bld: correct file permissions on test appliance files

From: Eric Biggers <[email protected]>

The xfstests-bld repository may have been cloned with a umask that masked out the group and/or the other bits. When using --update-files in this situation or when creating a GCE image, the VM ended up in a state where non-root users were unable to execute anything, which made all tests using the fsgqa user get skipped. Fix this by copying the r and x user bits to the group and other bits when creating files.tar.gz. Also set the owner and group to root while we're at it.

Note that git doesn't actually store file owners, groups, or any mode bits other than "is the file executable"? So this patch really just enforces a consistent, sane default for this "unstored" metadata.

---
 gen-tarball                                  | 2 +-
 kvm-xfstests/gce-xfstests                    | 3 ++-
 kvm-xfstests/kvm-xfstests                    | 3 ++-
 kvm-xfstests/test-appliance/gce-create-image | 3 ++-
 4 files changed, 7 insertions(+), 4 deletions(-)
gen-tarball +1 -1
index 2626996..2c5229a 100755
@@ -50,5 +50,5 @@ cp bld/lib/client.txt xfstests/lib
 echo "STRIP xfstests/*"
 find xfstests -mindepth 2 -type f -perm /0111 | xargs $STRIP 2> /dev/null
 echo "TAR xfstests"
-tar c --owner=root --group=root --mode=o+g-w xfstests | \
+tar c --owner=root --group=root --mode=go+u-w xfstests | \
 	$GZIP -9 > xfstests.tar.gz
kvm-xfstests/gce-xfstests +2 -1
index 4553792..084b30c 100755
@@ -456,7 +456,8 @@ then
 	exit 1
     fi
     (cd "$DIR/test-appliance"; \
-     tar -X gce-exclude-files --exclude=etc -C files -cf - . | \
+     tar -X gce-exclude-files --exclude=etc -C files \
+		--owner=root --group=root --mode=go+u-w -cf - . | \
 	 gzip -9n > $LOCAL_FILES)
     get_local_hash "$LOCAL_FILES"
     get_remote_hash "$GS_FILES"
kvm-xfstests/kvm-xfstests +2 -1
index fbdae7a..40c3632 100755
@@ -75,7 +75,8 @@ then
 	exit 1
     fi
     (cd "$DIR/test-appliance"; \
-     tar -X kvm-exclude-files -C files -cf - . | \
+     tar -X kvm-exclude-files -C files \
+		--owner=root --group=root --mode=go+u-w -cf - . | \
 	 gzip -9n > "$TDIR/files.tar.gz")
     tar -r -f $VDH -C "$TDIR" files.tar.gz
     rm -rf "$TDIR"
kvm-xfstests/test-appliance/gce-create-image +2 -1
index 56366d1..a901476 100755
@@ -87,7 +87,8 @@ then
     cat ../../*.ver > files/root/xfstests/git-versions
 fi
 
-tar -X gce-exclude-files -C files -cf - . | gzip -9n > $t
+tar -X gce-exclude-files -C files --owner=root --group=root --mode=go+u-w \
+	-cf - . | gzip -9n > $t
 GS_FILES_TARBALL=gs://$GS_BUCKET/files.tar.gz
 
 if test -f files/root/xfstests/git-versions
Signature · 1 line
2.11.0
#1 lore raw
Quoted 10 lines · Eric Biggers

From: Eric Biggers <[email protected]>

The xfstests-bld repository may have been cloned with a umask that masked out the group and/or the other bits. When using --update-files in this situation or when creating a GCE image, the VM ended up in a state where non-root users were unable to execute anything, which made all tests using the fsgqa user get skipped. Fix this by copying the r and x user bits to the group and other bits when creating files.tar.gz. Also set the owner and group to root while we're at it.

Quoted 5 lines

Note that git doesn't actually store file owners, groups, or any mode bits other than "is the file executable"? So this patch really just enforces a consistent, sane default for this "unstored" metadata.

As it turns out, update_xfstests() in kvm-xfstests/test-appliance/gen-image also needs to be updated. (I'm not sure why it wasn't a problem for me before.) So I'll send yet another version of this patch.

Eric