[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



>>>>> Hideki Yamane <henrich@debian.or.jp> writes:

 > 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.

[…]

 > --- w3c-linkchecker-4.81/debian/postinst	2012-02-03 19:07:10.000000000 +0900$
 > +++ w3c-linkchecker-4.81/debian/postinst	2012-09-26 07:13:40.000000000 +0900$
 > @@ -1,4 +1,4 @@$
 > -#!/bin/sh$
 > +#!/bin/sh $

	There's a spurious whitespace change going on, and it's for the
	worse.  Otherwise, the patch looks 

 >  # postinst script for w3c-linkchecker$
 >  #$
 >  # see: dh_installdeb(1)$

[…]

 > @@ -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

	As a matter of keeping with a good style, I'd prefer all the
	variable references be double-quoted, unless the Shell
	word-splitting is explicitly required.  Thus:

   +              < "$CFG_TEMPLATE" > "$CFG_TMP"

	(And similarly in the other cases.)

	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.XXXXXXXX)

	TIA.

 >          fi
 
 >          db_get w3c-linkchecker/private_ips

[…]

-- 
FSF associate member #7257


Reply to: