diff mbox

osstest: remove unneeded rm in ts-freebsd-host-install

Message ID 20171103142129.82695-1-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné Nov. 3, 2017, 2:21 p.m. UTC
The usage of `rm` here is wrong for two reasons:

 - It will fail if $sharedpath.tmp doesn't exist and report and error
   (ie: -f should be used).
 - It's not needed because dd will truncate $sharedpath.tmp.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 ts-freebsd-host-install | 1 -
 1 file changed, 1 deletion(-)

Comments

Ian Jackson Nov. 3, 2017, 2:47 p.m. UTC | #1
Roger Pau Monne writes ("[PATCH] osstest: remove unneeded rm in ts-freebsd-host-install"):
> The usage of `rm` here is wrong for two reasons:
> 
>  - It will fail if $sharedpath.tmp doesn't exist and report and error
>    (ie: -f should be used).
>  - It's not needed because dd will truncate $sharedpath.tmp.

I think it would be marginally better to use -f.  That way the
permissions and ownership of a previous abortive attempt are discarded
rather than kept.

Ian.
diff mbox

Patch

diff --git a/ts-freebsd-host-install b/ts-freebsd-host-install
index 447a5076..4aff7214 100755
--- a/ts-freebsd-host-install
+++ b/ts-freebsd-host-install
@@ -96,7 +96,6 @@  targetpath=$4
 cd $basedir
 mkdir -p `dirname $sharedpath`
 if [ ! -f $sharedpath ]; then
-    rm $sharedpath.tmp
     dd if=$imagepath of=$sharedpath.tmp
     mv $sharedpath.tmp $sharedpath
 fi