Re: Change "mv $targetdir/log $logdir/$log" to "cp $targetdir/log $logdir/$log"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yi Zhang <yizhan@xxxxxxxxxx> writes:

> Hi Neil
> When I execute mdadm test with --save-logs set, found below error, could you help check it?
>
> Error log:
> tests/10ddf-fail-readd... FAILED - see /var/tmp/log-10ddf-fail-readd for details
> cp: cannot stat ‘/var/tmp/log’: No such file or directory
>

Thanks for the report.
I've applied the following which should fix this (and other issues).

Thanks,
NeilBrown

From c54f485288b50c90fa289e79fa66ae01e9162a2d Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@xxxxxxxx>
Date: Fri, 9 Oct 2015 16:00:59 +1100
Subject: [PATCH] test: don't move $target/log

Recent change to rename $target/log to a more stable name on
error broke --save-logs as $targetdir/log no longer existed to be
copied.

So change it to a 'cp', not a 'mv'.
While we are fixing things, use $_basename instead of calling
`basename` again, and only use "$logdir" if logs were requested.

And make use "see .. for details" has correct file name.

Reported-by: Yi Zhang <yizhan@xxxxxxxxxx>
Signed-off-by: NeilBrown <neilb@xxxxxxxx>

diff --git a/test b/test
index d0a6cb858212..5315ab97dde0 100755
--- a/test
+++ b/test
@@ -17,7 +17,6 @@ then
 fi
 
 testdir="tests"
-logdir="$testdir/logs"
 logsave=0
 exitonerror=1
 
@@ -317,10 +316,11 @@ do_test() {
       echo "=======================dmesg=================" >> $targetdir/log
       dmesg | tail -n 200 >> $targetdir/log
       if [ $exitonerror == 0 ]; then
-	  log=log-`basename $_script`
-	  mv $targetdir/log $logdir/$log
+	  cp $targetdir/log $targetdir/log-$_basename
+	  echo "FAILED - see $targetdir/log-$_basename for details"
+      else
+	  echo "FAILED - see $targetdir/log for details"
       fi
-      echo "FAILED - see $logdir/$log for details"
       _fail=1
     fi
     if [ "$savelogs" == "1" ]; then

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux