fix git-daemon systemd scriptlets (#1785088)

When upgrading or reinstalling git-daemon, the rpm %postun scriptlet
runs the %systemd_postun_with_restart macro with git@.service as the
argument.  The macro calls 'systemctl try-restart git@.service' which
produces an error:

    $ dnf -y update git-daemon
    [...]
      Running scriptlet: git-daemon-2.24.1-1.fc31.x86_64                        2/2
    Failed to try-restart git@.service: Unit name git@.service is missing the instance name.
    See system logs and 'systemctl status git@.service' for details.

Until systemd-242, the error was hidden because the systemd scriptlets
directed all output to /dev/null.  That was changed in systemd commit
b0ca726585 (rpm: avoid hiding errors from systemd commands, 2019-03-20),
exposing this bug in the git-daemon scriptlets.

The misconfiguration also leaves a stale symlink in /etc/systemd if
git.socket is enabled.  Removing the git-daemon package and installing
again later results in git.socket being enabled.

Neither of these are the expected nor intended outcomes.  Replace
git@.service with git.socket in the systemd scriptlets.

The issue was introduced in 906d847 (Rename git.service into
git@.service and bump release, 2014-10-24).  It went unnoticed until now
largely because the systemd scriptlets hid their output.
This commit is contained in:
Todd Zullinger 2019-12-19 01:49:10 -05:00
parent da087ee719
commit 743dd47b9a

View File

@ -93,7 +93,7 @@
Name: git
Version: 2.24.1
Release: 1%{?rcrev}%{?dist}
Release: 2%{?rcrev}%{?dist}
Summary: Fast Version Control System
License: GPLv2
URL: https://git-scm.com/
@ -878,13 +878,13 @@ rmdir --ignore-fail-on-non-empty "$testdir"
%if %{use_systemd}
%post daemon
%systemd_post git@.service
%systemd_post git.socket
%preun daemon
%systemd_preun git@.service
%systemd_preun git.socket
%postun daemon
%systemd_postun_with_restart git@.service
%systemd_postun_with_restart git.socket
%endif
# endif use_systemd
@ -1029,6 +1029,9 @@ rmdir --ignore-fail-on-non-empty "$testdir"
%{?with_docs:%{_pkgdocdir}/git-svn.html}
%changelog
* Thu Dec 19 2019 Todd Zullinger <tmz@pobox.com> - 2.24.1-2
- fix git-daemon systemd scriptlets (#1785088)
* Tue Dec 10 2019 Todd Zullinger <tmz@pobox.com> - 2.24.1-1
- update to 2.24.1 (CVE-2019-1348, CVE-2019-1349, CVE-2019-1350, CVE-2019-1351,
CVE-2019-1352, CVE-2019-1353, CVE-2019-1354, and CVE-2019-1387)