Bug#802018: systemd: _SYSTEMCTL_SKIP_REDIRECT=true is leaked to daemon

Michael Biebl biebl at debian.org
Thu Dec 22 08:21:47 GMT 2016


Am 16.10.2015 um 23:07 schrieb Sebastian Schmidt:
> Package: systemd
> Version: 226-4
> Severity: normal
> Tags: 
> 
> Hi,
> 
> /lib/lsb/init-functions.d/40-systemd exports
> _SYSTEMCTL_SKIP_REDIRECT=true to detect when it has been called
> recursively again by systemd. This export is actually never cleaned up and
> is passed to the daemon. In the case of Puppet, which uses “/etc/init.d
> $service $action” (without cleaning up the environment - which is
> probably an issue by itself) to query and change a daemon’s status, this
> causes the init.d hook to not redirect the call to systemd. For services
> that supply an actual systemd unit which does not simply call the init
> script (e.g. clamav-freshclam) this can cause the action to fail.
> 
> A trivial fix would be:
>>   --- a/debian/extra/init-functions.d/40-systemd
>>   +++ b/debian/extra/init-functions.d/40-systemd
>>   @@ -25,6 +25,8 @@ if [ -d /run/systemd/system ]; then
>>                    fi
>>                    ;;
>>            esac
>>   +    elif [ -z "${_SYSTEMCTL_SKIP_REDIRECT:-}" ]; then
>>   +        unset _SYSTEMCTL_SKIP_REDIRECT
>>        else
>>            export _SYSTEMCTL_SKIP_REDIRECT="true"
>>        fi
> 


Looking at that old code again, I actually don't remember, why we export
 _SYSTEMCTL_SKIP_REDIRECT="true" at all and if the obvious fix would be
to simply drop that else clause.

I did that and didn't encounter any obvious problems.
As said, this code is old, over 6 years, so I don't remember. Can anyone
think of a scenario where we would need that?

Andeas mentioned on IRC that it could be to avoid redirect loops, but
how would this work. As soon as we redirect the call to systemctl, the
actual execution will be by systemd, i.e. PID 1 and PPID will be 1.

Can there be a case where this assumption is not correct?

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20161222/9eba7c5e/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list