On Sat, 2009-09-12 at 23:15 -0400, Felipe Sateler wrote:
> On Fri, 2009-09-11 at 20:34 -0500, Gunnar Wolf wrote:
> > Felipe Sateler dijo [Fri, Sep 11, 2009 at 04:51:23PM -0400]:
> > > tags 542661 + patch
> > > thanks
> > > 
> > > Attached is a nmudiff that does what I said before.
> > 
> > Thanks.
> > 
> > I don't think this will solve the problem as a whole, although it will
> > for many smaller updates — The configuration file must be
> > auto-upgraded on several major version bumps, and I still have to find
> > a way to properly declare it. Please check the differentes from the
> > version currently shipping in Lenny (0.7.2) or even worse, in etch
> > (0.5.5). This patch you mention _does_ help (and I won't block an NMU
> > if you do it), but I don't think the bug will be closed.
> 
> I have not yet read what the {pre,post}inst code do, but I figure the
> right way to go is:
> 
> 1. If the file has not been modified by the admin, then replace it with
> the new one without asking (the default configuration should be as
> identical as possible to the old one).
> 2. If the file has been modified by the admin, perform the auto update
> and keep the old one in backup.
> 
> If this is done, then everything is OK: users who haven't modified their
> configs will continue to upgrade without asking, and users who have
> modified it will continue to upgrade with asking.
> 
> What other problems do you see? Am I missing something?

I see in the preinst that the file is modified on upgrades
unconditionally. So users would be prompted even if they have not
modified an old config. Attached is a patch that corrects this issue
too.
But it seems like doing what I said before should be possible, if dpkg
allows some way to check if files have been changed. (I'm not sure if
reading directly from /var/lib/dpkg/ is allowed).

-- 
Saludos,
Felipe Sateler
diff -u cherokee-0.99.22/debian/cherokee.preinst cherokee-0.99.22/debian/cherokee.preinst
--- cherokee-0.99.22/debian/cherokee.preinst
+++ cherokee-0.99.22/debian/cherokee.preinst
@@ -31,6 +31,14 @@
 	cat $file >> $LOG
     fi
 
+    # Make sure the configuration file has a trailing whiteline to
+    # avoid confusing the parser (see #528160)
+    CONFFILE=/etc/cherokee.conf
+    if [ -f $CONFFILE -a ! -z "$(tail -1 $CONFFILE)" ]
+    then
+        echo >> $CONFFILE
+    fi
+
     cat <<EOF > $README
 Your Cherokee ${OLD_VERSION} configuration file has been converted to
 the ${NEW_VERSION} format. Automatic conversion is expected to succeed
@@ -44,13 +52,6 @@
 
 case "$action" in
     install)
-	# Make sure the configuration file has a trailing whiteline to
-	# avoid confusing the parser (see #528160)
-	CONFFILE=/etc/cherokee.conf
-	if [ -f $CONFFILE -a ! -z "$(tail -1 $CONFFILE)" ]
-	then
-	    echo >> $CONFFILE
-	fi
 	;;
     upgrade)
 	if (  dpkg --compare-versions "$version" lt 0.6 )
@@ -125,6 +126,14 @@
 	    echo "Merging migrated files into $CONFPATH/cherokee.conf" >> $LOG
 	    cat $TMPCONFPATH/cherokee.conf | /usr/share/cherokee/config_joiner $CONFPATH $TMPCONFPATH > $CONFPATH/cherokee.conf 2>>$LOG
 
+	# Make sure the configuration file has a trailing whiteline to
+	# avoid confusing the parser (see #528160)
+	CONFFILE=/etc/cherokee.conf
+	if [ -f $CONFFILE -a ! -z "$(tail -1 $CONFFILE)" ]
+	    then
+	    echo >> $CONFFILE
+	fi
+
 	    cat <<EOF > $README
 For further information on the migration process, please refer to
 /usr/share/doc/cherokee/README_0.5_to_0.6
@@ -173,13 +182,6 @@
             migrate_conf_versions 0.99 0.9910 0999to09910.py
         fi
 
-	# Make sure the configuration file has a trailing whiteline to
-	# avoid confusing the parser (see #528160)
-	CONFFILE=/etc/cherokee.conf
-	if [ -f $CONFFILE -a ! -z "$(tail -1 $CONFFILE)" ]
-	    then
-	    echo >> $CONFFILE
-	fi
 	;;
     abort-upgrade)
 	;;
diff -u cherokee-0.99.22/debian/changelog cherokee-0.99.22/debian/changelog
--- cherokee-0.99.22/debian/changelog
+++ cherokee-0.99.22/debian/changelog
@@ -1,3 +1,11 @@
+cherokee (0.99.22-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Do not add trailing line to conf file during install time, do it at 
+    build time. Closes: #542661.
+
+ -- Felipe Sateler <fsate...@gmail.com>  Fri, 11 Sep 2009 16:46:03 -0400
+
 cherokee (0.99.22-1) unstable; urgency=low
 
   [ Leonel Nunez ]
diff -u cherokee-0.99.22/debian/rules cherokee-0.99.22/debian/rules
--- cherokee-0.99.22/debian/rules
+++ cherokee-0.99.22/debian/rules
@@ -79,6 +79,9 @@
 
 build-arch-stamp: config.status
 	$(MAKE)
+	echo >> $(CURDIR)/cherokee.conf.sample
+	echo '# Please always leave a trailing newline or otherwise the parser fails' >> $(CURDIR)/cherokee.conf.sample
+	echo '# See http://bugs.debian.org/528160' >> $(CURDIR)/cherokee.conf.sample
 	# $(MAKE) test
 	touch build-arch-stamp
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to