[elbe-devel] [PATCH 3/4] efilesystem: os.chdir() back to the original directory

Torben Hohn torben.hohn at linutronix.de
Wed Jan 15 16:10:42 CET 2020


pylint complains:
elbepack/efilesystem.py:391: [W0612(unused-variable), TargetFs.part_target] Unused variable 'oldwd'

this is a real error, because the oldwd is saved, but the code never
calls os.chdir(oldwd) again.

Call os.chdir(oldwd) to restore the original workingdirectory.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/efilesystem.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 8b9da3d0b..621f206f3 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -401,6 +401,7 @@ class TargetFs(ChRootFilesystem):
             except CommandError:
                 # error was logged; continue
                 pass
+            os.chdir(oldwd)
 
         if self.xml.has("target/package/squashfs"):
             oldwd = os.getcwd()
@@ -414,6 +415,7 @@ class TargetFs(ChRootFilesystem):
             except CommandError as e:
                 # error was logged; continue
                 pass
+            os.chdir(oldwd)
 
     def pack_images(self, builddir):
         for img, packer in self.image_packers.items():
-- 
2.20.1




More information about the elbe-devel mailing list