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

Darrick J. Wong
2021-10-11T16:36:29Z

On Mon, Oct 11, 2021 at 10:06:59AM +1100, Dave Chinner wrote:
> 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>

Oops, sorry I didn't catch this.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> 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
>