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

Re: ITS: webfs (updated package)



Hi Mats!

Am 03.12.2010 13:21, schrieb Mats Erik Andersson:

>> I'm looking at it now...  Just one question, is there a reason why you
>> use "rm $TEMPCONFFILE 2>/dev/null || true" instead of "rm -f $TEMPCONFFILE"?
>>
>> It's not wrong, but longer ;)

> No really valid reason at all, only that the policy mandates maintainer
> scripts to append the "or-true construct" to capture exceptional states.

Yes, as many other programs don't allow you to catch things properly.

As said:  Using "||true" is not false, it's just uncommon ;)


> My first formulation used "rm -f". Then I came to think of lintian
> complaining on this within the rules file, and again pointing to the
> "or-true" mechanism.

Huh?  Which version of lintian are you using?  I just played a bit with
the following:

--- webfs-1.21+ds1/debian/rules 2010-11-30 18:54:59.000000000 +0100
+++ webfs-1.21+ds1/debian/rules 2010-12-03 13:29:00.000000000 +0100
@@ -27,6 +27,7 @@
        dh_install --sourcedir=$(builddir)
        dh_installchangelogs -a -k README
        dh --after dh_auto_install $@
+       rm -f /tmp/this/file/doesnt/exist

and the following in your posinst:
-       rm $TEMPCONFFILE 2>/dev/null || true
+       rm -f $TEMPCONFFILE

lintian 2.4.3 didn't complained about any of these two.  And I would
have been suprised, if it had.


> I could use a piece of advice here, and I do not object to changing
> the formulation back again!

Too lazy to look up policy, but in general you should handle errors
gracefully.  Which means:  "rm $probably_existing_file" is wrong, as it
bails out, if the file doesn't exist.  "rm -f $probably_existing_file"
handles this situation, as it doesn't give an error, if the file is not
there. lintian, smart as it is, knows that ;)

An other example:  Your rules file calls a Makefile, generated by a
configure script.  In your clean rule, you could call "$(MAKE) clean",
which would give an error, if Makefile is not present (which is
possible).  You could use "-$(MAKE) clean" (which was BTW, recommended
for some time), but that would not only the error caused by Makefile not
being present, but ALL errors.  Therefore you should first test if there
is a Makefile, and only call the clean target, if there is one.  There
is a lintian test for that.

Does that explanation help?


Best regards,
  Alexander


Reply to: