Package: fakeroot
Version: 1.20.2-1
Severity: wishlist

Hi,

while dealing with #806475 we eventually figured out that while
setgroups is nooped by fakeroot, getgroups isn't handled at all.

Attached is a trivial patch which lets getgroups return always a list
containing only the current (faked) gid. A proper patch would likely
involve saving in setgroups as well, so not marking as +patch – also as
the wrapping of initgroups somehow suggests you don't want to deal with
this at all.


Best regards

David Kalnischkies
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -1554,6 +1554,16 @@
     return 0;
 }
 
+int getgroups(int size, gid_t list[]){
+  if (fakeroot_disabled)
+    return next_setgroups(size, list);
+  else {
+    if (size > 0)
+       list[0] = get_faked_gid();
+    return 1;
+  }
+}
+
 int setgroups(SETGROUPS_SIZE_TYPE size, const gid_t *list){
   if (fakeroot_disabled)
     return next_setgroups(size, list);
--- a/wrapfunc.inp
+++ b/wrapfunc.inp
@@ -144,6 +144,7 @@
 setfsgid;gid_t;(gid_t fsgid);(fsgid)
 #endif /* HAVE_SETFSGID */
 initgroups;int;(const char *user, INITGROUPS_SECOND_ARG group);(user, group)
+getgroups;int;(int size, gid_t list[]);(size, list)
 setgroups;int;(SETGROUPS_SIZE_TYPE size, const gid_t *list);(size, list)
 setpriority;int;(int which, int who, int prio);(which, who, prio)
 #ifdef HAVE_CAPSET

Attachment: signature.asc
Description: PGP signature

Reply via email to