The permissions output from ls(1) is not portable. The output
contains '.' when SELinux context is enabled for the directory.
stat(1) also provides full control over formatting, so we do not need to
parse ls(1) output.
Signed-off-by: Karel Zak <kzak@redhat.com>
ts_check_losetup
ts_check_prog "mkfs.ext2"
ts_check_prog "id"
-ts_check_prog "ls"
+ts_check_prog "stat"
do_one() {
what="$1"; shift
where="$1"; shift
$TS_CMD_MOUNT "$@" "$what" "$where" >> $TS_OUTPUT 2>> $TS_ERRLOG
- read -r m _ o g _ < <(ls -nd "$where")
- actual="$m $o $g"
+ actual=$(stat --format="%A %u %g" "$where")
[ "$actual" = "$expected" ] || echo "$*: $actual != $expected" >> $TS_ERRLOG
$TS_CMD_UMOUNT "$where" >> $TS_OUTPUT 2>> $TS_ERRLOG
}