unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1540: emacsclient -t fails under su
@ 2008-12-11 20:13 Glenn Morris
  2008-12-11 21:19 ` Dan Nicolaescu
  0 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2008-12-11 20:13 UTC (permalink / raw)
  To: bug-gnu-emacs


I'm logged into an X session as user1.
From the xterm associated with /dev/pts/12, I do:

user1> su - user2
user2> emacs -Q -nw

That works fine. Then I exit that Emacs and do:

user2> emacs -Q -f server-start &    # works fine
user2> emacsclient -c                # works fine
user2> emacsclient -t
*ERROR*: Could not open file: /dev/pts/12

(and indeed user2 does not have permissions for this file)

user2> emacsclient -t

This second attempt kills Emacs with a segfault.







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

* bug#1540: emacsclient -t fails under su
  2008-12-11 20:13 bug#1540: emacsclient -t fails under su Glenn Morris
@ 2008-12-11 21:19 ` Dan Nicolaescu
  2008-12-11 23:51   ` Glenn Morris
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Nicolaescu @ 2008-12-11 21:19 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 1540

Glenn Morris <rgm@gnu.org> writes:

  > I'm logged into an X session as user1.
  > From the xterm associated with /dev/pts/12, I do:
  > 
  > user1> su - user2
  > user2> emacs -Q -nw
  > 
  > That works fine. Then I exit that Emacs and do:

I analyzed this about a year ago, but forgot about it :-(

  > user2> emacs -Q -f server-start &    # works fine
  > user2> emacsclient -c                # works fine
  > user2> emacsclient -t
  > *ERROR*: Could not open file: /dev/pts/12
  > 
  > (and indeed user2 does not have permissions for this file)

One problem is here: when this happens the terminal data structure is
half created, so not complete, because of that when accessing the second
time...

  > user2> emacsclient -t
  > 
  > This second attempt kills Emacs with a segfault.

... we get a crash here.

Not sure what to do.  The quick way out would be for emacsclient to
check if the tty is writable, and refuse to try to connect in case it is
not.  But is that TRTD?






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

* bug#1540: emacsclient -t fails under su
  2008-12-11 21:19 ` Dan Nicolaescu
@ 2008-12-11 23:51   ` Glenn Morris
  2008-12-12  1:02     ` Dan Nicolaescu
  2008-12-12  1:18     ` Dan Nicolaescu
  0 siblings, 2 replies; 9+ messages in thread
From: Glenn Morris @ 2008-12-11 23:51 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1540

Dan Nicolaescu wrote:

> Not sure what to do.  The quick way out would be for emacsclient to
> check if the tty is writable, and refuse to try to connect in case it is
> not.  But is that TRTD?

Anything that stops the crash has to be an improvement.

I know nothing about how this all works, but my naive expectation was
that since emacs -nw works, emacsclient -t should too. But if that's
not possible, fine. If it's possible but difficult, just stopping the
crash and leaving the rest open as a wishlist is fine too.






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

* bug#1540: emacsclient -t fails under su
  2008-12-11 23:51   ` Glenn Morris
@ 2008-12-12  1:02     ` Dan Nicolaescu
  2008-12-12  1:31       ` Glenn Morris
  2008-12-12 15:11       ` Andreas Schwab
  2008-12-12  1:18     ` Dan Nicolaescu
  1 sibling, 2 replies; 9+ messages in thread
From: Dan Nicolaescu @ 2008-12-12  1:02 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 1540

Glenn Morris <rgm@gnu.org> writes:

  > Dan Nicolaescu wrote:
  > 
  > > Not sure what to do.  The quick way out would be for emacsclient to
  > > check if the tty is writable, and refuse to try to connect in case it is
  > > not.  But is that TRTD?
  > 
  > Anything that stops the crash has to be an improvement.

The crash should be gone now.

  > I know nothing about how this all works, but my naive expectation was
  > that since emacs -nw works, emacsclient -t should too. But if that's
  > not possible, fine. If it's possible but difficult, just stopping the
  > crash and leaving the rest open as a wishlist is fine too.

Not sure about the underlying problem. 
It would be interesting to know if this happens on all OSes.






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

* bug#1540: emacsclient -t fails under su
  2008-12-11 23:51   ` Glenn Morris
  2008-12-12  1:02     ` Dan Nicolaescu
