]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (cramfs) restore umask after creating test input files
authorLeonid Znamenok <respublica@altlinux.org>
Tue, 19 May 2026 18:41:57 +0000 (22:41 +0400)
committerLeonid Znamenok <respublica@altlinux.org>
Tue, 19 May 2026 18:41:57 +0000 (22:41 +0400)
The cramfs doubles/mkfs/mkfs-endianness tests set "umask 133" to get
deterministic permission bits on the test input files. The umask was
never restored, so it stayed in effect for every command run later in
the test, including the build-tree mount/umount/mkfs.cramfs helpers.

When such a helper is a libtool wrapper script that has to relink its
real binary on first use (fast_install=yes), the relink runs under the
leaked umask 133 and the resulting .libs/lt-* binary is created without
execute bits (mode 0644). The wrapper then fails to exec it with
"Permission denied" (EACCES). Because the broken binary is cached, every
subsequent test using that helper fails as well:

exec: .../.libs/lt-mount: cannot execute: Permission denied

Save and restore the umask so it only covers creation of the test input
files and does not affect helper invocations.

tests/ts/cramfs/doubles
tests/ts/cramfs/mkfs
tests/ts/cramfs/mkfs-endianness

index dfb3ab5eaa496fe2aa60ddfceb1158f9114d6311..5d618b429dd6dce5010d6d0a3aeac5e2fd84349c 100755 (executable)
@@ -39,11 +39,14 @@ ts_log "create mountpoint dir"
 rm -rf "$IMAGE_SRC"
 mkdir -m 755 -p $IMAGE_SRC
 
+umask_saved=$(umask)
 umask 133
 
 echo hello > $IMAGE_SRC/a
 echo hello > $IMAGE_SRC/b
 
+umask "$umask_saved"
+
 # sudo may use whatever group
 chgrp -R 0 "$IMAGE_SRC"
 
index 7cffb535f08a79620f749099b0e93975a37d1435..407a5ec4cb151bc8db8e3c67c2f841d9ebfd7c35 100755 (executable)
@@ -61,6 +61,7 @@ ts_log "generate data"
 rm -rf "$IMAGE_SRC"
 mkdir -m 755 -p $IMAGE_SRC
 
+umask_saved=$(umask)
 umask 133
 
 for d in `seq 0 110`; do
@@ -72,6 +73,8 @@ for d in `seq 0 110`; do
        done
 done
 
+umask "$umask_saved"
+
 chgrp -R 0 "$IMAGE_SRC"
 
 ts_cd "$IMAGE_SRC"
index 15bda7aa7cefcf86599cf41c88d54fe6c2d82ee4..7e87fc1a50e9c58d8ef4a211dbc48a5be8326740 100755 (executable)
@@ -29,6 +29,7 @@ ts_skip_nonroot
 IMAGE_DATA="$TS_OUTDIR/${TS_TESTNAME}-data"
 IMAGE_CREATED="$TS_OUTDIR/${TS_TESTNAME}-cramfs.img"   #Image created during the test and compared against the known images.
 
+umask_saved=$(umask)
 umask 133
 
 test_image() {
@@ -55,6 +56,8 @@ cp $TS_SELF/mkfs-endianness_testdata_b $IMAGE_DATA/dirA/dirB/b
 # sudo may use whatever group
 chgrp -R 0 $IMAGE_DATA
 
+umask "$umask_saved"
+
 #perform tests for both endians
 test_image "little"
 test_image "big"