Bug#378469: [Buildd-tools-devel] Bug#378469: backgrounded schroot
processes do not terminate
Roger Leigh
rleigh at whinlatter.ukfsn.org
Mon Jul 17 21:13:22 UTC 2006
[Please can you keep the 378469 at bugs.debian.org in the Cc:, so it gets
recorded in the bug history. Thanks.]
Matthew Foulkes <m.foulkes at blueyonder.co.uk> writes:
> Dear Roger,
>
> On Mon, Jul 17, 2006 at 11:00:56AM +0100, Roger Leigh wrote:
>> I would suggest either
>>
>> schroot -c ia32 -p oowriter >/dev/null 2>&1 &
>>
>> or
>>
>> schroot -c ia32 -p /bin/sh -c 'oowriter >/dev/null 2>&1' &
>
> Sorry to bother you yet again, but neither of these solutions works. The
> first gets rid of the tty output but does not help the oowriter process
> terminate. The second produces the error message
>
> oowriter >/dev/null 2>&1: Chroot not found
>
> By omitting the quotation marks I can get rid of the "Chroot not found"
> error message, but oowriter doesn't start.
Ah, that's my fault. Use "--" to mark the end of the schroot options:
schroot -c ia32 -p -- /bin/sh -c 'oowriter >/dev/null 2>&1' &
This means the -c gets passed through to /bin/sh instead of being used
by schroot.
> Also, I am no longer convinced by the explanation you sent me this
> morning. Compare
>
> matthew at dolphin:~$ schroot -c ia32 -p oowriter &
> [1] 11545
> matthew at dolphin:~$ I: [ia32 chroot] Running command: “oowriter”
> [1]+ Stopped schroot -c ia32 -p oowriter
schroot is run backgrounded, and it runs oowriter. When oowriter
writes to the tty, SIGTTOU causes both to stop (possibly caused by
termios setting--see below).
> with
>
> matthew at dolphin:~$ schroot -c ia32
> I: [ia32 chroot] Running login shell: ‘/bin/bash’
> (ia32)matthew at dolphin:~$ oowriter &
> [1] 11591
> (ia32)matthew at dolphin:~$ I18N: Operating system doesn't support locale "en_US"
> [1]+ Done oowriter
schroot is run in the foreground, so will not get any SIGTTOU/SIGTTIN
signals.
I can make a process stop when it attempts input in the background:
$ cat &
But it doesn't stop when you output while in the background.
$ ls &
I think what you are seeing here is when schroot saves/restores the
terminal termios settings, that causes the signal to be sent. Check
out the main::run method here:
http://svn.debian.org/wsvn/buildd-tools/trunk/schroot/schroot/schroot-base-main.cc?op=file&rev=0&sc=0
> If you use schroot to start oowriter as a background command directly,
> no locale error message appears and yet the oowriter process fails to
> terminate when the quit button is clicked. If you first log in to the
> chroot and then start oowriter as a background command, a locale error
> message appears but the process terminates fine. Based on the
> explanation you sent me this morning, I would not have expected this.
I think this is due to the termios bits above.
If you comment out the blocks of code which call tcgetattr and
tcsetattr, and try again, that will show if it's the termios handling
causing this.
tcgetattr, called at startup, might trigger a SIGTTIN. strace(1)
might show this.
The reason for saving and restoring the termios is to ensure that if a
child process corrupts the terminal state, we restore it to sanity (or
at least how it was when we started) when exiting.
The authentication conversation handler (password prompt) also does
this if you are being prompted for a password, but that's probably not
happening here.
> I am sure that you feel you have received more than enough emails from
> me, so I will not contact you again unless encouraged.
Don't worry about it--if there is a problem here, I would very much
like to get to the bottom of it and fix it.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please sign and encrypt your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20060717/7d96db51/attachment.pgp
More information about the Buildd-tools-devel
mailing list