diff mbox series

[2/2] generic: 448 shouldn't delete $BASE_TEST_FILE if it isn't set yet

Message ID 20191018173343.303032-2-Anna.Schumaker@Netapp.com (mailing list archive)
State New, archived
Headers show
Series [1/2] generic: Create new outfile for 035 over NFS | expand

Commit Message

Anna Schumaker Oct. 18, 2019, 5:33 p.m. UTC
From: Anna Schumaker <Anna.Schumaker@Netapp.com>

NFS v4.2 supports SEEK_DATA and SEEK_HOLE, but earlier versions do not.
As a result, the test exits and runs the cleanup function without the
$BASE_TEST_FILE variable set and the shell expands it to "rm -f .*",
deleting all hidden files in the current directory.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 tests/generic/448 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eryu Guan Oct. 20, 2019, 1:50 p.m. UTC | #1
On Fri, Oct 18, 2019 at 01:33:43PM -0400, schumaker.anna@gmail.com wrote:
> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> 
> NFS v4.2 supports SEEK_DATA and SEEK_HOLE, but earlier versions do not.
> As a result, the test exits and runs the cleanup function without the
> $BASE_TEST_FILE variable set and the shell expands it to "rm -f .*",
> deleting all hidden files in the current directory.
> 
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
>  tests/generic/448 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/448 b/tests/generic/448
> index dada499b..d6cdebbf 100755
> --- a/tests/generic/448
> +++ b/tests/generic/448
> @@ -17,7 +17,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  _cleanup()
>  {
> -	rm -f $tmp.* $BASE_TEST_FILE.*
> +	rm -f $tmp.*
> +	[ ! -z $BASE_TEST_FILE ] && rm -f $BASE_TEST_FILE.*
>  }

I'd just define BASE_TEST_FILE before _cleanup (and did it on commit).
Thanks for the fix!

Eryu
>  
>  # get standard environment, filters and checks
> -- 
> 2.23.0
>
diff mbox series

Patch

diff --git a/tests/generic/448 b/tests/generic/448
index dada499b..d6cdebbf 100755
--- a/tests/generic/448
+++ b/tests/generic/448
@@ -17,7 +17,8 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _cleanup()
 {
-	rm -f $tmp.* $BASE_TEST_FILE.*
+	rm -f $tmp.*
+	[ ! -z $BASE_TEST_FILE ] && rm -f $BASE_TEST_FILE.*
 }
 
 # get standard environment, filters and checks