Bug#904913: systemd: systemctl cat 'foo*' (using shellglob patterns) only lists active units

Michael Prokop mika at debian.org
Sun Jul 29 14:32:45 BST 2018


Package: systemd
Version: 239-7
Severity: normal

Hi,

I think this behavior is wrong, or at least confusing:

,---- [ demonstration ]
| root at debian-sid01:~# systemctl cat ssh.service
| # /lib/systemd/system/ssh.service
| [Unit]
| Description=OpenBSD Secure Shell server
| Documentation=man:sshd(8) man:sshd_config(5)
| After=network.target auditd.service
| ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
|
| [Service]
| EnvironmentFile=-/etc/default/ssh
| [...]
| root at debian-sid01:~# systemctl status ssh.service
| ● ssh.service - OpenBSD Secure Shell server
|    Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor preset: enabled)
|    Active: inactive (dead)
|      Docs: man:sshd(8)
|            man:sshd_config(5)
|
| Jul 29 15:02:10 debian-sid01 systemd[1]: Starting OpenBSD Secure Shell server...
| Jul 29 15:02:10 debian-sid01 sshd[414]: Server listening on 0.0.0.0 port 22.
| Jul 29 15:02:10 debian-sid01 sshd[414]: Server listening on :: port 22.
| Jul 29 15:02:10 debian-sid01 systemd[1]: Started OpenBSD Secure Shell server.
| Jul 29 15:03:01 debian-sid01 sshd[414]: Received signal 15; terminating.
| Jul 29 15:03:01 debian-sid01 systemd[1]: Stopping OpenBSD Secure Shell server...
| Jul 29 15:03:01 debian-sid01 systemd[1]: Stopped OpenBSD Secure Shell server.
| root at debian-sid01:~# systemctl cat 'ssh*'
| root at debian-sid01:~#
`----

When using a (shellglob) "PATTERN" (quoting from manpage) as
demonstrated above with 'ssh*', this seems to apply only to *active*
units. Thanks to Felipe Sateler nowadays I'm aware of the unit
garbage collection (see `LESS='+/UNIT\ GARBAGE\ COLLECTION' man
systemd.unit` in more recent systemd versions), though the behavior
is still confusing/inconsistent to me.

Shouldn't either:

1) "systemctl cat ssh.service" NOT list its unit if it's not running, or
2) "systemctl cat 'ssh*'" *list* its unit file even if it's not running,
but known to the sysstem (since `systemctl cat ssh.service` lists it too)?

(JFTR, I wanted to report it to Debian's BTS before going towards
upstream, though I'm more than happy to take care of this, though
I'd appreciate your feedback before doing so.)

regards,
-mika-



More information about the Pkg-systemd-maintainers mailing list