GNU bug report logs - #1540
emacsclient -t fails under su

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Thu, 11 Dec 2008 20:20:05 UTC

Severity: wishlist

To reply to this bug, email your comments to 1540 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Message #3 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: emacsclient -t fails under su
Date: Thu, 11 Dec 2008 15:13:58 -0500
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.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Message #6 received at 1540 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 1540 <at> debbugs.gnu.org
Subject: Re: bug#1540: emacsclient -t fails under su
Date: Thu, 11 Dec 2008 13:19:58 -0800 (PST)
Glenn Morris <rgm <at> 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?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Message #9 received at 1540 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1540 <at> debbugs.gnu.org
Subject: Re: bug#1540: emacsclient -t fails under su
Date: Thu, 11 Dec 2008 18:51:52 -0500
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.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Message #12 received at 1540 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 1540 <at> debbugs.gnu.org
Subject: Re: bug#1540: emacsclient -t fails under su
Date: Thu, 11 Dec 2008 17:02:45 -0800 (PST)
Glenn Morris <rgm <at> 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.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Message #15 received at 1540 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 1540 <at> debbugs.gnu.org
Subject: Re: bug#1540: emacsclient -t fails under su
Date: Thu, 11 Dec 2008 17:18:24 -0800 (PST)
Glenn Morris <rgm <at> 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




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Message #18 received at 1540 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1540 <at> debbugs.gnu.org,
        control <control <at> debbugs.gnu.org>
Subject: Re: bug#1540: emacsclient -t fails under su
Date: Thu, 11 Dec 2008 20:31:50 -0500
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




Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Fri, 12 Dec 2008 01:40:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> suse.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at 1540 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1540 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#1540: emacsclient -t fails under su
Date: Fri, 12 Dec 2008 16:11:27 +0100
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> Glenn Morris <rgm <at> 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 <at> 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."




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1540; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #30 received at 1540 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1540 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#1540: emacsclient -t fails under su
Date: Fri, 12 Dec 2008 14:02:31 -0500
> 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 ...






This bug report was last modified 16 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.