[pve-devel] [PATCH common 0/2] fix #1956 return controlling terminal in fork_worker

Stoiko Ivanov s.ivanov at proxmox.com
Tue Nov 20 09:46:30 CET 2018


The problem described in https://bugzilla.proxmox.com/show_bug.cgi?id=1956 is
the result of the changes introduced e97f807c388c10250f442b1f16c5315df2ffc2af:
* The childprocess in fork_worker put itself in the forground by calling
  `tcsetpgrp`, but did not change the foreground process group when exiting.
* This in turn breaks scripts, which try to get input from the same terminal
  (e.g. by calling the `read` shell builtin - see the sample script attached in
  the bugreport) - not being in the foreground results in the script being
  stopped (default action for SIGTTOU).

The second patch returns the terminal to the parent before the child exits
fixing the scripts behavior.

The first patch refactors the error handling before the child exits.
IMO the last `kill(-9, $$)` would never get called, therefore I dropped it, but
given the central role of fork_worker would be grateful for other opinions/eyes.


Stoiko Ivanov (2):
  fork_worker: refactor child exit
  fix #1956: return controlling terminal to parent

 src/PVE/RESTEnvironment.pm | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

-- 
2.11.0





More information about the pve-devel mailing list