From 24ed462c044d4176f299db6abc14f6db24453b52 Mon Sep 17 00:00:00 2001 From: Muh Muhten Date: Thu, 26 May 2022 01:07:47 -0400 Subject: [PATCH] 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] --- lib/bup/pwdgrp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 = \ -- 2.39.2