From olli@dorifer.heim3.tu-clausthal.de  Tue Feb 10 21:53:07 1998
Received: from dorifer.heim3.tu-clausthal.de (dorifer.heim3.tu-clausthal.de [139.174.243.252])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA27301
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 10 Feb 1998 21:53:03 -0800 (PST)
          (envelope-from olli@dorifer.heim3.tu-clausthal.de)
Received: (from olli@localhost)
	by dorifer.heim3.tu-clausthal.de (8.8.8/8.8.8) id GAA22379;
	Wed, 11 Feb 1998 06:53:01 +0100 (CET)
	(envelope-from olli)
Message-Id: <199802110553.GAA22379@dorifer.heim3.tu-clausthal.de>
Date: Wed, 11 Feb 1998 06:53:01 +0100 (CET)
From: Oliver Fromme <oliver.fromme@heim3.tu-clausthal.de>
Reply-To: oliver.fromme@heim3.tu-clausthal.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: pkg_delete refuses to run as non-root
X-Send-Pr-Version: 3.2

>Number:         5718
>Category:       bin
>Synopsis:       pkg_delete refuses to run as non-root
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 10 22:00:02 PST 1998
>Closed-Date:    Sat May 13 05:59:08 PDT 2000
>Last-Modified:  Sat May 13 05:59:26 PDT 2000
>Originator:     Oliver Fromme
>Release:        FreeBSD 2.2-971223-SNAP i386
>Organization:
Administration Heim 3 (Technical University of Clausthal)
>Environment:

`uname -a`:
FreeBSD dorifer.heim3.tu-clausthal.de 2.2-971223-SNAP
FreeBSD 2.2-971223-SNAP #0: Sun Feb  1 16:24:13 CET 1998
olli@dorifer.heim3.tu-clausthal.de:/usr/src/sys/compile/DORIFER  i386


>Description:

The pkg_delete tool refuses to run as non-root, although I
can't see a reason for this restriction.  In contrast, pkg_add
and pkg_info run fine as non_root (provided that $PKG_DBDIR is
set to a directory accessible by the respective user).

Background information:  I'm maintaining a software archive
(basically a selection from the ports collection) for a bunch
of machines.  Some of them import the archive via rdist, some
via NFS.  I created a pseudo user and set $PREFIX to its home
directory (fortunately, most ports respect the setting of
$PREFIX) and $PKG_DBDIR to a subdirectory inside its home.
Installing ports as that user works fine, including adding them
to the package database.  But removing them with the original
pkg_delete doesn't work, as explained above.


>How-To-Repeat:

Set $PKG_DBDIR to a directory writable by a normal user, then
add a package, then try to delete it with pkg_delete as that
user.


>Fix:

This is a unified diff against
/usr/src/usr.sbin/pkg_install/delete/main.c
$Id: main.c,v 1.6.2.2 1997/10/09 07:09:25 charnier Exp $
	
--- main.c.orig	Thu Oct  9 09:09:25 1997
+++ main.c	Wed Feb 11 06:37:20 1998
@@ -89,8 +89,6 @@
     if (pkgs == start)
 	warnx("missing package name(s)"), usage();
     *pkgs = NULL;
-    if (!Fake && getuid() != 0)
-	errx(1, "you must be root to delete packages");
     if ((error = pkg_perform(start)) != 0) {
 	if (Verbose)
 	    warnx("%d package deletion(s) failed", error);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: hoek 
State-Changed-When: Sat May 13 05:59:08 PDT 2000 
State-Changed-Why:  
Fixed 
>Unformatted:
