[systemd-devel] [PATCH 18/18] shell-comp: Fix up unit completing for _journalctl

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Aug 2 08:38:25 PDT 2013


On Thu, Aug 01, 2013 at 09:35:17PM -0500, William Giokas wrote:
> -u and --user-unit can be specified multiple times, so put a * in front
> of it, and --user-unit can have an =, and should be looking for the
> USER_UNIT not _SYSTEMD_USER_UNIT.
Applied the whole series except this one. Actually user units can be
logged with *either* USER_UNIT or _SYSTEMD_USER_UNIT. The filter that
is used by journalctl can be seen with

$ SYSTEMD_LOG_LEVEL=debug journalctl --user-unit goo |& grep filter
Journal filter: (((_UID=0 OR _UID=1001) AND OBJECT_SYSTEMD_USER_UNIT=goo.service) OR ((_UID=0 OR _UID=1001) AND COREDUMP_USER_UNIT=goo.service) OR (_UID=1001 AND USER_UNIT=goo.service) OR (_UID=1001 AND _SYSTEMD_USER_UNIT=goo.service))

$ ... --unit=goo ...
Journal filter: ((OBJECT_SYSTEMD_UNIT=goo.service AND _UID=0) OR (UNIT=goo.service AND _PID=1) OR (COREDUMP_UNIT=goo.service AND _UID=0 AND MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1) OR _SYSTEMD_UNIT=goo.service)

So the completion for both -u and --user-unit is showing not enough
stuff. I'm not sure how to best fix that, and actually how much we want
to fix that.

I noticed some more problems:

zsh completion for 'journalctl _EXE<tab>' is broken: it gives me
'journalctl _EXE<space>', but I expect 'journalctl _EXE=/usr/bin/...'.
This was broken before, so nothing to do with your patch series.

The list of fields is hardcoded. Maybe we should grow a switch in
journalctl which will dump a list of all available fields, and is use
it in zsh and bash completion?

kernel-install completion for zsh is missing.

Overall, I think that after this split up, zsh completion might become
less of a black box, making it easier for people to update both in sync.

Zbyszek

> -    {-u,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
> -    '--user-unit[Show data only from the specified user session unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \
> +    \*{-u,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
> +    '*--user-unit=[Show data only from the specified user session unit]:units:_journal_fields USER_UNIT' \
>      {-p,--priority=}'[Show only messages within the specified priority range]:priority:_journal_fields PRIORITY' \
-- 
they are not broken. they are refucktored
                           -- alxchk


More information about the systemd-devel mailing list