Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 482396 - s-s-d is not quiet as expected: start-stop-daemon --quiet --test --stop --pidfile /var/run/atmarpd.pid || return 1
Summary: s-s-d is not quiet as expected: start-stop-daemon --quiet --test --stop --pid...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 460756 481182 487332
  Show dependency tree
 
Reported: 2013-08-25 08:10 UTC by Robin Johnson
Modified: 2013-10-31 04:43 UTC (History)
3 users (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 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-08-25 08:10:20 UTC
netifrc contains this line for clip (IP over ATM)
start-stop-daemon --quiet --test --stop --pidfile /var/run/atmarpd.pid || return 1

Running it prints:
* start-stop-daemon: fopen `/var/run/atmarpd.pid': No such file or directory

At some point in the past, --quiet stopped being quiet for errors.

Could you please add a --quieterror option that also silences errors (or modify --quiet to take an argument)?

I'm going to work around it for now.
Comment 1 William Hubbs gentoo-dev 2013-08-25 18:05:36 UTC
For reference, below are the hashes of the commits that made this
change:

3cd293c515ddf44172ece36e785209084a11d3fc
a06072b3959adc91ddf5157f69162977cbd48079
9afdf50667661812be936fe6d3b3a939b0c54061

I'm wondering if we should just suppress the error message when --test
is on the command line?
Comment 2 William Hubbs gentoo-dev 2013-08-25 22:18:29 UTC
I talked to idl0r about this, and the issue is that s-s-d --quiet was
changed to not silence error messages, and reading a pid file that
does not exist is considered an error.

I believe that was done because service scripts are abusing --quiet
in place of their downstream daemon's --quiet option or equivalent.

My vote would be to undo this change, find service scripts abusing
--quiet and fix them.
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-08-26 02:58:22 UTC
Can we clearly define for script consumers what a valid use of --quiet is then?
I'm personally fine with --quiet=error, for scripts that really know what they are doing.
--test is the is the best valid use I know.
Comment 4 William Hubbs gentoo-dev 2013-08-26 17:00:07 UTC
It appears that discussion about the --quiet option has been going on
for a while.  Bug #380073 and bug #439174 are related.
Comment 5 William Hubbs gentoo-dev 2013-08-27 18:34:06 UTC
After commits 72b58b, 5c3e5d and bb8a9c, OpenRC is in a consistent state
with regard to --quiet.

The --quiet switch is a global OpenRC switch that works by setting the
EINFO_QUIET environment variable to yes. This has the affect of
suppressing output from all einfo* and ewarn* calls, but not eerror*
calls.

In start-stop-daemon, we locally extend the behaviour of --quiet to
suppress some eerror calls and to suppress stdout and stderr in the
child process when we fork to start the daemon.

Since we are suppressing some eerror* calls in s-s-d, should we make the
eerror* suppression work the same way as ewarn* and einfo* suppression?

Also, in start-stop-daemon, should we be suppressing the stdout and
stderr of the child process, and by that path, the stdout and stderr of
the daemon with the --quiet switch?

Based on discussions on the previous bugs I have cited, the first answer
seems to be yes, but I'm not sure about the second answer.

Thoughts?
Comment 6 William Hubbs gentoo-dev 2013-08-28 19:41:13 UTC
In commit a78b18e, I modified libeinfo so that eerror* calls are now
silenced by the EINFO_QUIET variable being set to yes, like einfo* and
ewarn* calls.
Comment 7 Christian Ruppert (idl0r) gentoo-dev 2013-08-30 13:15:56 UTC
(In reply to Robin Johnson from comment #3)
> Can we clearly define for script consumers what a valid use of --quiet is
> then?
> I'm personally fine with --quiet=error, for scripts that really know what
> they are doing.
> --test is the is the best valid use I know.

+1 on that.

William already reverted my commits. I think we shouldn't silence errors by default when passing --quiet. --quiet=error would be pretty handy though.
Comment 8 William Hubbs gentoo-dev 2013-09-01 19:28:33 UTC
(In reply to Christian Ruppert (idl0r) from comment #7)
> (In reply to Robin Johnson from comment #3)
> > Can we clearly define for script consumers what a valid use of --quiet is
> > then?
> > I'm personally fine with --quiet=error, for scripts that really know what
> > they are doing.
> > --test is the is the best valid use I know.
> 
> +1 on that.
> 
> William already reverted my commits. I think we shouldn't silence errors by
> default when passing --quiet. --quiet=error would be pretty handy though.

I'm not opposed to what you had; I just want to make it be controlled a consistent way through all of OpenRC.

Basically the way quiet works is it sets the EINFO_QUIET environment variable, which then controls whether einfo* and ewarn* calls in libeinfo output anything.

Currently, in git, I have it set up so that eerror* calls check this variable as well. If we suppress errors with a separate option, I would rather it be done in a similar way to how --quiet suppresses einfos and ewarns, but with a separate env variable and maybe a separate command line switch.
Comment 9 William Hubbs gentoo-dev 2013-09-03 18:25:26 UTC
Commit 2590bf7 moves eerror() suppression to a separate environment
variable, EERROR_QUIET, which works exactly like EINFO_QUIET.
Comment 10 William Hubbs gentoo-dev 2013-09-04 00:59:49 UTC
As of commit 445b297, the rc binary will set the environment variables
EINFO_QUIET or EERROR_QUIET to control whether error messages are
suppressed, based on command line options as follows:

The -q/--quiet option, specified once, suppresses all einfo/ewarn
output by setting the EINFO_QUIET environment variable to yes. Specifying
it a second time also suppresses all eerror output by setting the EERROR_QUIET
environment variable to yes.

@idl0r:
What do you think about reworking s-s-d some since the libeinfo library
now knows by environment variables when to suppress messages?

I would rather not test for  quiet or verbose settings inside
start-stop-daemon.c and just call the appropriate libeinfo functions.
Comment 11 Thomas Deutschmann (RETIRED) gentoo-dev 2013-09-30 13:29:40 UTC
Hi,

I am reporting this here, because I think it is related to the changes introduced by this bug report.

Today I updated openrc-9999 on my test system (so I guess my openrc version is now at commit 993e7d704404a8ff1a355bf4a38d1d92e7cc56cd (not sure how to verify)).

I noticed the following on boot (from rc.log):

 * Starting rsyslogd ...
 * start-stop-daemon: fopen `/var/run/rsyslogd.pid': No such file or directory
 [ ok ]
 * Starting ntpd ...
 * start-stop-daemon: fopen `/var/run/ntpd.pid': No such file or directory
 [ ok ]
 * Starting sshd ...
 * start-stop-daemon: fopen `/var/run/sshd.pid': No such file or directory
 [ ok ]

Do these init.d scripts need an update, because they use the "--quiet" parameter? I don't expect that, because as far as I understand it should be normal that there isn't a pidfile yet.. so I don't understand why start-stop-daemon is complaining about a missing pidfile.
Comment 12 William Hubbs gentoo-dev 2013-09-30 23:22:03 UTC
(In reply to Thomas D. from comment #11)
> Hi,
> 
> I am reporting this here, because I think it is related to the changes
> introduced by this bug report.
> 
> Today I updated openrc-9999 on my test system (so I guess my openrc version
> is now at commit 993e7d704404a8ff1a355bf4a38d1d92e7cc56cd (not sure how to
> verify)).
> 
> I noticed the following on boot (from rc.log):
> 
>  * Starting rsyslogd ...
>  * start-stop-daemon: fopen `/var/run/rsyslogd.pid': No such file or
> directory
>  [ ok ]
>  * Starting ntpd ...
>  * start-stop-daemon: fopen `/var/run/ntpd.pid': No such file or directory
>  [ ok ]
>  * Starting sshd ...
>  * start-stop-daemon: fopen `/var/run/sshd.pid': No such file or directory
>  [ ok ]
> 
> Do these init.d scripts need an update, because they use the "--quiet"
> parameter? I don't expect that, because as far as I understand it should be
> normal that there isn't a pidfile yet.. so I don't understand why
> start-stop-daemon is complaining about a missing pidfile.

No, I know about these extra messages.

there is nothing wrong with the init scripts. I have another change I am having someone on the team take a look at that is going to hide these messages unless you specifically want to see them.
Comment 13 William Hubbs gentoo-dev 2013-10-31 04:39:03 UTC
This was fixed in OpenRC-0.12.2 and will be included in OpenRC-0.13 as
well.
Comment 14 William Hubbs gentoo-dev 2013-10-31 04:40:43 UTC
You should repeat the quiet option to suppress the error output, e.g.
-q -q, -qq, --quiet --quiet.