Package: fts
Version: 1.1-1
Severity: serious
Tags: patch

Hi,

actually I only wanted to look whether #674007 can be fixed easily ...
but then I found a lot of serious errors handling /etc/fts/config:

* upstream git repository has moved (ok, found the new location)
* incorrect usage of debconf in postrm purge
* shipping /etc/fts/config as conffile *and* generating it in postinst
* having the template in /usr/share/doc/ instead of /usr/share/fts/
* not using ucfr/ucfr --purge
* not using ucf --purge in postinst (install, purge, install - and ucf
  will notice that the config file was deleted inbetween and keep it
  that way)

I have all the changes that are combined (and duplicated due to the
upstream repository layout) in the attached diff as separate git
commits, I just need to push the repository somewhere so that you can
pull ... from here: git://github.com/anbe42/tmp-fts.git

Since I brought the package into shape so far, I can also NMU it ... and
I intend to do so in a few days.


Andreas
diffstat for fts-1.1 fts-1.1

 contrib/packaging/debian/fts/debian/changelog    |   17 +++++++++++++++
 contrib/packaging/debian/fts/debian/control      |    6 ++---
 contrib/packaging/debian/fts/debian/fts.dirs     |    1 
 contrib/packaging/debian/fts/debian/fts.docs     |    1 
 contrib/packaging/debian/fts/debian/fts.install  |    2 -
 contrib/packaging/debian/fts/debian/fts.postinst |    3 +-
 contrib/packaging/debian/fts/debian/fts.postrm   |   25 ++++++++++++++++-------
 contrib/packaging/debian/fts/package.sh          |    2 -
 debian/changelog                                 |   17 +++++++++++++++
 debian/control                                   |    6 ++---
 debian/fts.dirs                                  |    1 
 debian/fts.docs                                  |    1 
 debian/fts.install                               |    2 -
 debian/fts.postinst                              |    3 +-
 debian/fts.postrm                                |   25 ++++++++++++++++-------
 15 files changed, 85 insertions(+), 27 deletions(-)

