Bug#887501: systemctl status should not use --pager
Guido Günther
agx at sigxcpu.org
Wed Jan 17 14:25:15 GMT 2018
Hi Michael,
On Wed, Jan 17, 2018 at 02:59:07PM +0100, Michael Biebl wrote:
> Am 17.01.2018 um 14:15 schrieb Guido Günther:
> > Package: init-system-helpers
> > Version: 1.51
> > Severity: normal
> > Tags: patch
> >
> > Hi,
> > systemctl status should be invoked with --no-pager, otherwise it might
> > hang on non-interactive command. This was observed running serverspec's
> >
> > describe service('systemd-timesyncd') do
> > it { should be_running }
> > end
> >
> > Possible patch attached.
>
> Hm, I'm not quite convinced we should do this. service is supposed to be
> a tool that is used interactively and I want it to behave as closely as
> systemctl.
At least serverspec seems to have different expectations here since it
assumes 'service' to behave as on other linux distros and not invoke a
pager (so it takes no countermeasures).
>
> Second, for your use case, directly using
> systemctl is-active $service
> seems like a better idea anyway then to use a full-blown systemctl
> status output as it would be much quicker.
serverspec uses exactly this when it you tell it the init system is
systemd
describe service('openssh-server') do
it { should be_running.under('systemd') }
end
and this works out of the box. But there are situtation when one doesn't
care about the init system and using service is good enough. (The fact
that Debian ships several init systems doesn't make things simpler).
> Third, afaik, systemctl has some auto-detection whether it is called
> from an interactive shell or not and is not supposed to use paging in
> that case. Might be worth investigating if that is not working or if I'm
> just misinformed there.
serverspec is trying to mimic an interactive session here which seems to
confuse systemctl.
> Fourght, you already have a knob where you can disable the pager. See
> the systemctl man page → ENVIRONMENT. Setting $SYSTEMD_PAGER to an empty
> var should disable the pager.
>
> Given all those reasons, I don't think we should change the behaviour of
> "service $foo status"
My main point would be better matching the behavior of other distros.
Cheers,
-- Guido
More information about the Pkg-systemd-maintainers
mailing list