linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neil@brown.name>
To: Yi Zhang <yizhan@redhat.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: Change "mv $targetdir/log $logdir/$log" to "cp $targetdir/log $logdir/$log"
Date: Fri, 09 Oct 2015 16:02:11 +1100	[thread overview]
Message-ID: <87mvvs4oto.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1023141143.22094768.1441596507637.JavaMail.zimbra@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]

Yi Zhang <yizhan@redhat.com> 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@suse.com>
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@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.com>

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

      reply	other threads:[~2015-10-09  5:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2004794274.22089532.1441594962520.JavaMail.zimbra@redhat.com>
2015-09-07  3:28 ` Change "mv $targetdir/log $logdir/$log" to "cp $targetdir/log $logdir/$log" Yi Zhang
2015-10-09  5:02   ` Neil Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mvvs4oto.fsf@notabene.neil.brown.name \
    --to=neil@brown.name \
    --cc=linux-raid@vger.kernel.org \
    --cc=yizhan@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).