[PATCH 2/2] fstests: groupfile generation needs force overwrite

Dave Chinner
2021-10-10T23:07:05Z

From: Dave Chinner <dchinner@redhat.com>

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>
---
tools/mkgroupfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/mkgroupfile b/tools/mkgroupfile
index 634ec92c..3844e57d 100755
--- a/tools/mkgroupfile
+++ b/tools/mkgroupfile
@@ -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
--
2.33.0