ports/69288: [PATCH] security/sudo: Fix deinstall

Hideyuki KURASHINA rushani at FreeBSD.org
Mon Jul 19 13:40:14 UTC 2004


>Number:         69288
>Category:       ports
>Synopsis:       [PATCH] security/sudo: Fix deinstall
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 19 13:40:13 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hideyuki KURASHINA
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:

	System: FreeBSD ***.*******.jp 5.2-CURRENT FreeBSD 5.2-CURRENT #1: Sun Jul 4 13:40:24 JST 2004 hideyuki@***.*******.jp:/usr/obj/usr/src/sys/*** i386

>Description:

	Fix deinstall.  In previous PR, I've introduced a bug into
	ports/security/sudo/pkg-plist...  At @unexec,

	  if cmp -s %D/etc/sudoers %%EXAMPLESDIR%%/sudoers

	does not work because 2nd argument of cmp is not
	``%D/%%EXAMPLESDIR%%/sudoers''.

	On the other hand, ${WRKSRC}/sample.sudoers is different from
	${PREFIX}/etc/sudoers which is copied from ${${WRKSRC}/sudoers.
	I think it is good to prepare both default config file and sample file
	in EXAMPLESDIR.

	One more thing to fix is installing via pkg_add.  The ``+INSTALL''
	file in package which derived from ports/security/sudo/pkg-install
	does not accept environmental variable EXAMPLESDIR, so use
	PKG_PREFIX-based approach.

>How-To-Repeat:

	# cd /usr/ports/security/sudo
	# if [ -e /usr/local/etc/sudoers ]; then \
	? mv /usr/local/etc/sudoers /usr/local/etc/sudoers.bak; \
	? fi
	# make install
	# diff /usr/local/etc/sudoers /usr/local/share/examples/sudo/sudoers
		To confirm there is no difference between those files
	# make deinstall
		To confirm both files are removed or not.

>Fix:

	Apply following patch (pkg-plist part was inspired by recent comit
	by @ume).

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/security/sudo/Makefile,v
retrieving revision 1.62
diff -u -r1.62 Makefile
--- Makefile	19 Jul 2004 08:15:33 -0000	1.62
+++ Makefile	19 Jul 2004 12:53:34 -0000
@@ -56,6 +56,7 @@
 
 post-install:
 	@${MKDIR} ${EXAMPLESDIR}
-	${INSTALL_DATA} ${WRKSRC}/sample.sudoers ${EXAMPLESDIR}/sudoers
+	${INSTALL_DATA} ${WRKSRC}/sudoers ${EXAMPLESDIR}/sudoers
+	${INSTALL_DATA} ${WRKSRC}/sample.sudoers ${EXAMPLESDIR}/sudoers.sample
 
 .include <bsd.port.post.mk>
Index: pkg-install
===================================================================
RCS file: /home/ncvs/ports/security/sudo/pkg-install,v
retrieving revision 1.3
diff -u -r1.3 pkg-install
--- pkg-install	19 Jul 2004 08:15:33 -0000	1.3
+++ pkg-install	19 Jul 2004 13:21:57 -0000
@@ -5,6 +5,6 @@
 if [ -e ${PKG_PREFIX}/etc/sudoers ]; then
   echo "Will not overwrite existing ${PKG_PREFIX}/etc/sudoers file."
 else
-  cp -p ${EXAMPLESDIR}/sudoers ${PKG_PREFIX}/etc/sudoers
+  cp -p ${PKG_PREFIX}/share/examples/sudo/sudoers ${PKG_PREFIX}/etc/sudoers
   chmod 440 ${PKG_PREFIX}/etc/sudoers
 fi
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/security/sudo/pkg-plist,v
retrieving revision 1.8
diff -u -r1.8 pkg-plist
--- pkg-plist	19 Jul 2004 08:15:33 -0000	1.8
+++ pkg-plist	19 Jul 2004 12:51:14 -0000
@@ -1,5 +1,6 @@
- at unexec if cmp -s %D/etc/sudoers %%EXAMPLESDIR%%/sudoers; then rm -f %D/etc/sudoers; fi
+ at unexec if cmp -s %D/etc/sudoers %D/%%EXAMPLESDIR%%/sudoers; then rm -f %D/etc/sudoers; fi
 bin/sudo
 sbin/visudo
 %%EXAMPLESDIR%%/sudoers
+%%EXAMPLESDIR%%/sudoers.sample
 @dirrm %%EXAMPLESDIR%%
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list