pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib Avoid EPERM errors from...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ba56c7fa7735
branches:  trunk
changeset: 533099:ba56c7fa7735
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Sep 08 09:45:22 2007 +0000

description:
Avoid EPERM errors from tar when installing packages as an unprivileged
user.

diffstat:

 pkgtools/pkg_install/files/lib/pen.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r ffdf4073ceb3 -r ba56c7fa7735 pkgtools/pkg_install/files/lib/pen.c
--- a/pkgtools/pkg_install/files/lib/pen.c      Sat Sep 08 09:45:14 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/pen.c      Sat Sep 08 09:45:22 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pen.c,v 1.20 2007/07/16 09:54:55 joerg Exp $   */
+/*     $NetBSD: pen.c,v 1.21 2007/09/08 09:45:22 rillig Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
 #else
-__RCSID("$NetBSD: pen.c,v 1.20 2007/07/16 09:54:55 joerg Exp $");
+__RCSID("$NetBSD: pen.c,v 1.21 2007/09/08 09:45:22 rillig Exp $");
 #endif
 #endif
 
@@ -158,6 +158,16 @@
                cleanup(0);
                errx(2, "can't mkdtemp '%s'", pen);
        }
+
+       /*
+        * On at least NetBSD, the temporary directory may have a group
+        * that isn't in the group list of the current user. In that
+        * case, it is impossible to extract setgid binaries from the
+        * package, since chmod(2) doesn't allow to set the S_ISGID bit
+        * for a group that isn't yours.
+        */
+       (void)chown(pen, -1, getegid());
+
        if (Verbose) {
                if (sz)
                        fprintf(stderr,



Home | Main Index | Thread Index | Old Index