@ 2008-12-12  1:18     ` Dan Nicolaescu
  2008-12-12 19:02       ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Dan Nicolaescu @ 2008-12-12  1:18 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 1540

Glenn Morris <rgm@gnu.org> writes:

  > I know nothing about how this all works, but my naive expectation was
  > that since emacs -nw works, emacsclient -t should too.


A little explanation what is going on.  Given this example:

  > user1> su - user2
  > user2> emacs -Q -nw
  > user2> emacs -Q -f server-start &    # works fine
  > user2> emacsclient -c                # works fine
  > user2> emacsclient -t
  > *ERROR*: Could not open file: /dev/pts/12
  > 
  > (and indeed user2 does not have permissions for this file)

emacs tries to open the tty of the emacsclient process, which 
ttyname (fileno (stdout)) says it's /dev/pts/12
/dev/pts/12 is owned by user1, and user2 has no access to it






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

* bug#1540: emacsclient -t fails under su
  2008-12-12  1:02     ` Dan Nicolaescu
@ 2008-12-12  1:31       ` Glenn Morris
  2008-12-12  1:40         ` Processed: " Emacs bug Tracking System
  2008-12-12 15:11       ` Andreas Schwab
  1 sibling, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2008-12-12  1:31 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1540, control

severity 1540 wishlist
stop

Dan Nicolaescu wrote:

> The crash should be gone now.

Yes, thanks.

> Not sure about the underlying problem. 

I changed dealing with that to a wishlist item. If it turns out to be
insoluble, feel free to close or tag as wontfix






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

* Processed: Re: bug#1540: emacsclient -t fails under su
  2008-12-12  1:31       ` Glenn Morris
@ 2008-12-12  1:40         ` Emacs bug Tracking System
  0 siblings, 0 replies; 9+ messages in thread
From: Emacs bug Tracking System @ 2008-12-12  1:40 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Emacs Bugs

Processing commands for control@emacsbugs.donarmstrong.com:

> severity 1540 wishlist
bug#1540: emacsclient -t fails under su
Severity set to `wishlist' from `normal'

> stop
Stopping processing here.

Please contact me if you need assistance.

Don Armstrong
(administrator, Emacs bugs database)





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

* bug#1540: emacsclient -t fails under su
  2008-12-12  1:02     ` Dan Nicolaescu
  2008-12-12  1:31       ` Glenn Morris
@ 2008-12-12 15:11       ` Andreas Schwab
  1 sibling, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2008-12-12 15:11 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1540

Dan Nicolaescu <dann@ics.uci.edu> writes:

> Glenn Morris <rgm@gnu.org> writes:
>
>   > I know nothing about how this all works, but my naive expectation was
>   > that since emacs -nw works, emacsclient -t should too. But if that's
>   > not possible, fine. If it's possible but difficult, just stopping the
>   > crash and leaving the rest open as a wishlist is fine too.
>
> Not sure about the underlying problem. 

Doing it right would require passing a file descriptor instead of the
terminal name from emacsclient to emacs.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."






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

* bug#1540: emacsclient -t fails under su
  2008-12-12  1:18     ` Dan Nicolaescu
@ 2008-12-12 19:02       ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2008-12-12 19:02 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1540

> emacs tries to open the tty of the emacsclient process, which 
> ttyname (fileno (stdout)) says it's /dev/pts/12
> /dev/pts/12 is owned by user1, and user2 has no access to it

Indeed.  You can make it work by letting user2 create another pts for
Emacs to use and then transfer back&forth the commands on one pts to
the other.  E.g. user2 runs scren and then emacsclient -t in screen.
Or user2 does "ssh localhost" and then runs emacsclient -t in that
ssh session.  Or ...








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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-11 20:13 bug#1540: emacsclient -t fails under su Glenn Morris
2008-12-11 21:19 ` Dan Nicolaescu
2008-12-11 23:51   ` Glenn Morris
2008-12-12  1:02     ` Dan Nicolaescu
2008-12-12  1:31       ` Glenn Morris
2008-12-12  1:40         ` Processed: " Emacs bug Tracking System
2008-12-12 15:11       ` Andreas Schwab
2008-12-12  1:18     ` Dan Nicolaescu
2008-12-12 19:02       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).