Bug 114994

Summary: sysutils/3dm: install/uninstall issues that impact the config file
Product: Ports & Packages Reporter: Craig Leres <leres>
Component: Individual Port(s)Assignee: Xin LI <delphij>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
pr114994_followup.diff none

Description Craig Leres freebsd_committer 2007-07-28 19:40:06 UTC
	There are a couple of issues with the way this port deals
	with the config file, 3dm2.conf.

	(1) An existing 3dm2.conf is clobbered on install.

	(2) If 3dm2.conf is always set to mode 600 even if it existed
	before installing the port or package.

Fix: See appended patch. The changes to pkg-plist fix (1) and
	the changes to the Makefile fix (2)

------- =_aaaaaaaaaa0
Content-Type: text/plain; name="3dm-patch.txt"; charset="us-ascii"
Content-ID: <86700.1185647838.2@fun.ee.lbl.gov>



------- =_aaaaaaaaaa0----QKTWIIgZZDqRZprkDmy8OisNtxpDlMxI4KvSRPi3R3t2gSjk
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- Makefile.virgin	Sat Jan 27 04:27:19 2007
+++ Makefile	Sat Jul 28 11:28:16 2007
@@ -95,11 +95,10 @@
 .endif
 
 post-install:
-	${INSTALL_DATA} ${WRKSRC}/3dm2.conf.sample ${PREFIX}/etc/3dm2/
+	${INSTALL_DATA} -m 600 ${WRKSRC}/3dm2.conf.sample ${PREFIX}/etc/3dm2/
 	[ -f ${PREFIX}/etc/3dm2/3dm2.conf ] || \
-		${CP} ${PREFIX}/etc/3dm2/3dm2.conf.sample \
+		${INSTALL_DATA} -m 600 ${WRKSRC}/3dm2.conf.sample \
 		${PREFIX}/etc/3dm2/3dm2.conf
-	@${CHMOD} 600 ${PREFIX}/etc/3dm2/3dm2.conf.sample ${PREFIX}/etc/3dm2/3dm2.conf
 
 # 3ware uses a hardcoded config dir location that doesn't match hier(9)
 
--- pkg-plist.virgin	Sat Jan 27 04:27:20 2007
+++ pkg-plist	Sat Jul 28 11:26:20 2007
@@ -1,7 +1,7 @@
 @unexec %D/etc/rc.d/3dm2.sh stop > /dev/null 2>&1 || true
 @unexec if cmp -s %D/etc/3dm2/3dm2.conf.sample %D/etc/3dm2/3dm2.conf; then rm -f %D/etc/3dm2/3dm2.conf; fi
 etc/3dm2/3dm2.conf.sample
-@exec if [ -f %B/3dm2.conf ] ; then cp -p %D/%F %B/3dm2.conf; fi
+@exec if [ ! -f %B/3dm2.conf ] ; then cp -p %D/%F %B/3dm2.conf; fi
 etc/3dm2/msg/tdm_msg_en
 etc/3dm2/msg/tw_msg_en
 sbin/3dm2
How-To-Repeat: 	(1) Install 3dm, customize 3dm2.conf and then pkg_delete 3dm.
	Then install 3dm again and notice that 3dm2.conf has reverted
	to the contents of 3dm2.conf.sample

	(2) Examine sysutils/3dm/Makefile
Comment 1 Edwin Groothuis freebsd_committer 2007-07-28 19:40:16 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 2 Rin Morningstar 2007-08-06 01:45:00 UTC
Attached is the maintainer-approved patch to the port skeleton.  It 
touches Makefile and pkg-plist.  Please use include the following in the 
commit message:

This port revision contains the following bug fixes and changes:

- When installing the port using the package, an existing 
${PREFIX}/etc/3dm2/3dm2.conf file gets clobbered.  The error was in the 
pkg-plist, which had an incorrect file existence test to determine if a 
new 3dm2.conf file should be installed.

- ${PREFIX}/etc/3dm2/3dm2.conf.sample is now installed with file 
permissions 400.

- An existing ${PREFIX}/etc/3dm2/3dm2.conf does not have its file 
permissions reset to 600.

- Update pkg-plist to use rcNG naming scheme (line 1).

Thanks to Craig Leres <leres@ee.lbl.gov> for bringing the config file 
clobbering and file permissions issues to the attention of the port 
maintainer.
Comment 3 dfilter service freebsd_committer 2007-08-06 03:24:07 UTC
delphij     2007-08-06 02:24:01 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/3dm         Makefile pkg-plist 
  Log:
   - Avoid clobbering existing 3dm2.conf
   - Don't unconditionally set mode 600 on 3dm2.conf
  
  Noticed by:     Craig Leres <leres ee lbl gov>
  Submitted by:   maintainer (in a follup to the PR)
  PR:             ports/114994
  
  Revision  Changes    Path
  1.21      +6 -4      ports/sysutils/3dm/Makefile
  1.10      +2 -2      ports/sysutils/3dm/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 4 Xin LI freebsd_committer 2007-08-06 03:24:15 UTC
State Changed
From-To: feedback->closed

Committed, thanks! 


Comment 5 Xin LI freebsd_committer 2007-08-06 03:24:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->delphij

Take.