Uzbl

Tasklist

FS#34 - bg stops process

Attached to Project: Uzbl
Opened by Sebastian (seppo0010) - 2009-06-08 12:16:31 AM
Last edited by Dieter Plaetinck (Dieter_be) - 2009-08-26 08:14:31 PM
Task Type Bug Report
Category uzbl-core
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

When you ctrl+z the uzbl process and "bg" it, I get a notification that the process has stopped. To resume the process I have to "fg" and can leave it on background.
This task depends upon

Closed by  Dieter Plaetinck (Dieter_be)
2009-08-26 08:14:31 PM
Reason for closing:  Fixed
Comment by dx (dx) - 2009-06-10 09:40:35 PM Comment by Dieter Plaetinck (Dieter_be) - 2009-06-11 05:41:52 PM
I find that fix rather unclean.
I'm no expert in this field but I have the feeling what we should do is intercept when we're about to be backgrounded, and stop listening on stdin when that happens. When we're forgrounded we may start listening again, though I'm not sure if that's useful at all. In fact I'm not sure about any of this.

http://www.unix.com/linux/52750-question-about-background-processes.html
Comment by dx (dx) - 2009-06-12 07:01:41 PM
Ok, so I've been investigating a bit how CTRL-Z works.
First SIGTSTP is sent, then SIGSTOP. You can handle SIGTSTP, but not SIGSTOP. Going to background means receiving SIGCONT.

Of the apps i've checked that seemed to have good stop handling, bash and lftp (readline), both ignore SIGTSTP, so you can't use CTRL-Z directly. Instead, they provide a "suspend" command that is supposed to do cleanup, but didn't change much. Sending bash to background kills the parent bash (!). lftp seems to handle it better, since it is designed to stay working on background, but sending SIGSTOP triggers the same behavior. The "suspend" command does nothing more than sending itself SIGSTOP, but it does get it out of the readline loop.

After this it may seem strange that they took this approach, instead of handling SIGTSTP and getting out of that readline loop. But I think I know why: they can't get out of the readline loop, just like we can't get out of a blocking stdin read call. And they are all blocking, because of the I/O buffer.

Clean solution? Add a suspend command, ignore SIGTSTP (disallow ctrl-z).
Comment by dx (dx) - 2009-06-15 07:21:09 AM
16:38 < dxdx> oh, Dieterbe: i think i have the solution to the stdin problems. instead of reading it as default, read it only if config file is "-", as in uzbl -c-
17:07 < Dieterbe> dxdx: hmm... yeah maybe

http://github.com/dequis/uzbl/commit/ed39cbe56f8923407604a1306a179529521ecd26

But it's uzbl -c -, with a space between.

Loading...