From: Muh Muhten Date: Thu, 26 May 2022 05:07:47 +0000 (-0400) Subject: pwdgrp.Group: allow gr_passwd to be None X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=24ed462c044d4176f299db6abc14f6db24453b52 pwdgrp.Group: allow gr_passwd to be None 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 Reviewed-by: Rob Browning [rlb@defaultvalue.org: adjust commit message; add origin comment] --- diff --git a/lib/bup/pwdgrp.py b/lib/bup/pwdgrp.py index a41c442..11450bb 100644 --- a/lib/bup/pwdgrp.py +++ b/lib/bup/pwdgrp.py @@ -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 = \