all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#19477: 24.4; Init script from su terminal
@ 2014-12-31 16:36 Álvar Ibeas
  2014-12-31 18:36 ` Glenn Morris
       [not found] ` <mailman.17015.1420051024.1147.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Álvar Ibeas @ 2014-12-31 16:36 UTC (permalink / raw
  To: 19477

Hello,

Working under Debian, when I switch to root using `su', Emacs doesn't
load the init script located in my user's home folder, as the manual
says:

``if you run Emacs from a shell started by `su', Emacs tries to find
your own `.emacs', not that of the user you are currently pretending
to be [...] It gets your user name from the environment variables
`LOGNAME' and `USER'.''

The variables LOGNAME and USER have both the value `root'. The command
`logname' returns instead my own user name.

Is this an Emacs bug?






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19477: 24.4; Init script from su terminal
  2014-12-31 16:36 bug#19477: 24.4; Init script from su terminal Álvar Ibeas
@ 2014-12-31 18:36 ` Glenn Morris
       [not found] ` <mailman.17015.1420051024.1147.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2014-12-31 18:36 UTC (permalink / raw
  To: Álvar Ibeas; +Cc: 19477

Álvar Ibeas wrote:

> ``if you run Emacs from a shell started by `su', Emacs tries to find
> your own `.emacs', not that of the user you are currently pretending
> to be [...] It gets your user name from the environment variables
> `LOGNAME' and `USER'.''
>
> The variables LOGNAME and USER have both the value `root'. The command
> `logname' returns instead my own user name.

Emacs is behaving as documented.

The `su' programs from coreutils (it's since been removed in favour of
the util-linux one) and util-linux (as used by eg Red Hat) do not change
LOGNAME or USER when su'ing to root.

It seems that Debian's `su' comes from the `shadow' package and does
change them.

But all the `su' programs are behaving as documented too.
It's a shame they don't agree with each other...





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19477: 24.4; Init script from su terminal
       [not found] ` <mailman.17015.1420051024.1147.bug-gnu-emacs@gnu.org>
@ 2014-12-31 19:34   ` Álvar Ibeas
  2015-01-02 19:01     ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Álvar Ibeas @ 2014-12-31 19:34 UTC (permalink / raw
  To: 19477-done

Glenn Morris <rgm@gnu.org> writes:

> Emacs is behaving as documented.
>
> The `su' programs from coreutils (it's since been removed in favour of
> the util-linux one) and util-linux (as used by eg Red Hat) do not change
> LOGNAME or USER when su'ing to root.
>
> It seems that Debian's `su' comes from the `shadow' package and does
> change them.

Thanks for replying. I see now that most of the environment variables
are kept with the `-p' option.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19477: 24.4; Init script from su terminal
  2014-12-31 19:34   ` Álvar Ibeas
@ 2015-01-02 19:01     ` Glenn Morris
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2015-01-02 19:01 UTC (permalink / raw
  To: 19477; +Cc: ibeas


I'm not sure this should be closed.
Perhaps there is a better way for Emacs to do what it wants
(get the name under which you logged in) than consulting LOGNAME.
Eg it could do what `logname' the program does.
Although reading the info page for that, what it does (check
/var/run/utmp etc) doesn't seem that great, or portable.

I'm not sure that what Debian's su does is "correct", but I could not
find a standard for su. In any case, this seems like one of those things
that is impossible to ever get changed, because people come to rely on
it behaving the way it does.

In any case, I think the Emacs documentation could stand to be tweaked a
bit. Eg util-linux/coreutils su only leaves LOGNAME alone if you change
to root, not if you change to a non-root user.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-02 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-31 16:36 bug#19477: 24.4; Init script from su terminal Álvar Ibeas
2014-12-31 18:36 ` Glenn Morris
     [not found] ` <mailman.17015.1420051024.1147.bug-gnu-emacs@gnu.org>
2014-12-31 19:34   ` Álvar Ibeas
2015-01-02 19:01     ` Glenn Morris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.