[SHEPHERD] Wrong error message when missing priviledge

  • Open
  • quality assurance status badge
Details
4 participants
  • Gábor Boskovits
  • Danny Milosavljevic
  • Ricardo Wurmus
  • swedebugia
Owner
unassigned
Submitted by
swedebugia
Severity
normal
S
S
swedebugia wrote on 5 Nov 2018 10:55
(address . bug-guix@gnu.org)
cbab21da-6492-571e-f078-69ae920b9f70@riseup.net
Hi

sdb@komputilo ~$ herd status
error: connect: /run/user/30011/shepherd/socket: No such file or directory

sdb@komputilo ~$ sudo herd status
Password:
Started:
 + console-font-tty1
 + console-font-tty2
 + console-font-tty3
 + console-font-tty4
...


--
Cheers
Swedebugia
R
R
Ricardo Wurmus wrote on 5 Nov 2018 20:48
(name . swedebugia)(address . swedebugia@riseup.net)(address . 33270@debbugs.gnu.org)
87muqnwbj0.fsf@elephly.net
swedebugia <swedebugia@riseup.net> writes:

Toggle quote (3 lines)
> sdb@komputilo ~$ herd status
> error: connect: /run/user/30011/shepherd/socket: No such file or directory

It is possible to run shepherd as a user service manager. This means
that we can’t generally assume that the user meant to communicate with
the init instance.

The error could be that either the user’s instance is not running or
that the user meant to communicate with the init system. It is not
obvious to me how to distinguish these two errors.

--
Ricardo
G
G
Gábor Boskovits wrote on 5 Nov 2018 22:57
(name . Ricardo Wurmus)(address . rekado@elephly.net)
CAE4v=phMy1QLf+T5VyP+9h8wN5xG+xrXHVqcAWQTUgiP9Rhi2g@mail.gmail.com
Hello Ricardo,

Ricardo Wurmus <rekado@elephly.net> ezt írta (id?pont: 2018. nov. 5., H, 20:50):
Toggle quote (8 lines)
>
>
> swedebugia <swedebugia@riseup.net> writes:
>
> > sdb@komputilo ~$ herd status
> > error: connect: /run/user/30011/shepherd/socket: No such file or directory
>

Actually this seems to be a message that can be translated to
'shepherd user instance is not running' am I correct?
I guess that way it is explicit that the command given would like to
talk to a shepherd user instance. Am I missing something here?

Toggle quote (15 lines)
> It is possible to run shepherd as a user service manager. This means
> that we can’t generally assume that the user meant to communicate with
> the init instance.
>
> The error could be that either the user’s instance is not running or
> that the user meant to communicate with the init system. It is not
> obvious to me how to distinguish these two errors.
>
> --
> Ricardo
>
>
>
>

Best regards,
g_bor
D
D
Danny Milosavljevic wrote on 5 Nov 2018 23:49
(name . Gábor Boskovits)(address . boskovits@gmail.com)
20181105234944.305ce816@scratchpost.org
Hi Gabor,

On Mon, 5 Nov 2018 22:57:15 +0100
Gábor Boskovits <boskovits@gmail.com> wrote:
Toggle quote (6 lines)
> > > sdb@komputilo ~$ herd status
> > > error: connect: /run/user/30011/shepherd/socket: No such file or directory
>
> Actually this seems to be a message that can be translated to
> 'shepherd user instance is not running' am I correct?

Yes, that's what it means. For a UNIX error message, what it's saying
is actually quite close to what it really means. :)

I would suggest to keep the file name in the error message anyway,
but no harm in adding some extra information (it will slightly complicate
the socket discovery code, but that's okay. Also, right now profiles can
actually set up XDG_RUNTIME_DIR to point somewhere else and make herd connect
to the profile's shepherd's socket - which is nice, but is not really a *user"
shepherd then anymore).

Also, we should suppress the stack trace for this specific error since it
really doesn't add anything useful.

Toggle quote (4 lines)
> > The error could be that either the user’s instance is not running or
> > that the user meant to communicate with the init system. It is not
> > obvious to me how to distinguish these two errors.

