From user@blg.akavia.ru  Mon Mar 19 11:33:58 2007
Return-Path: <user@blg.akavia.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 00BC916A402
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Mar 2007 11:33:58 +0000 (UTC)
	(envelope-from user@blg.akavia.ru)
Received: from blg.akavia.ru (blg.akavia.ru [62.33.174.250])
	by mx1.freebsd.org (Postfix) with ESMTP id 03BE613C44C
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Mar 2007 11:33:56 +0000 (UTC)
	(envelope-from user@blg.akavia.ru)
Received: from blg.akavia.ru (localhost [127.0.0.1])
	by blg.akavia.ru (8.13.8/8.13.8) with ESMTP id l2JBXrCY099402;
	Mon, 19 Mar 2007 20:33:53 +0900 (YAKT)
	(envelope-from user@blg.akavia.ru)
Received: (from root@localhost)
	by blg.akavia.ru (8.13.8/8.13.8/Submit) id l2JBXrXo099401;
	Mon, 19 Mar 2007 20:33:53 +0900 (YAKT)
	(envelope-from user)
Message-Id: <200703191133.l2JBXrXo099401@blg.akavia.ru>
Date: Mon, 19 Mar 2007 20:33:53 +0900 (YAKT)
From: Alexander Logvinov <ports@logvinov.com>
Reply-To: Alexander Logvinov <ports@logvinov.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: vd@freebsd.org
Subject: [PATCH] ftp/wget: disallow removing modified wgetrc file on deinstall
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         110512
>Category:       ports
>Synopsis:       [PATCH] ftp/wget: disallow removing modified wgetrc file on deinstall
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    vd
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 19 11:40:06 GMT 2007
>Closed-Date:    Wed Apr 11 19:41:57 GMT 2007
>Last-Modified:  Wed Apr 11 19:41:57 GMT 2007
>Originator:     Alexander Logvinov
>Release:        FreeBSD 6.2-RELEASE-p3 i386
>Organization:
>Environment:

>Description:

  Disallow removing modified ${PREFIX}/etc/wgetrc file on deinstall
    
>How-To-Repeat:

>Fix:

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/ftp/wget/Makefile,v
retrieving revision 1.83
diff -u -r1.83 Makefile
--- Makefile	2 Aug 2006 19:33:51 -0000	1.83
+++ Makefile	19 Mar 2007 11:01:29 -0000
@@ -51,4 +51,11 @@
 			 -e 's,@file{},@file{${PREFIX}},' \
 		${WRKSRC}/doc/sample.wgetrc* ${WRKSRC}/doc/wget.texi
 
+post-install:
+	@if [ ! -e ${PREFIX}/etc/wgetrc.new ]; then \
+		${INSTALL_DATA} ${PREFIX}/etc/wgetrc ${PREFIX}/etc/wgetrc.dist; \
+	else \
+		${MV} ${PREFIX}/etc/wgetrc.new ${PREFIX}/etc/wgetrc.dist; \
+	fi
+
 .include <bsd.port.mk>
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/ftp/wget/pkg-plist,v
retrieving revision 1.16
diff -u -r1.16 pkg-plist
--- pkg-plist	10 Jun 2005 08:14:47 -0000	1.16
+++ pkg-plist	19 Mar 2007 11:01:29 -0000
@@ -1,5 +1,7 @@
+@unexec if cmp -s %D/etc/wgetrc %D/etc/wgetrc.dist; then rm -f %D/etc/wgetrc; fi
 bin/wget
-etc/wgetrc
+etc/wgetrc.dist
+@exec [ -f %B/wgetrc ] || cp %B/%f %B/wgetrc
 %%NLS%%share/locale/bg/LC_MESSAGES/wget.mo
 %%NLS%%share/locale/ca/LC_MESSAGES/wget.mo
 %%NLS%%share/locale/cs/LC_MESSAGES/wget.mo
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->vd 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Mar 19 11:40:16 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110512 
State-Changed-From-To: open->feedback 
State-Changed-By: vd 
State-Changed-When: Tue Mar 27 20:15:38 UTC 2007 
State-Changed-Why:  
etc/wgetrc is not removed on deinstall if modified. 
Can you please, describe the steps to reproduce this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110512 

