Re: Re: really? (Debian Policy and LSB)
Le 11.04.2012 22:04, Raphael Hertzog a écrit : > On Wed, 11 Apr 2012, Nicholas Bamber wrote: >> Hmm... This contradicts section 6.1 of the Debian policy. >> >> "The package management system looks at the exit status from these >> scripts. It is important that they exit with a non-zero status if > > Here "these scripts" refer to "package maintainer scripts" > ({pre,post}{inst,rm}) and not to "init scripts". So there's no > contradiction. > > The problem of using "set -e" in init script is even documented > in policy 9.3.2: > http://www.debian.org/doc/debian-policy/ch-opersys.html#s-writing-init For what is worth, this has been discussed at length in #546743 and is now documented as the #661002 bug against lsb-base. Please note that #661002 "lsb-base:/lib/lsb/init-functions may fail if `set -e` is used" is tagged as +help: patches are welcome and could eventually lead to a fix in policy. (Deciding whether energy should be put in functions for SysVinit is up to each reader.) Cheers, OdyX signature.asc Description: OpenPGP digital signature
Re: really? (Debian Policy and LSB)
Ah thanks. YEs that rings a bell now. On 11/04/12 21:04, Raphael Hertzog wrote: Hi, On Wed, 11 Apr 2012, Nicholas Bamber wrote: Hmm... This contradicts section 6.1 of the Debian policy. "The package management system looks at the exit status from these scripts. It is important that they exit with a non-zero status if Here "these scripts" refer to "package maintainer scripts" ({pre,post}{inst,rm}) and not to "init scripts". So there's no contradiction. The problem of using "set -e" in init script is even documented in policy 9.3.2: http://www.debian.org/doc/debian-policy/ch-opersys.html#s-writing-init | Be careful of using set -e in init.d scripts. Writing correct init.d | scripts requires accepting various error exit statuses when daemons are | already running or already stopped without aborting the init.d script, and | common init.d function libraries are not safe to call with set -e in | effect[72]. For init.d scripts, it's often easier to not use set -e and | instead check the result of each command separately. | | [72] /lib/lsb/init-functions, which assists in writing LSB-compliant | init scripts, may fail if set -e is in effect and echoing status messages | to the console fails, for example. Cheers, -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4f85e540.7040...@periapt.co.uk
Re: really? (Debian Policy and LSB)
Hi, On Wed, 11 Apr 2012, Nicholas Bamber wrote: > Hmm... This contradicts section 6.1 of the Debian policy. > > "The package management system looks at the exit status from these > scripts. It is important that they exit with a non-zero status if Here "these scripts" refer to "package maintainer scripts" ({pre,post}{inst,rm}) and not to "init scripts". So there's no contradiction. The problem of using "set -e" in init script is even documented in policy 9.3.2: http://www.debian.org/doc/debian-policy/ch-opersys.html#s-writing-init | Be careful of using set -e in init.d scripts. Writing correct init.d | scripts requires accepting various error exit statuses when daemons are | already running or already stopped without aborting the init.d script, and | common init.d function libraries are not safe to call with set -e in | effect[72]. For init.d scripts, it's often easier to not use set -e and | instead check the result of each command separately. | | [72] /lib/lsb/init-functions, which assists in writing LSB-compliant | init scripts, may fail if set -e is in effect and echoing status messages | to the console fails, for example. Cheers, -- Raphaël Hertzog ◈ Debian Developer Pre-order a copy of the Debian Administrator's Handbook and help liberate it: http://debian-handbook.info/liberation/ -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120411200431.gg16...@rivendell.home.ouaza.com
really? (Debian Policy and LSB)
tag 621020 +moreinfo thanks Regarding #621020 "/etc/init.d/mysql uses "set -e" for most of the script, but that is not compatible with the LSB library /lib/lsb/init-functions. This particularly causes problems whenever log_end_msg is called with a nonzero argument, as log_end_msg will return that argument and halt the script. So there are several chunks of code that will never be called (some informational messages and the stop-using-kill bit)." Hmm... This contradicts section 6.1 of the Debian policy. "The package management system looks at the exit status from these scripts. It is important that they exit with a non-zero status if there is an error, so that the package management system can stop its processing. For shell scripts this means that you almost always need to use set -e (this is usually true when writing shell scripts, in fact). It is also important, of course, that they exit with a zero status if everything went well." Copying "debian-devel" for more general comments. -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4f85dd6c.6020...@periapt.co.uk