Bug#688736: w3c-linkchecker: modifies conffiles (policy 10.7.3): /etc/w3c/checklink.conf

2012-09-30 Thread Andreas Beckmann
Package: w3c-linkchecker
Followup-For: Bug #688736

Reopening this bug as the fix seems to be incomplete.
/etc/w3c/checklink.conf does not get cleaned up during purge:

2m30.7s ERROR: FAIL: Package purging left files on system:
  /etc/w3c/  owned by: w3c-linkchecker
  /etc/w3c/checklink.confnot owned

Andreas


w3c-linkchecker_4.81-5.log.gz
Description: GNU Zip compressed data


Bug#688736: w3c-linkchecker: modifies conffiles (policy 10.7.3): /etc/w3c/checklink.conf

2012-09-25 Thread Andreas Beckmann
Package: w3c-linkchecker
Version: 4.81-4
Severity: serious
User: debian...@lists.debian.org
Usertags: piuparts

Hi,

during a test with piuparts I noticed your package modifies conffiles.
This is forbidden by the policy, see
http://www.debian.org/doc/debian-policy/ch-files.html#s-config-files

10.7.3: "[...] The easy way to achieve this behavior is to make the
configuration file a conffile. [...] This implies that the default
version will be part of the package distribution, and must not be
modified by the maintainer scripts during installation (or at any
other time)."

Note that once a package ships a modified version of that conffile,
dpkg will prompt the user for an action how to handle the upgrade of
this modified conffile (that was not modified by the user).

Further in 10.7.3: "[...] must not ask unnecessary questions
(particularly during upgrades) [...]"

If a configuration file is customized by a maintainer script after
having asked some debconf questions, it may not be marked as a
conffile. Instead a template could be installed in /usr/share and used
by the postinst script to fill in the custom values and create (or
update) the configuration file (preserving any user modifications!).
This file must be removed during postrm purge.
ucf(1) may help with these tasks.
See also http://wiki.debian.org/DpkgConffileHandling

In https://lists.debian.org/debian-devel/2012/09/msg00412.html and
followups it has been agreed that these bugs are to be filed with
severity serious.

debsums reports modification of the following files,
from the attached log (scroll to the bottom...):

  /etc/w3c/checklink.conf

cheers,

Andreas


w3c-linkchecker_4.81-4.log.gz
Description: GNU Zip compressed data


Bug#688736: w3c-linkchecker: modifies conffiles (policy 10.7.3): /etc/w3c/checklink.conf

2012-09-25 Thread Hideki Yamane
tags 688736 patch
thanks

Hi,

 I've created patch for this bug, piuparts clean one.
 It seems to be good for me, please check it.
 Thanks.


-- 
Regards,

 Hideki Yamane henrich @ debian.or.jp/org
 http://wiki.debian.org/HidekiYamane
