Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 May 2006 23:35:09 +0100
From:      Shaun Amott <shaun@inerd.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/98038: [MAINTAINER] news/inn: stop port from removing database files when deinstalling/upgrading
Message-ID:  <1148769309.3230@charon.picobyte.net>
Resent-Message-ID: <200605272300.k4RN0blk071364@freefall.freebsd.org>

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

>Number:         98038
>Category:       ports
>Synopsis:       [MAINTAINER] news/inn: stop port from removing database files when deinstalling/upgrading
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 27 23:00:36 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Shaun Amott
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:

>Description:

news/inn currently removes database data files during an upgrade or deinstall.
The patch below fixes inn to only remove files that haven't been touched since a
fresh install.

Reported by: thierry@

>How-To-Repeat:

>Fix:

--- inn.diff begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/news/inn/Makefile,v
retrieving revision 1.74
diff -u -r1.74 Makefile
--- Makefile	7 May 2006 21:16:15 -0000	1.74
+++ Makefile	27 May 2006 21:46:30 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	inn
 PORTVERSION=	2.4.3
+PORTREVISION=	1
 CATEGORIES=	news ipv6
 MASTER_SITES=	${MASTER_SITE_ISC}
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -146,6 +147,9 @@
 	@${REINPLACE_CMD} -e 's!<tcl.h>!<tcl8.3/tcl.h>!' ${WRKSRC}/innd/innd.h
 	@${REINPLACE_CMD} -e 's!-ltcl!-ltcl83!' ${WRKSRC}/configure
 .endif
+
+pre-install:
+	@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
 
 post-install:
 .if !defined(WITHOUT_STRIP)
Index: pkg-install
===================================================================
RCS file: /home/ncvs/ports/news/inn/pkg-install,v
retrieving revision 1.6
diff -u -r1.6 pkg-install
--- pkg-install	30 Mar 2004 12:52:38 -0000	1.6
+++ pkg-install	27 May 2006 21:46:30 -0000
@@ -6,6 +6,10 @@
 
 case $2 in
     PRE-INSTALL)
+	echo "===>  Checking for old database files"
+	if [ ! -d ${PKG_PREFIX}/news/db ]; then
+		mkdir -p ${PKG_PREFIX}/news/db.dist
+	fi
 	;;
     CHECK-CONF)
 	ETC_DIR=${3}
@@ -37,6 +41,13 @@
 	    ${NEWSBASE}/spool/outgoing \
 	    ${NEWSBASE}/spool/overview \
 	    ${NEWSBASE}/spool/tmp
+
+	if [ -d ${NEWSBASE}/db.dist -a ! -f ${NEWSBASE}/db.dist/* ]; then
+		for f in ${NEWSBASE}/db/*; do
+			cp -pR ${f} ${NEWSBASE}/db.dist
+		done
+	fi
+
 	;;
     *)
 	echo "Unexpected Argument $2!!!"
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/news/inn/pkg-plist,v
retrieving revision 1.22
diff -u -r1.22 pkg-plist
--- pkg-plist	7 May 2006 21:16:15 -0000	1.22
+++ pkg-plist	27 May 2006 21:46:31 -0000
@@ -100,14 +100,22 @@
 news/bin/tally.control
 news/bin/tdx-util
 news/bin/writelog
-news/db/active
-news/db/active.times
-news/db/history
-news/db/history.dir
-%%SUB_WITHOUT_TAGGED_HASH%%news/db/history.hash
-%%SUB_WITHOUT_TAGGED_HASH%%news/db/history.index
-%%SUB_WITH_TAGGED_HASH%%news/db/history.pag
-news/db/newsgroups
+@unexec f=active;       if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+@unexec f=active.times; if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+@unexec f=history;      if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+@unexec f=history.dir;  if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+@unexec f=newsgroups;   if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+@unexec rm -f %D/news/db.dist/active       2> /dev/null || true
+@unexec rm -f %D/news/db.dist/active.times 2> /dev/null || true
+@unexec rm -f %D/news/db.dist/history      2> /dev/null || true
+@unexec rm -f %D/news/db.dist/history.dir  2> /dev/null || true
+@unexec rm -f %D/news/db.dist/newsgroups   2> /dev/null || true
+%%SUB_WITHOUT_TAGGED_HASH%%@unexec f=history.hash;  if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+%%SUB_WITHOUT_TAGGED_HASH%%@unexec f=history.index; if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+%%SUB_WITHOUT_TAGGED_HASH%%@unexec rm -f %D/news/db.dist/history.hash  2> /dev/null || true
+%%SUB_WITHOUT_TAGGED_HASH%%@unexec rm -f %D/news/db.dist/history.index 2> /dev/null || true
+%%SUB_WITH_TAGGED_HASH%%@unexec f=history.pag; if cmp -s %D/news/db/$f %D/news/db.dist/$f; then rm -f %D/news/db/$f; fi
+%%SUB_WITH_TAGGED_HASH%%@unexec rm -f %D/news/db.dist/history.pag 2> /dev/null || true
 news/doc/CONTRIBUTORS
 news/doc/GPL
 news/doc/HACKING
@@ -265,6 +273,7 @@
 @dirrmtry %%ETCDIR%%
 @dirrm news/doc
 @dirrmtry news/db
+@dirrmtry news/db.dist
 @dirrm news/bin/rnews.libexec
 @dirrm news/bin/filter
 @dirrm news/bin/control
Index: UPDATING
===================================================================
RCS file: /home/ncvs/ports/UPDATING,v
retrieving revision 1.335
diff -u -r1.335 UPDATING
--- UPDATING	26 May 2006 15:42:34 -0000	1.335
+++ UPDATING	27 May 2006 21:55:43 -0000
@@ -6,6 +6,16 @@
 time you update your ports collection, before attempting any port
 upgrades.
 
+20060527:
+  AFFECTS: users of news/inn
+  AUTHOR: shaun@inerd.com
+
+  The 2.4.3 port of inn has an unfortunate bug which causes inn's database files
+  to be erased during an uninstall or upgrade. Earlier versions are also
+  affected. The latest port revision fixes this, but before upgrading, users are
+  advised to move their ${PREFIX}/news/db directory out of the way, in order to
+  save the history, active and newsgroups databases from destruction.
+
 20060526:
   AFFECTS: users of security/amavisd-new
   AUTHOR: gkovesdan@t-hosting.hu
--- inn.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



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