diff -Nru fts-1.1/contrib/packaging/debian/fts/debian/changelog fts-1.1/contrib/packaging/debian/fts/debian/changelog
--- fts-1.1/contrib/packaging/debian/fts/debian/changelog	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/debian/changelog	2013-02-14 03:49:19.000000000 +0100
@@ -1,3 +1,20 @@
+fts (1.1-1.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Update Homepage and Vcs URLs to https://github.com/gonicus/fts.
+  * fts.postrm: Do not fail to purge if the config file is not there.
+    (Closes: #674007)
+  * fts.postrm: Fix debconf usage during purge. Load the module before doing
+    any actions (this re-execs the postinst). Move #DEBHELPER# token to the
+    end s.t. we can do db_get before db_purge is run.
+  * Ship default config as /usr/share/fts/config, postinst may not rely on
+    /usr/share/doc/fts/config (Policy 12.3).
+  * Do not ship /etc/fts/config as a conffile, postinst generates it.
+  * Register and purge /etc/fts/config with ucf/ucfr.
+  * Ship empty /var/lib/tftpboot directory.
+
+ -- Andreas Beckmann <a...@debian.org>  Thu, 14 Feb 2013 02:10:51 +0100
+
 fts (1.1-1) unstable; urgency=low
 
   * New upstream release.
diff -Nru fts-1.1/contrib/packaging/debian/fts/debian/control fts-1.1/contrib/packaging/debian/fts/debian/control
--- fts-1.1/contrib/packaging/debian/fts/debian/control	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/debian/control	2013-02-14 03:49:19.000000000 +0100
@@ -5,9 +5,9 @@
 Build-Depends: debhelper (>= 7.0.50~), python (>= 2.6.6-3~), python-setuptools
 X-Python-Version: >= 2.6
 Standards-Version: 3.9.2
-Homepage: https://github.com/clacks/fts
-Vcs-Browser: https://github.com/clacks/fts
-Vcs-Git: git://github.com/clacks/fts.git
+Homepage: https://github.com/gonicus/fts
+Vcs-Browser: https://github.com/gonicus/fts
+Vcs-Git: git://github.com/gonicus/fts.git
 
 Package: fts
 Architecture: all
diff -Nru fts-1.1/contrib/packaging/debian/fts/debian/fts.dirs fts-1.1/contrib/packaging/debian/fts/debian/fts.dirs
--- fts-1.1/contrib/packaging/debian/fts/debian/fts.dirs	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/debian/fts.dirs	2013-02-14 03:49:19.000000000 +0100
@@ -1,2 +1,3 @@
 usr/sbin
 etc/fts
+var/lib/tftpboot
diff -Nru fts-1.1/contrib/packaging/debian/fts/debian/fts.docs fts-1.1/contrib/packaging/debian/fts/debian/fts.docs
--- fts-1.1/contrib/packaging/debian/fts/debian/fts.docs	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/debian/fts.docs	2013-02-14 03:49:19.000000000 +0100
@@ -1,2 +1 @@
-config
 debian/README.Debian
diff -Nru fts-1.1/contrib/packaging/debian/fts/debian/fts.install fts-1.1/contrib/packaging/debian/fts/debian/fts.install
--- fts-1.1/contrib/packaging/debian/fts/debian/fts.install	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/debian/fts.install	2013-02-14 03:49:19.000000000 +0100
@@ -2,4 +2,4 @@
 usr/lib/python*/dist-packages/fts
 usr/lib/python*/dist-packages/fts-*.egg-info
 ../rsyslog/fts.conf /etc/rsyslog.d
-../../config /etc/fts
+../../config		/usr/share/fts/
diff -Nru fts-1.1/contrib/packaging/debian/fts/debian/fts.postinst fts-1.1/contrib/packaging/debian/fts/debian/fts.postinst
--- fts-1.1/contrib/packaging/debian/fts/debian/fts.postinst	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/debian/fts.postinst	2013-02-14 03:49:19.000000000 +0100
@@ -36,8 +36,9 @@
 
 	# Apply to config
 	sed -e "s~^path\s*=\s*/.*$~path = $tftppath/pxelinux.cfg~" \
-		-e "s~^static-path\s*=\s*/.*$~static-path = $tftppath/pxelinux.static~" /usr/share/doc/fts/config > /etc/fts/config.debconf-tmp
+		-e "s~^static-path\s*=\s*/.*$~static-path = $tftppath/pxelinux.static~" /usr/share/fts/config > /etc/fts/config.debconf-tmp
 	ucf --three-way --debconf-ok /etc/fts/config.debconf-tmp /etc/fts/config
+	ucfr fts /etc/fts/config
 	rm -f /etc/fts/config.debconf-tmp || true
 	;;
 
diff -Nru fts-1.1/contrib/packaging/debian/fts/debian/fts.postrm fts-1.1/contrib/packaging/debian/fts/debian/fts.postrm
--- fts-1.1/contrib/packaging/debian/fts/debian/fts.postrm	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/debian/fts.postrm	2013-02-14 03:49:19.000000000 +0100
@@ -2,20 +2,29 @@
 
 set -e
 
-#DEBHELPER#
-
 if [ "$1" = "purge" ] ; then
+    . /usr/share/debconf/confmodule
+
     deluser --quiet --system tftpd > /dev/null || true
     delgroup --quiet --system tftpd > /dev/null || true
 
     # Remove configuration file
-    rm /etc/fts/config
-    if [ -d "/etc/fts" ]; then
-        rmdir "$f" || { chown root:root "$f" && chmod 00700 "$f"; }
-    fi
+	ftsconfig=/etc/fts/config
+
+	for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do
+		rm -f "$ftsconfig$ext"
+	done
+
+	rm -f $ftsconfig
+
+	if which ucf >/dev/null; then
+		ucf --purge $ftsconfig
+	fi
+	if which ucfr >/dev/null; then
+		ucfr --purge fts $ftsconfig
+	fi
 
     # See if there's some stuff that is not created by us
-    . /usr/share/debconf/confmodule
     db_version 2.0
     db_get "fts/tftppath"
     tftppath="$RET"
@@ -24,3 +33,5 @@
     rmdir "$tftppath/pxelinux.cfg" || true
     rmdir "$tftppath/pxelinux.static" || true
 fi
+
+#DEBHELPER#
diff -Nru fts-1.1/contrib/packaging/debian/fts/package.sh fts-1.1/contrib/packaging/debian/fts/package.sh
--- fts-1.1/contrib/packaging/debian/fts/package.sh	2012-05-21 15:47:26.000000000 +0200
+++ fts-1.1/contrib/packaging/debian/fts/package.sh	2013-02-14 03:49:19.000000000 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 NAME=fts
-VERSION=`parsechangelog | sed -n 's/^Version:\s*\(.*\)-[0-9][0-9]*$/\1/p'`
+VERSION=`parsechangelog | sed -n 's/^Version:\s*\(.*\)-\(.*\)*$/\1/p'`
 
 #----
 
diff -Nru fts-1.1/debian/changelog fts-1.1/debian/changelog
--- fts-1.1/debian/changelog	2012-05-19 11:04:50.000000000 +0200
+++ fts-1.1/debian/changelog	2013-02-14 03:48:57.000000000 +0100
@@ -1,3 +1,20 @@
+fts (1.1-1.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Update Homepage and Vcs URLs to https://github.com/gonicus/fts.
+  * fts.postrm: Do not fail to purge if the config file is not there.
+    (Closes: #674007)
+  * fts.postrm: Fix debconf usage during purge. Load the module before doing
+    any actions (this re-execs the postinst). Move #DEBHELPER# token to the
+    end s.t. we can do db_get before db_purge is run.
+  * Ship default config as /usr/share/fts/config, postinst may not rely on
+    /usr/share/doc/fts/config (Policy 12.3).
+  * Do not ship /etc/fts/config as a conffile, postinst generates it.
+  * Register and purge /etc/fts/config with ucf/ucfr.
+  * Ship empty /var/lib/tftpboot directory.
+
+ -- Andreas Beckmann <a...@debian.org>  Thu, 14 Feb 2013 02:10:51 +0100
+
 fts (1.1-1) unstable; urgency=low
 
   * New upstream release.
diff -Nru fts-1.1/debian/control fts-1.1/debian/control
--- fts-1.1/debian/control	2012-05-21 15:55:09.000000000 +0200
+++ fts-1.1/debian/control	2013-02-14 02:10:48.000000000 +0100
@@ -5,9 +5,9 @@
 Build-Depends: debhelper (>= 7.0.50~), python (>= 2.6.6-3~), python-setuptools
 X-Python-Version: >= 2.6
 Standards-Version: 3.9.2
-Homepage: https://github.com/clacks/fts
-Vcs-Browser: https://github.com/clacks/fts
-Vcs-Git: git://github.com/clacks/fts.git
+Homepage: https://github.com/gonicus/fts
+Vcs-Browser: https://github.com/gonicus/fts
+Vcs-Git: git://github.com/gonicus/fts.git
 
 Package: fts
 Architecture: all
diff -Nru fts-1.1/debian/fts.dirs fts-1.1/debian/fts.dirs
--- fts-1.1/debian/fts.dirs	2012-01-12 13:34:41.000000000 +0100
+++ fts-1.1/debian/fts.dirs	2013-02-14 03:48:18.000000000 +0100
@@ -1,2 +1,3 @@
 usr/sbin
 etc/fts
+var/lib/tftpboot
diff -Nru fts-1.1/debian/fts.docs fts-1.1/debian/fts.docs
--- fts-1.1/debian/fts.docs	2012-01-12 13:34:41.000000000 +0100
+++ fts-1.1/debian/fts.docs	2013-02-14 02:51:02.000000000 +0100
@@ -1,2 +1 @@
-config
 debian/README.Debian
diff -Nru fts-1.1/debian/fts.install fts-1.1/debian/fts.install
--- fts-1.1/debian/fts.install	2012-05-21 12:05:23.000000000 +0200
+++ fts-1.1/debian/fts.install	2013-02-14 02:52:20.000000000 +0100
@@ -2,4 +2,4 @@
 usr/lib/python*/dist-packages/fts
 usr/lib/python*/dist-packages/fts-*.egg-info
 ../rsyslog/fts.conf /etc/rsyslog.d
-../../config /etc/fts
+../../config		/usr/share/fts/
diff -Nru fts-1.1/debian/fts.postinst fts-1.1/debian/fts.postinst
--- fts-1.1/debian/fts.postinst	2012-05-19 11:03:01.000000000 +0200
+++ fts-1.1/debian/fts.postinst	2013-02-14 03:21:13.000000000 +0100
@@ -36,8 +36,9 @@
 
 	# Apply to config
 	sed -e "s~^path\s*=\s*/.*$~path = $tftppath/pxelinux.cfg~" \
-		-e "s~^static-path\s*=\s*/.*$~static-path = $tftppath/pxelinux.static~" /usr/share/doc/fts/config > /etc/fts/config.debconf-tmp
+		-e "s~^static-path\s*=\s*/.*$~static-path = $tftppath/pxelinux.static~" /usr/share/fts/config > /etc/fts/config.debconf-tmp
 	ucf --three-way --debconf-ok /etc/fts/config.debconf-tmp /etc/fts/config
+	ucfr fts /etc/fts/config
 	rm -f /etc/fts/config.debconf-tmp || true
 	;;
 
diff -Nru fts-1.1/debian/fts.postrm fts-1.1/debian/fts.postrm
--- fts-1.1/debian/fts.postrm	2012-05-19 11:03:01.000000000 +0200
+++ fts-1.1/debian/fts.postrm	2013-02-14 03:24:02.000000000 +0100
@@ -2,20 +2,29 @@
 
 set -e
 
-#DEBHELPER#
-
 if [ "$1" = "purge" ] ; then
+    . /usr/share/debconf/confmodule
+
     deluser --quiet --system tftpd > /dev/null || true
     delgroup --quiet --system tftpd > /dev/null || true
 
     # Remove configuration file
-    rm /etc/fts/config
-    if [ -d "/etc/fts" ]; then
-        rmdir "$f" || { chown root:root "$f" && chmod 00700 "$f"; }
-    fi
+	ftsconfig=/etc/fts/config
+
+	for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do
+		rm -f "$ftsconfig$ext"
+	done
+
+	rm -f $ftsconfig
+
+	if which ucf >/dev/null; then
+		ucf --purge $ftsconfig
+	fi
+	if which ucfr >/dev/null; then
+		ucfr --purge fts $ftsconfig
+	fi
 
     # See if there's some stuff that is not created by us
-    . /usr/share/debconf/confmodule
     db_version 2.0
     db_get "fts/tftppath"
     tftppath="$RET"
@@ -24,3 +33,5 @@
     rmdir "$tftppath/pxelinux.cfg" || true
     rmdir "$tftppath/pxelinux.static" || true
 fi
+
+#DEBHELPER#

Reply via email to