diff -Nru w3c-linkchecker-4.81/debian/changelog w3c-linkchecker-4.81/debian/changelog
--- w3c-linkchecker-4.81/debian/changelog	2012-02-11 02:50:53.0 +0900
+++ w3c-linkchecker-4.81/debian/changelog	2012-09-26 07:24:37.0 +0900
@@ -1,3 +1,19 @@
+w3c-linkchecker (4.81-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/{postinst,w3c-linkchecker.install}
+- Not use linkchecker.conf as conffile but template file and use ucf
+  for conffile. It prevents modifing conffiles (violate policy 10.7.3)
+  (Closes: #688736)
+  * debian/control
+- "Depends: ucf"
+  * debian/postrm
+- remove /etc/w3c/checklink.conf and temprary files when purging package. 
+  * debian/config
+- fix some cosmetic things
+
+ -- Hideki Yamane   Wed, 26 Sep 2012 07:24:33 +0900
+
 w3c-linkchecker (4.81-4) unstable; urgency=low
 
   * Updated Czech translation (Closes: #658398)
diff -Nru w3c-linkchecker-4.81/debian/config w3c-linkchecker-4.81/debian/config
--- w3c-linkchecker-4.81/debian/config	2012-02-03 19:07:10.0 +0900
+++ w3c-linkchecker-4.81/debian/config	2012-09-26 04:51:33.0 +0900
@@ -1,11 +1,13 @@
-#!/bin/sh -e
+#!/bin/sh
 
 set -e
 
 # Source debconf library.
 . /usr/share/debconf/confmodule
+db_version 2.0
 
 db_input low w3c-linkchecker/hostname || true
 db_input low w3c-linkchecker/private_ips || true
 db_go
 
+exit 0
diff -Nru w3c-linkchecker-4.81/debian/control w3c-linkchecker-4.81/debian/control
--- w3c-linkchecker-4.81/debian/control	2012-02-05 04:13:56.0 +0900
+++ w3c-linkchecker-4.81/debian/control	2012-09-26 06:48:04.0 +0900
@@ -16,7 +16,7 @@
 Depends: ${misc:Depends}, ${perl:Depends}, libcss-dom-perl,
  libhtml-parser-perl, libwww-perl (>= 5.833), liburi-perl (>= 1.53),
  libconfig-general-perl, libnet-ip-perl, libterm-readkey-perl,
- libencode-locale-perl
+ libencode-locale-perl, ucf
 Recommends: w3c-markup-validator, apache2 | httpd-cgi
 Description: tool to verify the links in a web page are still valid
  This manual page documents briefly the checklink command, a.k.a. the W3C®
diff -Nru w3c-linkchecker-4.81/debian/postinst w3c-linkchecker-4.81/debian/postinst
--- w3c-linkchecker-4.81/debian/postinst	2012-02-03 19:07:10.0 +0900
+++ w3c-linkchecker-4.81/debian/postinst	2012-09-26 07:13:40.0 +0900
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh 
 # postinst script for w3c-linkchecker
 #
 # see: dh_installdeb(1)
@@ -6,6 +6,7 @@
 set -e
 
 . /usr/share/debconf/confmodule
+db_version 2.0
 
 # summary of how this script can be called:
 #*  `configure' 
@@ -23,12 +24,15 @@
 case "$1" in
 configure)
 
+CFG_TEMPLATE=/usr/share/w3c-linkchecker/checklink.conf
+CFG_TMP=/etc/w3c/checklink.conf.tmp
 CFG_FILE=/etc/w3c/checklink.conf
 
 db_get w3c-linkchecker/hostname
 if [ "$RET" ]
 then
-sed -i -e "s|^Doc_URI = http://[a-z0-9.]\+/|Doc_URI = http://$RET/|" $CFG_FILE
+sed -e "s|^Doc_URI = http://[a-z0-9.]\+/|Doc_URI = http://$RET/|" \
+  < $CFG_TEMPLATE > $CFG_TMP
 fi
 
 db_get w3c-linkchecker/private_ips
@@ -39,9 +43,14 @@
 then
 VALUE=0
 fi
-sed -i -e "s|^\(# \)\?Allow_Private_IPs = [01]$|Allow_Private_IPs = $VALUE|" $CFG_FILE
+sed -e "s|^\(# \)\?Allow_Private_IPs = [01]$|Allow_Private_IPs = $VALUE|" \
+  < $CFG_TEMPLATE > $CFG_TMP
 fi
 
+ucf --debconf-ok $CFG_TMP $CFG_FILE && rm -f $CFG_TMP
+db_stop
+
+
 ;;
 
 abort-upgrade|abort-remove|abort-deconfigure)
diff -Nru w3c-linkchecker-4.81/debian/postrm w3c-linkchecker-4.81/debian/postrm
--- w3c-linkchecker-4.81/debian/postrm	1970-01-01 09:00:00.0 +0900
+++ w3c-linkchecker-4.81/debian/postrm	2012-09-26 07:11:37.0 +0900
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+CFG_FILE=/etc/w3c/checklink.conf
+
+case "$1" in
+purge)
+
+if which ucf >/dev/null 2>&1; then
+ucf --purge $CFG_FILE
+else
+rm -f $CFG_FILE
+fi
+
+for ext in .bak .tmp .dpkg-tmp .dkpg-new .dpkg-old .ucf-new .ucf-old .ucf-dist
+do
+   rm -f $CFG_FILE$ext
+done
+
+;;
+
+remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+;;
+
+*)
+echo "postrm called with unknown argument \`$1'" >&2
+exit 1
+;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff -Nru w3c-linkchecker-4.81/debian/w3c-linkchecker.install w3c-linkchecker-4.81/debian/w3c-linkchecker.install
--- w3c-linkchecker-4.81/debian/w3c-linkchecker.install	2012-02-03 19:07:10.0 +0900
+++ w3c-linkchecker-4.81/debian/w3c-linkch

