]> arthur.barton.de Git - bup.git/commitdiff
pwdgrp.Group: allow gr_passwd to be None
authorMuh Muhten <muh.muhten@gmail.com>
Thu, 26 May 2022 05:07:47 +0000 (01:07 -0400)
committerRob Browning <rlb@defaultvalue.org>
Sat, 25 Jun 2022 18:26:06 +0000 (13:26 -0500)
I haven't looked into this too closely, but it seems that Android's
getgr* fill gr_passwd with a null pointer, mapped to python None, which
is not a bytes.

Since this assert seems to be 100% py3 sanity-checking and bup doesn't
actually use the gr_passwd anywhere, it should be safe to pass the None.

Signed-off-by: Muh Muhten <muh.muhten@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message; add origin comment]

lib/bup/pwdgrp.py

index a41c4429203be2d46c907d43f9da407a31ddd0ac..11450bb19b17c3e4008b194d7f4af78243884561 100644 (file)
@@ -37,7 +37,8 @@ class Group:
     __slots__ = 'gr_name', 'gr_passwd', 'gr_gid', 'gr_mem'
     def __init__(self, name, passwd, gid, mem):
         assert isinstance(name, bytes)
-        assert isinstance(passwd, bytes)
+        # None was observed on Android
+        assert isinstance(passwd, bytes) or passwd is None
         for m in mem:
             assert isinstance(m, bytes)
         self.gr_name, self.gr_passwd, self.gr_gid, self.gr_mem = \