[PATCH 1/2] Allow gr_passwd to be NULL

2 views
Skip to first unread message

Muh Muhten

unread,
May 26, 2022, 1:07:51 AM5/26/22
to bup-...@googlegroups.com
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.m...@gmail.com>
---
lib/bup/pwdgrp.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bup/pwdgrp.py b/lib/bup/pwdgrp.py
index a41c442..3dc45c9 100644
--- a/lib/bup/pwdgrp.py
+++ b/lib/bup/pwdgrp.py
@@ -37,7 +37,7 @@ 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)
+ 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.36.1

Muh Muhten

unread,
May 26, 2022, 1:08:12 AM5/26/22
to bup-...@googlegroups.com
In the unlikely event that we're building on a filesystem that doesn't
support hard links, ln fails gratuitously, while copying probably still
works. The python wrapper is normally pretty small.

Signed-off-by: Muh Muhten <muh.m...@gmail.com>
---
GNUmakefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/GNUmakefile b/GNUmakefile
index 20754e5..5ec49bf 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -172,7 +172,7 @@ dev/python-proposed: dev/python.c src/bup/compat.c
src/bup/io.c
clean_paths += dev/python
dev/python: dev/python-proposed
dev/validate-python $@-proposed
- ln $@-proposed $@
+ cp -a $@-proposed $@

clean_paths += dev/bup-exec
generated_dependencies += dev/bup-exec.d
--
2.36.1

Rob Browning

unread,
Jun 25, 2022, 2:45:48 PM6/25/22
to Muh Muhten, bup-...@googlegroups.com
Muh Muhten <muh.m...@gmail.com> writes:

> In the unlikely event that we're building on a filesystem that doesn't
> support hard links, ln fails gratuitously, while copying probably still
> works. The python wrapper is normally pretty small.
>
> Signed-off-by: Muh Muhten <muh.m...@gmail.com>

Pushed. Thanks.
--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

Rob Browning

unread,
Jun 25, 2022, 2:46:07 PM6/25/22
to Muh Muhten, bup-...@googlegroups.com
Muh Muhten <muh.m...@gmail.com> writes:

> 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.m...@gmail.com>
> ---

Reply all
Reply to author
Forward
0 new messages