[systemd-devel] [PATCH] systemctl: allow to change the default target without the --force switch

Djalal Harouni tixxdz at opendz.org
Tue Apr 22 03:20:41 PDT 2014


On Tue, Apr 22, 2014 at 08:01:43AM +0200, Lennart Poettering wrote:
> On Mon, 14.04.14 01:07, Djalal Harouni (tixxdz at opendz.org) wrote:
> 
> > Currently "systemctl set-default" will fail to change the default target
> > due to the 'default.target' being a symlink which is always the case.
> 
> Humm, no? Normally default.target should not exist in /etc, only in
> /usr. This means "systemctl set-default" should just work if it is run
> on a pristine system, and only requires --force if there's already user
> configuration in place that is conflicting.
Yes, you are right!

> > To work around this, the user must specify the "--force" switch to be
> > able to overwrite the existing symlink.
> > 
> > This is clearly a regression that was introduced by commit  718db96199e
> > since it worked before without the "--force" switch and the man pages do
> > not mention that you need to specify it. It is expected that this is a
> > symlink.
> > 
> > So just explicity set the force flag to make it work again.
> > 
> > https://bugs.freedesktop.org/show_bug.cgi?id=76623
> 
> Hmm, I find the behaviour before this patch actually more sensible,
> since it treats this symlink like any other symlink we create/remove in
> install.c. It appears more like a issue of printing a nice error message
> that informs the user that "--force" might be a good idea to use when
> this happens...
>
> But anyway, my opinion on this isn't very strong, so I am going to leave
> this patch as is.
Ok, Thanks. IMO we shouldn't care too much, apart from the first set-default,
1) it will always be a symlink, 2) the necessary security checks are there.

> Lennart
> 
> -- 
> Lennart Poettering, Red Hat

-- 
Djalal Harouni
http://opendz.org


More information about the systemd-devel mailing list