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

Bug#659822: RFS: mpd-sima/0.9.0-1 (New upstream version)



* Benoît Knecht <benoit.knecht@fsfe.org>, 2012-02-17, 12:01:
- In debian/mpd-sima.postrm, you use awk but you don't Depend on it.
Right, I replaced it with a “grep | cut” alternative.

While I personally don't like awk :P, but if you like it, you _can_ use it in maintainer scripts without depending on it. awk is (in a way) an essential package:
http://lists.debian.org/debian-mentors/2005/11/msg00193.html

I believe that lintian would yell at you if you had unversioned dependency on awk. (And versioned dependency on awk would render your package uninstallable. :P)

Interesting. In my package (minidlna), I'm depending on (gawk | mawk), because I'm using awk in one of the maintainers scripts too; I take it I should remove it, right?

If you use only basic functionality of awk, you can remove it, yes.

You're also checking if /usr/sbin/deluser is executable and silently not removing the user if it's not (same thing for delgroup). Since you Depend on adduser, you should assume these commands exist, and it should be an error visible to the user if they don't.
Corrected as well.
Err. What Policy §6.5 says: “[…] all ‘postrm’ actions may only rely on essential packages and must gracefully skip any actions that require the package's dependencies if those dependencies are unavailable.”

So checking for existence of /usr/sbin/deluser _is_ the right thing if you want to use it. See this however:
http://lists.debian.org/debian-devel/2012/02/msg00094.html

Yes, I realize now my advice was misleading at best.

Or I might have misread it. :)

What I meant is that you should try running the command anyway, so that the error becomes visible to the user, but then catch the exit status; something like:

 deluser ${USER} || echo "Removing ${USER} failed."

This way, if the user is watching the output, they will know they need to remove the user by hand afterwards. Does it make sense? (Again, I'm doing this in my package, so I'd like to know if that's wrong.)

You should redirect the message to stderr. Other than that, I doesn't look crazy, but I don't have a strong opinion about that.

The only example that is included in the Policy is:

if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
         . /usr/share/debconf/confmodule
         db_purge
fi

(However debconf, in contrast to deluser, is supposed to work even when its dependencies are not installed.)

I took a look at packages installed on my system, and there appears to be great variety of style of this “gracefully skipping” in the wild. Perhaps it's something worth standardising.

--
Jakub Wilk



Reply to: