[elbe-devel] [PATCH 2/7] Fix None case for Filesystem write_file/append_file mode

Torben Hohn torben.hohn at linutronix.de
Fri May 17 14:36:46 CEST 2019


On Fri, May 17, 2019 at 11:16:56AM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> Both methods 'write_file' and 'append_file' change the mode of the target
> file after the operation.  But, we don't always want to change the
> mode of the file.
> 
> Thus, if the mode is 'None', the file's mode is unchanged.
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
>  elbepack/filesystem.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
> index 5d8c8cea..cc7d08f5 100644
> --- a/elbepack/filesystem.py
> +++ b/elbepack/filesystem.py
> @@ -152,13 +152,14 @@ class Filesystem(object):
>          f = self.open(path, "w")
>          f.write(cont)
>          f.close()
> -        self.chmod(path, mode)
> +        if mode is not None:
> +            self.chmod(path, mode)
>  
>      def append_file(self, path, content, mode=None):
>          f = self.open(path, "a")
>          f.write(content)
>          f.close()
> -        if mode is not None
> +        if mode is not None:
>              self.chmod(path, mode)

this fix belongs into PATCH 1... 

when that is done, you can add 

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>


>  
>      def read_file(self, path):
> -- 
> 2.21.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20190517/3055a315/attachment.sig>


More information about the elbe-devel mailing list