fstests: groupfile generation needs force overwrite
authorDave Chinner <dchinner@redhat.com>
Sun, 10 Oct 2021 23:06:59 +0000 (10:06 +1100)
committerEryu Guan <guaneryu@gmail.com>
Sun, 24 Oct 2021 13:25:36 +0000 (21:25 +0800)
Having built fstests as root as part of a run script, I get failures
then trying to run it as a user because of the group list
generation. The issue occurs because the group list files are owned
by root, and so I get an interactive prompt to overwrite them such
as:

Building btrfs
 [GROUP] /home/dave/src/xfstests-dev/tests/btrfs/group.list
mv: replace 'group.list', overriding mode 0644 (rw-r--r--)? y
Building ceph
 [GROUP] /home/dave/src/xfstests-dev/tests/ceph/group.list
mv: replace 'group.list', overriding mode 0644 (rw-r--r--)? y
Building cifs
 [GROUP] /home/dave/src/xfstests-dev/tests/cifs/group.list
mv: replace 'group.list', overriding mode 0644 (rw-r--r--)? y
Building ext4
 [GROUP] /home/dave/src/xfstests-dev/tests/ext4/group.list
...

Use 'mv -f' to ignore such trivial issues so that the new group
lists are written correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tools/mkgroupfile

index 634ec92cdd6a8340676d21ae8a48424403add39c..3844e57d334a34337ab64cfd200aead8c8f7e34c 100755 (executable)
@@ -24,7 +24,7 @@ cleanup() {
        test -z "$ngroupfile" && return
 
        if [ $ret -eq 0 ]; then
-               mv "$ngroupfile" "$groupfile"
+               mv -f "$ngroupfile" "$groupfile"
        else
                rm -f "$ngroupfile"
        fi