bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A background ssh can take over the tty from bash?


From: Clark Wang
Subject: Re: A background ssh can take over the tty from bash?
Date: Mon, 12 Jun 2017 10:24:38 +0800

On Mon, Jun 12, 2017 at 5:48 AM, Chet Ramey <address@hidden> wrote:

> On 6/10/17 10:19 AM, Clark Wang wrote:
>
> > If I kill the "ssh -o ControlMaster=no -o ControlPath=/tmp/socket.tmp
> > 127.0.0.1 sleep 9999" then tty #1 (pts/11) would be able to accept my
> input
> > again. Seems like the background "ssh" at tty #1 is consuming all input.
> I
> > cannot understand this since it should be stopped by SIGTTIN if it tries
> to
> > read from the tty.
>
> This has come up before. You need to use `ssh -n' to avoid it reading from
> stdin. Processes can ignore SIGTTIN, and ssh does so to avoid being stopped
> if it reads from the tty while in the background.
>

I've checked the ssh process and it does not catch SIGTTIN and that's why
I'm confused.

$ ps p937
   PID TTY      STAT   TIME COMMAND
   937 pts/2    S      0:00 ssh -o ControlMaster=no -o
ControlPath=/tmp/socket.ssh 127.0.0.1 sleep 9999
$ ps s p937
  UID    PID          PENDING          BLOCKED          IGNORED
CAUGHT STAT TTY        TIME COMMAND
    0    937 0000000000000000 0000000000000000 0000000000001000
0000000188004003 S    pts/2      0:00 ssh -o ControlMaster=no -o
ControlPath=/tmp/socket.ssh 127.0.0.1 sleep 9999
$

The decoded sig masks are:

PENDING (0000000000000000):
BLOCKED (0000000000000000):
IGNORED (0000000000001000):
  13 PIPE
CAUGHT (0000000188004003):
   1 HUP
   2 INT
  15 TERM
  28 WINCH
  32
  33


reply via email to

[Prev in Thread] Current Thread [Next in Thread]