* Change "mv $targetdir/log $logdir/$log" to "cp $targetdir/log $logdir/$log"
[not found] <2004794274.22089532.1441594962520.JavaMail.zimbra@redhat.com>
@ 2015-09-07 3:28 ` Yi Zhang
2015-10-09 5:02 ` Neil Brown
0 siblings, 1 reply; 2+ messages in thread
From: Yi Zhang @ 2015-09-07 3:28 UTC (permalink / raw)
To: neil; +Cc: linux-raid
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
Code:
if ( set -ex ; . $_script ) &> $targetdir/log
then
echo "succeeded"
_fail=0
else
log=log
cat $targetdir/stderr >> $targetdir/log
echo "=======================dmesg=================" >> $targetdir/log
dmesg | tail -n 200 >> $targetdir/log
if [ $exitonerror == 0 ]; then
log=log-`basename $_script`
mv $targetdir/log $logdir/$log // This step will move $targetdir/log to $logdir/$log,
fi
echo "FAILED - see $logdir/$log for details"
_fail=1
fi
if [ "$savelogs" == "1" ]; then
cp $targetdir/log $logdir/$_basename.log // If I set $savelogs here, the $targetdir/log doesn't exist now
fi
So could we change the mv to cp?
diff --git a/test b/test
index d0a6cb8..118fa96 100755
--- a/test
+++ b/test
@@ -318,7 +318,7 @@ do_test() {
dmesg | tail -n 200 >> $targetdir/log
if [ $exitonerror == 0 ]; then
log=log-`basename $_script`
- mv $targetdir/log $logdir/$log
+ cp $targetdir/log $logdir/$log
fi
echo "FAILED - see $logdir/$log for details"
_fail=1
Best Regards,
Yi Zhang
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Change "mv $targetdir/log $logdir/$log" to "cp $targetdir/log $logdir/$log"
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
0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2015-10-09 5:02 UTC (permalink / raw)
To: Yi Zhang; +Cc: linux-raid
[-- 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 --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-09 5:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 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).