I don't think it's possible to distinguish these.

It would be possible to make herd fallback to the system shepherd if it can't
find the stuff in the user shepherd, but I'm not sure I'd like it.

Better, we could add "--user" and "--system" options to force herd to connect to
some specific shepherd regardless of user, at the cost of hard-coding that there
are only these two (which is not actually the case - shepherd is meant to be
used in a modular way and doesn't care one way or another how often and where
exactly you run it).

It's kinda weird to have different endpoints depending on whether one is root or
not, but as a default it has precedent in both dbus and systemd.

I think people can get used to it (we should document it).
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlvgyQgACgkQ5xo1VCww
uqVEJgf8DgYKMpzG5xnIts6tYIHru/Y6kRlKzwmAeQIo6TC6pI/cPhTwXCEHROZd
zKoCxjaUxJ8U2PHRP+Rv0Z6q7AjTcSY8QNTnI6pC6rRa6L6b4rVeOWzViF2rpbj+
oPtZQzMHxuNdx0sMjRmc1s96oljQ1LEXa37gzo1jJMapAOXWQHvX0oqkq3twXW8s
c/fix57cZx3wBFca9sFgz1qSUX0AQRkQevmN4EBEca6TKnd/6WEQIEbBea5XhBEt
E6FO2b0HIfp1cctIaI2FFxMJW1bUsQCUod3hPvYcwpHrz3zw9ASbfjtpEW+SvKuH
bjSqNtMoI10N3vKJTqR0dKNf/mMlOA==
=giCs
-----END PGP SIGNATURE-----


G
G
Gábor Boskovits wrote on 6 Nov 2018 08:55
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
CAE4v=piKq6+fGenF-=9RabBBs_8X2hGsDV8iH+maqYayZbEW4g@mail.gmail.com
Hello Danny,

Danny Milosavljevic <dannym@scratchpost.org> ezt írta (id?pont: 2018.
nov. 5., H, 23:49):
Toggle quote (33 lines)
>
> Hi Gabor,
>
> On Mon, 5 Nov 2018 22:57:15 +0100
> Gábor Boskovits <boskovits@gmail.com> wrote:
> > > > sdb@komputilo ~$ herd status
> > > > error: connect: /run/user/30011/shepherd/socket: No such file or directory
> >
> > Actually this seems to be a message that can be translated to
> > 'shepherd user instance is not running' am I correct?
>
> Yes, that's what it means. For a UNIX error message, what it's saying
> is actually quite close to what it really means. :)
>
> I would suggest to keep the file name in the error message anyway,
> but no harm in adding some extra information (it will slightly complicate
> the socket discovery code, but that's okay. Also, right now profiles can
> actually set up XDG_RUNTIME_DIR to point somewhere else and make herd connect
> to the profile's shepherd's socket - which is nice, but is not really a *user"
> shepherd then anymore).
>
> Also, we should suppress the stack trace for this specific error since it
> really doesn't add anything useful.
>
> > > The error could be that either the user’s instance is not running or
> > > that the user meant to communicate with the init system. It is not
> > > obvious to me how to distinguish these two errors.
>
> I don't think it's possible to distinguish these.
>
> It would be possible to make herd fallback to the system shepherd if it can't
> find the stuff in the user shepherd, but I'm not sure I'd like it.

I would not like this either.

Toggle quote (7 lines)
>
> Better, we could add "--user" and "--system" options to force herd to connect to
> some specific shepherd regardless of user, at the cost of hard-coding that there
> are only these two (which is not actually the case - shepherd is meant to be
> used in a modular way and doesn't care one way or another how often and where
> exactly you run it).

Could we instead just give a hint like, "if you intended to communicate with the
system shepherd, please specify -s system_sepherd_socket_name_here on you
command"?

Toggle quote (5 lines)
>
> It's kinda weird to have different endpoints depending on whether one is root or
> not, but as a default it has precedent in both dbus and systemd.
>
> I think people can get used to it (we should document it).
?