Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 May 2000 15:46:25 +0100
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/18373: pkg_delete shouldn't insist on root
Message-ID:  <E12n0Px-000LKM-00@magnesium.scientia.demon.co.uk>

next in thread | raw e-mail | index | archive | help

>Number:         18373
>Category:       bin
>Synopsis:       pkg_delete shouldn't insist on root
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May  3 10:20:03 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ben Smithurst
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
>Environment:

>Description:

It is rather inconvenient that pkg_delete(1) requires the calling user
to be root, as this makes testing a port you have created hard (it
seems you have to be root to allow "make deinstall" do anything).  This
restriction seems unnecessary, and removing it certainly can't be a
security risk.

>How-To-Repeat:

make your own port, install it to ~/something, set PKG_DBDIR to
~/somethingelse, try to "make deinstall".

>Fix:

Convert the fatal error to a warning if the -f flag is used (which
conveniently is used by the ports system's "make deinstall").

Index: main.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/delete/main.c,v
retrieving revision 1.17
diff -u -r1.17 main.c
--- main.c	2000/02/18 07:00:01	1.17
+++ main.c	2000/05/03 14:43:46
@@ -107,8 +107,11 @@
     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 (!Fake && getuid() != 0) {
+	if (!Force)
+	    errx(1, "you must be root to delete packages");
+	warnx("you must be root to delete packages (proceeding anyway)");
+    }
     if ((error = pkg_perform(start)) != 0) {
 	if (Verbose)
 	    warnx("%d package deletion(s) failed", error);
Index: pkg_delete.1
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/delete/pkg_delete.1,v
retrieving revision 1.16
diff -u -r1.16 pkg_delete.1
--- pkg_delete.1	2000/02/29 15:13:53	1.16
+++ pkg_delete.1	2000/05/03 14:38:29
@@ -94,7 +94,12 @@
 the package.  
 .It Fl f
 Force removal of the package, even if a dependency is recorded or the
-deinstall or require script fails.
+deinstall or require script fails.  This flag also allows
+.Nm
+to be run by non-root users, which can be useful for porters if the port has
+been installed to a directory writable by that user, and if
+.Ev PKG_DBDIR
+has been set to a directory writable by that user.
 .El
 
 .Pp

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E12n0Px-000LKM-00>