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

Bastian Germann bage at linutronix.de
Wed Jan 15 16:14:00 CET 2020


Am 15.01.20 um 16:10 schrieb Torben Hohn:
> 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>

Reviewed-by: Bastian Germann <bage 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():
> 



More information about the elbe-devel mailing list