Skip to contentSkip to conversation

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

PATCH In review Roger Pau Monne 2 participants 2 messages Nov 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
Cc: Ian Jackson <[email protected]>

---
 ts-freebsd-host-install | 1 -
 1 file changed, 1 deletion(-)
ts-freebsd-host-install +0 -1
index 447a5076..4aff7214 100755
@@ -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
Signature · 7 lines
2.13.6 (Apple Git-96)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

Roger Pau Monne writes ("[PATCH] osstest: remove unneeded rm in ts-freebsd-host-install"):

Quoted 5 lines

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel