]> git.ipfire.org Git - thirdparty/systemd.git/commit
zsh: update default caching policy for units
authorRonan Pigott <ronan@rjp.ie>
Mon, 17 Jul 2023 23:24:36 +0000 (16:24 -0700)
committerRonan Pigott <ronan@rjp.ie>
Wed, 19 Jul 2023 21:27:45 +0000 (14:27 -0700)
commit110ba0ccf9b9e93fe6f26d19c4b578100fd9757c
tree347222b293d5eb1ada79de5ddd557ebf0cfc8a8a
parent8a8caeccb27a375913b9d1787664656dce1f4511
zsh: update default caching policy for units

The existing caching policy was completely bogus.

In the first stanza, despite the comment, the pattern given would
consider the cache invalid if it was more than 1 hour old.

The second stanza was also incorrect, since the output of `systemctl
--all` is not unit file paths, but unit names. When they were being
tested against the cachefile mtime, the test would always fail becuase
of the nonexistant file (hopefully).

In fact it's not very useful to test if the unit files have newer mtime
in this case anyway, since we are only caching their names. Also,
`systemctl --all` is an unfortunately slow operation to be used in
testing for the cache validity — we want this operation to at least be
faster than rebuilding the cache.

I've rewritten this stanza with my best guess at its original intent. It
now checks against the mtime of the parent directories in the search
path, which should be updated and cause the cache to rebuild when we
add, remove, or rename any unit files.
shell-completion/zsh/_systemctl.in