Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 348768 - =sys-apps/baselayout-1.12.14-r1: The `exit' call check sneaks into subshells
Summary: =sys-apps/baselayout-1.12.14-r1: The `exit' call check sneaks into subshells
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High QA
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 348527
  Show dependency tree
 
Reported: 2010-12-15 06:53 UTC by Michał Górny
Modified: 2010-12-16 00:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-12-15 06:53:27 UTC
baselayout-1 complains if an init script uses `exit' in a subshell, e.g.:

    ( do-some-env-mangling; exit 0 )

I don't see a reason why an init script isn't allowed to do that. I'd suggest removing that pointless, poor man's check.
Comment 1 SpanKY gentoo-dev 2010-12-15 11:54:01 UTC
that is an unfortunate side effect, and one i'm not sure can be fixed.  the check was added because it was catching people wrongly using exit, and i imagine has continued to catch wrong code, so no, it is not "pointless".
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-12-15 14:09:26 UTC
It is pointless as it not only results in false positives but throws these at users instead of devs. So, we're getting into vicious circle where users keep reporting the same false positive just because some check may find a single broken init.d script somewhere.
Comment 3 SpanKY gentoo-dev 2010-12-15 15:15:25 UTC
users only see it when devs dont fully test their code.  there is no need for you to use `exit 0`.  a simple `:` at the end will work just as well.

    ( do-some-env-mangling; : )
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-12-15 15:37:22 UTC
And devs have to do a new release of a program just because some broken code says so. Not to mention that your example works only for a simple case like described here; with a more complex code you have to refactor everything just to get rid of an 'exit' at a random point.
Comment 5 SpanKY gentoo-dev 2010-12-15 16:50:38 UTC
... except the dev in question shouldnt have made said release in the first place as they should have seen the warning on their own systems

if the code is so complicated to make missing exit a problem, then it sounds like the code is fundamentally broken.  init.d scripts shouldnt be jumping through hoops.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-12-15 20:48:59 UTC
(In reply to comment #5)
> ... except the dev in question shouldnt have made said release in the first
> place as they should have seen the warning on their own systems

Assuming all the devs are obligated to use both versions of baselayouts at the same time.

> if the code is so complicated to make missing exit a problem, then it sounds
> like the code is fundamentally broken.  init.d scripts shouldnt be jumping
> through hoops.

The point is that the `exit' call doesn't actually occur in the init.d script. It occurs in a sourced, external script. And I can make it not use it -- but why should I? Because some pointless, broken check tells me to?
Comment 7 SpanKY gentoo-dev 2010-12-16 00:32:38 UTC
hmm, lets see ...

your decision to source an arbitrary external script of unknown contents in an init.d instead of executing things yourself is your problem.

the check in question has existed for almost 6 years at this point.  you're the first to complain about it.  which makes me think that it's really not an issue and is actually useful.  you know, because it has found real bugs.

and as for not testing against multiple versions, it sounds like you're not fully testing against a stable system before stabilizing a package.  yeah, like that's going to win you an argument.

i imagine openrc through its large rewrites lost this check, so i can see about getting that restored if it's still feasible.