FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 01-16-2010, 08:57 AM
Michael Welle
 
Default Sourcing init-functions

Hello,

several init scripts use such a fragment for sourcing init-functions:

if ! [ -x "/lib/lsb/init-functions" ]; then
. /lib/lsb/init-functions
else
echo "E: /lib/lsb/init-functions not found, lsb-base (>= 3.0-6) needed"
exit 1
fi

What is the reason to bail out if the execute bit is set? Or should I
bug report these packages?

Regards
hmw

--
biff4emacsen - A biff-like tool for (X)Emacs
http://www.c0t0d0s0.de/biff4emacsen/biff4emacsen.html
Flood - Your friendly network packet generator
http://www.c0t0d0s0.de/flood/flood.html


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-16-2010, 09:36 AM
Steve Langasek
 
Default Sourcing init-functions

Hi Michael,

On Sat, Jan 16, 2010 at 10:57:48AM +0100, Michael Welle wrote:
> several init scripts use such a fragment for sourcing init-functions:

> if ! [ -x "/lib/lsb/init-functions" ]; then
> . /lib/lsb/init-functions
> else
> echo "E: /lib/lsb/init-functions not found, lsb-base (>= 3.0-6) needed"
> exit 1
> fi

What do you mean, "several"? What init scripts use this fragment? No init
scripts on any of my systems do this.

> What is the reason to bail out if the execute bit is set? Or should I
> bug report these packages?

Looks like nonsense to me. I think you should file a bug. For one thing,
any init script that needs lsb-base (>= 3.0-6) *should depend on lsb-base
(>= 3.0-6)*, not throw an error if it's not installed.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek@ubuntu.com vorlon@debian.org
 
Old 01-16-2010, 10:11 AM
Stanislav Maslovski
 
Default Sourcing init-functions

On Sat, Jan 16, 2010 at 10:57:48AM +0100, Michael Welle wrote:
> Hello,
>
> several init scripts use such a fragment for sourcing init-functions:
>
> if ! [ -x "/lib/lsb/init-functions" ]; then
> . /lib/lsb/init-functions
> else
> echo "E: /lib/lsb/init-functions not found, lsb-base (>= 3.0-6) needed"
> exit 1
> fi
>
> What is the reason to bail out if the execute bit is set? Or should I
> bug report these packages?

Looks like a bug. -x checks for existence _and_ the exec bit set, so
if the file does not exist the next line will try to source it. The
error message suggests that the author wanted a completely different
behaviour...

--
Stanislav


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-16-2010, 11:07 AM
Michael Welle
 
Default Sourcing init-functions

Hi Steve,

Steve Langasek <vorlon@debian.org> writes:

> Hi Michael,
>
> On Sat, Jan 16, 2010 at 10:57:48AM +0100, Michael Welle wrote:
>> several init scripts use such a fragment for sourcing init-functions:
>
>> if ! [ -x "/lib/lsb/init-functions" ]; then
>> . /lib/lsb/init-functions
>> else
>> echo "E: /lib/lsb/init-functions not found, lsb-base (>= 3.0-6) needed"
>> exit 1
>> fi
>
> What do you mean, "several"? What init scripts use this fragment? No init
> scripts on any of my systems do this.
several means that on the subset of all possible init scripts, that is
installed on my machines, an astonishing quantity use this construct :

root@Stella:/etc/init.d# grep '-x.*init-functions' *
ippl:if ! [ -x "/lib/lsb/init-functions" ]; then
nagios3:if ! [ -x "/lib/lsb/init-functions" ]; then
ser2net:if ! [ -x "/lib/lsb/init-functions" ]; then

I guess there is a single source of this construct and then it is copied
and copied again.


>> What is the reason to bail out if the execute bit is set? Or should I
>> bug report these packages?
>
> Looks like nonsense to me. I think you should file a bug. For one thing,
> any init script that needs lsb-base (>= 3.0-6) *should depend on lsb-base
> (>= 3.0-6)*, not throw an error if it's not installed.
That is my feeling, too. I had discovered this annoyance while re-using
Debian init scripts on a Xen Server. While Debian init scripts are
supposed to work on the Debian distribution (which they do at the
moment) it is IMHO a good thing to make them as universal as possible
and I can't see what we gain with this restriction. In this sense init
scripts can have some logic built in to bail out if their runtime
environment doesn't fit. There are Unix system that do not use such a
sophisticated packaging system as Debian do and this way the scripts can
easiely be re-used.

Regards
Gyro

--
biff4emacsen - A biff-like tool for (X)Emacs
http://www.c0t0d0s0.de/biff4emacsen/biff4emacsen.html
Flood - Your friendly network packet generator
http://www.c0t0d0s0.de/flood/flood.html


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-25-2010, 06:50 AM
Gabor Gombas
 
Default Sourcing init-functions

On Sat, Jan 16, 2010 at 02:36:48AM -0800, Steve Langasek wrote:

> Looks like nonsense to me. I think you should file a bug. For one thing,
> any init script that needs lsb-base (>= 3.0-6) *should depend on lsb-base
> (>= 3.0-6)*, not throw an error if it's not installed.

Dependencies do not help if the package gets uninstalled but the init
script is not purged.

Gabor

--
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-25-2010, 07:06 AM
Steve Langasek
 
Default Sourcing init-functions

On Mon, Jan 25, 2010 at 08:50:04AM +0100, Gabor Gombas wrote:
> On Sat, Jan 16, 2010 at 02:36:48AM -0800, Steve Langasek wrote:

> > Looks like nonsense to me. I think you should file a bug. For one thing,
> > any init script that needs lsb-base (>= 3.0-6) *should depend on lsb-base
> > (>= 3.0-6)*, not throw an error if it's not installed.

> Dependencies do not help if the package gets uninstalled but the init
> script is not purged.

The right way to handle that is:

[ -x /path/to/my/daemon ] || exit 0

- *not* throwing an error message about a missing dependency.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek@ubuntu.com vorlon@debian.org
 
Old 01-25-2010, 11:17 AM
Michael Biebl
 
Default Sourcing init-functions

On 25.01.2010 09:06, Steve Langasek wrote:
> On Mon, Jan 25, 2010 at 08:50:04AM +0100, Gabor Gombas wrote:
>> On Sat, Jan 16, 2010 at 02:36:48AM -0800, Steve Langasek wrote:
>
>>> Looks like nonsense to me. I think you should file a bug. For one thing,
>>> any init script that needs lsb-base (>= 3.0-6) *should depend on lsb-base
>>> (>= 3.0-6)*, not throw an error if it's not installed.
>
>> Dependencies do not help if the package gets uninstalled but the init
>> script is not purged.
>
> The right way to handle that is:
>
> [ -x /path/to/my/daemon ] || exit 0

To iterate on that: this check for the existence of the daemon should come
*before* sourcing /lib/lsb/init-functions.
This way, the init script behaves correctly even if it has been uninstalled but
not purged.

Cheers,
Michael

--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
 

Thread Tools




All times are GMT. The time now is 02:37 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org