possible mass-bug filing on fc-cache-using packages

2008-05-20 Thread martin f krafft
Hi folks,

I noticed the other day that there are quite a few packages like
ttf-bitstream-vera which do the following in
/var/lib/dpkg/info/ttf-bitstream-vera.postinst:

  if [ $1 = configure -a -x /usr/bin/fc-cache ]
  then
echo -n Regenerating fonts cache... 
HOME=/root fc-cache -f -v 1/var/log/fontconfig.log 21 || \
(echo failed; see /var/log/fontconfig.log for more information.; \
exit 1)
echo done.
  fi

This is wrong. Using ()'s creates a subshell, and exit then only
exits the subshell, not the postinst (which I believe it's supposed
to do). The code either needs an || exit $? appended, or {}'s
should be used. Compare

  sh -c '( echo foo; exit 1; ); echo bar' 
  sh -c '{ echo foo; exit 1; }; echo bar' 

The reason seems to be brainless cut-n-pasting.

I think this calls for a mass-bug filing on fc-cache-using packages,
severity minor. But instead of having everyone fix this, I wonder
why debhelper isn't taking care of this. Thoughts?

-- 
 .''`.   martin f. krafft [EMAIL PROTECTED]
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
even a stopped clock gives the right time twice a day.
-- orbital


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)


Re: possible mass-bug filing on fc-cache-using packages

2008-05-20 Thread brian m. carlson

On Tue, May 20, 2008 at 12:05:46PM +0100, martin f krafft wrote:

Hi folks,

I noticed the other day that there are quite a few packages like
ttf-bitstream-vera which do the following in
/var/lib/dpkg/info/ttf-bitstream-vera.postinst:

 if [ $1 = configure -a -x /usr/bin/fc-cache ]
 then
   echo -n Regenerating fonts cache... 
   HOME=/root fc-cache -f -v 1/var/log/fontconfig.log 21 || \
   (echo failed; see /var/log/fontconfig.log for more information.; \
   exit 1)
   echo done.
 fi

This is wrong. Using ()'s creates a subshell, and exit then only
exits the subshell, not the postinst (which I believe it's supposed
to do). The code either needs an || exit $? appended, or {}'s
should be used. Compare


I could be wrong, but if the subshell exits 1, then the entire
expression is false, and so if you are using set -e like you're
supposed to, then the postinst fails.

For example, at the prompt, try:
  (set -e; echo 1; false || (echo error; exit 1); echo 2)
which will never print 2.

ttf-bitstream-vera isn't using set -e, which is probably a bug.  ISTR
that policy dictated set -e.

--
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
troff on top of XML: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187


signature.asc
Description: Digital signature


Re: possible mass-bug filing on fc-cache-using packages

2008-05-20 Thread Josselin Mouette
Le mardi 20 mai 2008 à 12:05 +0100, martin f krafft a écrit :
   if [ $1 = configure -a -x /usr/bin/fc-cache ]

Note -that the $1 = configure check is wrong, see #446856.

 (echo failed; see /var/log/fontconfig.log for more information.; \
 exit 1)

 This is wrong. Using ()'s creates a subshell, and exit then only
 exits the subshell, not the postinst (which I believe it's supposed
 to do). 

Since the postinst uses set -e, it will also exit it.

 But instead of having everyone fix this, I wonder
 why debhelper isn't taking care of this. Thoughts?

This is not needed anymore. Fontconfig should manage this through a
trigger, removing entirely those snippets.

Cheers,
-- 
 .''`.
: :' :  We are debian.org. Lower your prices, surrender your code.
`. `'   We will add your hardware and software distinctiveness to
  `-our own. Resistance is futile.


signature.asc
Description: Ceci est une partie de message	numériquement signée


Re: possible mass-bug filing on fc-cache-using packages

2008-05-20 Thread martin f krafft
also sprach brian m. carlson [EMAIL PROTECTED] [2008.05.20.1321 +0100]:
 I could be wrong, but if the subshell exits 1, then the entire
 expression is false, and so if you are using set -e like you're
 supposed to, then the postinst fails.

The policy mentions it, but it doesn't say set -e is required.
ttf-bitstream-vera does not use it.

 ttf-bitstream-vera isn't using set -e, which is probably a bug.  ISTR
 that policy dictated set -e.

I don't think so, section 6.1:

  or shell scripts this means that you almost always need to use set
  -e (this is usually true when writing shell scripts, in fact).

This, to me, is waste of space in a policy document.



also sprach Josselin Mouette [EMAIL PROTECTED] [2008.05.20.1323 +0100]:
 Le mardi 20 mai 2008 à 12:05 +0100, martin f krafft a écrit :
if [ $1 = configure -a -x /usr/bin/fc-cache ]
 
 Note -that the $1 = configure check is wrong, see #446856.

Also, the -a is a bashism, isn't it?

 Since the postinst uses set -e, it will also exit it.

It does not.

  But instead of having everyone fix this, I wonder
  why debhelper isn't taking care of this. Thoughts?
 
 This is not needed anymore. Fontconfig should manage this through a
 trigger, removing entirely those snippets.

Okay, that should make it easier... :)

-- 
 .''`.   martin f. krafft [EMAIL PROTECTED]
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
it isn't pollution that's harming the environment.
 it's the impurities in our air and water that are doing it. 
  - dan quayle


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)


Re: possible mass-bug filing on fc-cache-using packages

2008-05-20 Thread Adam D. Barratt

martin f krafft wrote, Tuesday, May 20, 2008 1:41 PM

also sprach Josselin Mouette [EMAIL PROTECTED] [2008.05.20.1323 +0100]:
 Le mardi 20 mai 2008 à 12:05 +0100, martin f krafft a écrit :
if [ $1 = configure -a -x /usr/bin/fc-cache ]

 Note -that the $1 = configure check is wrong, see #446856.

Also, the -a is a bashism, isn't it?


It is, but one that policy 10.4 explicitly permits.

Adam 



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]