Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 4/4] wic: fix restoring of original fstab
  2017-06-16 13:19 [PATCH 0/4] wic: fix for #11633 and code cleanup Ed Bartosh
@ 2017-06-16 13:19 ` Ed Bartosh
  0 siblings, 0 replies; 2+ messages in thread
From: Ed Bartosh @ 2017-06-16 13:19 UTC (permalink / raw)
  To: openembedded-core

Wic updates fstab if mount points are specified in .wks.
After partition images are created the original fstab is restored.
However, if exception is raised when partition image being prepared
wic doesn't restore original fstab. This can cause duplication of
added lines in fstab when 'wic create' runs next time.

Wrapping call of 'prepare' method and restoring original fstab
even if exception occurs should fix this.

[YOCTO #11633]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/wic/plugins/imager/direct.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index e09350b..e26defb 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -172,10 +172,11 @@ class DirectPlugin(ImagerPlugin):
                     if rsize_bb:
                         part.size = int(round(float(rsize_bb)))
 
-        self._image.prepare(self)
-
-        if fstab_path:
-            shutil.move(fstab_path + ".orig", fstab_path)
+        try:
+            self._image.prepare(self)
+        finally:
+            if fstab_path:
+                shutil.move(fstab_path + ".orig", fstab_path)
 
         self._image.layout_partitions()
         self._image.create()
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/4] wic: fix restoring of original fstab
@ 2017-06-20  8:27 Diego Rondini
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Rondini @ 2017-06-20  8:27 UTC (permalink / raw)
  To: openembedded-core

Hi Ed,

> Wic updates fstab if mount points are specified in .wks.
> After partition images are created the original fstab is restored.
> However, if exception is raised when partition image being prepared
> wic doesn't restore original fstab. This can cause duplication of
> added lines in fstab when 'wic create' runs next time.
> 
> Wrapping call of 'prepare' method and restoring original fstab
> even if exception occurs should fix this.
> 
> [YOCTO #11633]
> 
> Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>

I've applied the patch locally, and deliberately caused some WicError 
exceptions: the resulting fstab correctly has only one mount entry. So this 
seems to fix #11633.

Tested-by: Diego Rondini <diego.rondini@kynetics.com>

Thanks for taking care of this,
Diego


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-20  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-20  8:27 [PATCH 4/4] wic: fix restoring of original fstab Diego Rondini
  -- strict thread matches above, loose matches on Subject: below --
2017-06-16 13:19 [PATCH 0/4] wic: fix for #11633 and code cleanup Ed Bartosh
2017-06-16 13:19 ` [PATCH 4/4] wic: fix restoring of original fstab Ed Bartosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox