diff mbox series

[3/8] shared/298: fix random deletion when filenames contain spaces

Message ID 162561728342.543423.12599584091972556414.stgit@locust (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong July 7, 2021, 12:21 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Correct the deletion loop in this test to work properly when there are
files in $here that have spaces in their name.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/shared/298 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Allison Henderson July 9, 2021, 11:39 p.m. UTC | #1
On 7/6/21 5:21 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Correct the deletion loop in this test to work properly when there are
> files in $here that have spaces in their name.
> 
Looks ok
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>

> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>   tests/shared/298 |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> diff --git a/tests/shared/298 b/tests/shared/298
> index 981a4dfc..bd52b6a0 100755
> --- a/tests/shared/298
> +++ b/tests/shared/298
> @@ -163,7 +163,7 @@ get_holes $img_file > $fiemap_ref
>   
>   # Delete some files
>   find $loop_mnt -type f -print | $AWK_PROG \
> -	'BEGIN {srand()}; {if(rand() > 0.7) print $1;}' | xargs rm
> +	'BEGIN {srand()}; {if(rand() > 0.7) printf("%s\0", $0);}' | xargs -0 rm
>   echo "done."
>   
>   echo -n "Running fstrim..."
>
diff mbox series

Patch

diff --git a/tests/shared/298 b/tests/shared/298
index 981a4dfc..bd52b6a0 100755
--- a/tests/shared/298
+++ b/tests/shared/298
@@ -163,7 +163,7 @@  get_holes $img_file > $fiemap_ref
 
 # Delete some files
 find $loop_mnt -type f -print | $AWK_PROG \
-	'BEGIN {srand()}; {if(rand() > 0.7) print $1;}' | xargs rm
+	'BEGIN {srand()}; {if(rand() > 0.7) printf("%s\0", $0);}' | xargs -0 rm
 echo "done."
 
 echo -n "Running fstrim..."