[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: screen-4.6.0 regression: within su: Cannot open your terminal '/dev/
From: |
Andrew Savchenko |
Subject: |
Re: screen-4.6.0 regression: within su: Cannot open your terminal '/dev/pts/14' - please check |
Date: |
Mon, 10 Jul 2017 23:31:30 +0300 |
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 <address@hidden> wrote:
>
> > On Thu, Jun 29, 2017 at 7:31 PM, Andrew Savchenko <address@hidden>
> > 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
pgpz_FOcAjQhV.pgp
Description: PGP signature