Bug#688736: w3c-linkchecker: modifies conffiles (policy 10.7.3): /etc/w3c/checklink.conf

2012-09-25 Thread Nicholas Bamber
tag 688736 +patch
thanks

Hideki,
Thanks for the patch. I'll be happy to apply and acknowledge the patch.
I am however concerned that the it appears the version of piuparts which
generates these reports is not yet in sid, and I would like to hold off
working on it until it is.

There is also the small matter that some work was already pending on
this package but which cannot go into Wheezy. So that will have to be
moved into a git branch.

On 25/09/12 23:28, Hideki Yamane wrote:
> tags 688736 patch
> thanks
> 
> Hi,
> 
>  I've created patch for this bug, piuparts clean one.
>  It seems to be good for me, please check it.
>  Thanks.
> 
> 
> 
> 
> 
> ___
> pkg-perl-maintainers mailing list
> pkg-perl-maintain...@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-maintainers


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#688736: w3c-linkchecker: modifies conffiles (policy 10.7.3): /etc/w3c/checklink.conf

2012-09-28 Thread Nicholas Bamber
On 26/09/12 07:35, Ivan Shmakov wrote:
>> Russ Allbery  writes:
>> Ivan Shmakov  writes:
> 
>  >> What bothers me more, however, is that the ${CFG_TMP} filename bears
>  >> an utterly generic “.tmp” suffix, and should, for one reason or
>  >> another, such a filename exist at the time .postinst is run, we're
>  >> going to silently overwrite it.
> 
>  >> Thus, my preference would be to use mktemp(1), e. g.:
> 
>  >> +CFG_TMP=$(mktemp -- /etc/w3c/.checklink.conf.)
> 
>  >> TIA.
> 
>  > Another standard approach here is to use .dpkg-new, which is used by
>  > dpkg for conffiles for a similar purpose and which local
>  > administrators are therefore used to seeing if it gets left behind
>  > for some reason.
> 
>   Indeed.
> 

I am generally happy with the patch (and the dpkg-new suggestion) on
inspection. However I feel slightly queezy about the "db_version" stuff.
It seems likely to be harmless. However I can find only the briefest of
documentation about it. It can return an error which presumably should
be checked. I can't find anything in Policy saying it should be used or
any recommendations on why it is advisable.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#688736: [Piuparts-devel] Bug#688736: w3c-linkchecker: modifies conffiles (policy 10.7.3): /etc/w3c/checklink.conf

2012-09-26 Thread Holger Levsen
Hi Nicolas,

On Mittwoch, 26. September 2012, Nicholas Bamber wrote:
>   Thanks for the patch. I'll be happy to apply and acknowledge the 
patch.
> I am however concerned that the it appears the version of piuparts which
> generates these reports is not yet in sid, and I would like to hold off
> working on it until it is.

The piuparts version in sid (or elsewhere) doesn't matter, the point is your 
package is buggy. Seriously buggy even! One can detect this (and suffer by it) 
easily without piuparts, so please fix the bug and don't complain about the 
messanger not having shaved for 3 days. 

I was too lazy to reply on -devel about this, but as you keep insisting... ;-)


cheers,
Holger


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org