From: Alexander Logvinov <ports@logvinov.com>
To: bug-followup@FreeBSD.org, vd@FreeBSD.org
Cc:  
Subject: Re[2]: ports/110512: [PATCH] ftp/wget: disallow removing modified wgetrc file on deinstall
Date: Wed, 28 Mar 2007 07:04:42 +1000

 Hello!
 
 Wednesday, March 28, 2007, 6:17:09 AM, you wrote:
 
 > etc/wgetrc is not removed on deinstall if modified.
 > Can you please, describe the steps to reproduce this.
  But how about "etc/wgetrc" line in pkg-plist file?
 
 # cd /usr/ports/ftp/wget
 # make install clean
 # ls -l /usr/local/etc/wgetrc
 -r--r--r--  1 root  wheel  4224 Mar 28 07:00 /usr/local/etc/wgetrc
 # echo "test" >> /usr/local/etc/wgetrc
 # make deinstall
 ===>  Deinstalling for ftp/wget
 ===>   Deinstalling wget-1.10.2
 pkg_delete: '/usr/local/etc/wgetrc' fails original MD5 checksum - deleted anyway.
 # ls -l /usr/local/etc/wgetrc
 ls: /usr/local/etc/wgetrc: No such file or directory
 
 --
 WBR
 

From: Vasil Dimov <vd@FreeBSD.org>
To: Alexander Logvinov <ports@logvinov.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/110512: [PATCH] ftp/wget: disallow removing modified
	wgetrc file on deinstall
Date: Sat, 31 Mar 2007 23:34:33 +0300

 On Wed, Mar 28, 2007 at 07:04:42 +1000, Alexander Logvinov wrote:
 > Hello!
 > 
 > Wednesday, March 28, 2007, 6:17:09 AM, you wrote:
 > 
 > > etc/wgetrc is not removed on deinstall if modified.
 > > Can you please, describe the steps to reproduce this.
 >  But how about "etc/wgetrc" line in pkg-plist file?
 
 Alexander,
 
 I am very sorry for being so late with my responses.
 
 The thing I am concerned about is that usually in this case the
 solution would be to install etc/wgetrc.sample, so the user can copy
 this file to etc/wgetrc if he needs to make any changes. Upon
 installation/deinstallation etc/wgetrc.sample is overwritten/removed.
 
 Can you create a patch that makes wget install its config file to
 etc/wgetrc.sample and change the corresponding plist line?
 
 -- 
 Vasil Dimov
 moc.elcaro@vomid.lisav        Software Developer @ Oracle/Innobase Oy
 gro.DSBeerF@dv                Committer @ FreeBSD.org
 gro.d5v@dv                    Home @ Sofia, Bulgaria

From: Alexander Logvinov <ports@logvinov.com>
To: bug-followup@FreeBSD.org, vd@FreeBSD.org
Cc:  
Subject: Re[2]: ports/110512: [PATCH] ftp/wget: disallow removing modified wgetrc file on deinstall
Date: Mon, 2 Apr 2007 15:48:30 +1000

 Hello!
 
 Sunday, April 1, 2007, 6:34:33 AM, you wrote:
 
 >> > etc/wgetrc is not removed on deinstall if modified.
 >> > Can you please, describe the steps to reproduce this.
 >>  But how about "etc/wgetrc" line in pkg-plist file?
 > I am very sorry for being so late with my responses.
  No problem!
 
 > The thing I am concerned about is that usually in this case the
 > solution would be to install etc/wgetrc.sample, so the user can copy
 > this file to etc/wgetrc if he needs to make any changes. Upon
 > installation/deinstallation etc/wgetrc.sample is overwritten/removed.
 > Can you create a patch that makes wget install its config file to
 > etc/wgetrc.sample and change the corresponding plist line?
  But why original patch doesn't suit you? :) I think it makes everything that you want. :)
 
  There is a check for modification of etc/wgetrc file in wget's gmake Makefile:
 
  1) If etc/wgetrc doesn't exist Makefile of wget creates etc/wgetrc from doc/sample.wgetrc and then Makefile of ports copies it to etc/wgetrc.dist (or .sample).
 
  2) doc/sample.wgetrc is copied to wgetrc.new and don't overwrite etc/wgetrc if etc/wgetrc exists and modified. We only move etc/wgetrc.new to etc/wgetrc.dist (or .sample) and don't touch etc/wgetrc.
 
 
 --
 WBR
 
State-Changed-From-To: feedback->closed 
State-Changed-By: vd 
State-Changed-When: Wed Apr 11 19:39:27 UTC 2007 
State-Changed-Why:  
A fix that installs wgetrc as wgetrc.sample has been committed. 
The proposed solution is a way too complex. 
Thanks for the inspiration! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110512 
>Unformatted:
