Re: screen-4.6.0 regression: within su: Cannot open your terminal '/dev/pts/14' - please check

Andrew Savchenko <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
On Sat, 1 Jul 2017 21:41:17 +0200 Amadeusz Sławiński wrote:
> On Fri, 30 Jun 2017 15:25:05 +0800
> Clark Wang <[email protected]> wrote:
> 
> > On Thu, Jun 29, 2017 at 7:31 PM, Andrew Savchenko <[email protected]>
> > wrote:
> > 
> > > Hi,
> > >
> > > I often use screen within su - username sessions, so that active
> > > terminal (e.g. xterm) is owned by a user different from one using
> > > su, e.g.:
> > >
> > > su - test
> > > screen
> > >
> > > This worked fine before 4.6.0 (up to 4.5.1), with 4.6.0 I have:
> > >
> > > $ su - test
> > > $ screen
> > > Cannot open your terminal '/dev/pts/14' - please check.
> > >
> > > /dev/pts/14 is indeed not owned by user test, but this way screen
> > > have worked fine for as long as I can remember, so this access
> > > should not be mandatory.
> > >
> > > Any way to return the old behaviour?
> > >  
> > 
> > The following patch (not a real fix) works fine for me. To me it
> > looks like the ``#ifndef NAMEDPIPE'' part is wrongly removed from
> > v4.5.x code.
> > 
> > --- src/screen.c        2017-06-30 15:03:24.886002321 +0800
> > +++ ../screen-4.6.0/screen.c    2017-06-30 15:12:25.547628467 +0800
> > @@ -1001,6 +1001,7 @@
> >    attach_tty = "";
> >    if (!detached && !lsflag && !cmdflag && !(dflag && !mflag
> > && !rflag && !xflag) &&
> >        !(sty && !SockMatch && !mflag && !rflag && !xflag)) {
> > +      int fl;
> > 
> >      /* ttyname implies isatty */
> >      SetTtyname(true, &st);
> > @@ -1008,6 +1009,10 @@
> >      tty_mode = (int)st.st_mode & 0777;
> >  #endif
> > 
> > +    fl = fcntl(0, F_GETFL, 0);
> > +    if (fl != -1 && (fl & (O_RDWR|O_RDONLY|O_WRONLY)) == O_RDWR)
> > +      attach_fd = 0;
> > +
> >      if (attach_fd == -1) {
> >        if ((n = secopen(attach_tty, O_RDWR | O_NONBLOCK, 0)) < 0)
> >          Panic(0, "Cannot open your terminal '%s' - please check.",
> > attach_tty);
> 
> Hey,
> 
> indeed that fixes it, thank you for investigating, I will release 4.6.1
> soon.

Thanks, it fixes the issue for me as well, 4.6.1 tested.

Best regards,
Andrew Savchenko

_______________________________________________
screen-users mailing list
screen-users-mXXj517/[email protected]
https://lists.gnu.org/mailman/listinfo/screen-users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE63ZIHsdeM+1XgNer9lNaM7oe5I0FAllj5CIACgkQ9lNaM7oe
5I1l8Q//XgdsnIYOW6ieMum3K3Y/pBim0yVR/baE8LsPj6OxEbpDYR4chYIStbyL
WAIFCAl24g6lk6jSzXDGWWHzMa3OvrY/y5wB7+PquFiMRDb6DDprH9LfcD2dyQuE
pqewtD2CH8DznjVowIPesJTg0ttAbS3h9zVI+GMgul5p6SmsaJWjfmxyT3aUtVc8
OI3wCIM7l0G+6FE43LCkuDYxn9Wx3GHycoTZ47CXQXzZ8EqjhXGYIRVM1rzxh19U
NBjcKbP8wGLe+fsK8VZTgJf7ovNYKqOoJURKiqMXOEuL9BDAR89Zagcn6R13q5WS
w6k515mL6wn/64Bxyw97hyRzTbGAHnzuShSXMtX4GtmcPYtzNSmOD/P/+xaLu2CI
nKZuMR+Vdydn8Lk4D/R7S2XC5PK8GNyeGTnnYq7I9l6yfaZslAipGhfSxPhsGiXf
mVhae67SD7xh3Bao/IsyyYjrhCjTuEXBdZXNYEDSG83EwIKves91LT/DhgHmeLiH
jybRlCm8c1QeabxjOm11kXgrPKdab/xEO4nEyVJQFP4/3jLBI8LS6koVHX0AIUpr
qli7Y1yDye7pDuBUnWG7AEA04QOW+ksqaES9BTU7ofhlKQEB6EXikqNoWYmPrPM+
WQHdEpkzJWanNjwRAxBlyIkqjdo0PRzNiLTsu2RkO4lNTyICIEQ=
=OU2k
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.