Re: Monitor mode handling (bug ?)

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

 



On Friday, January 13, 2023 10:03:35 PM CET Steffen Nurpmeso wrote:

Hello Steffen,

> Well i mean, in spirit of Wheeler's "anything is possible with
> (one more) indirection" it could be possible nonetheless?
> [...]

Well, my initial examples then become :

$ cat test_ko.sh
set -m
$ dash test_ko.sh &
[1]  + suspended (tty input)  dash test_ko.sh

$ cat test_ok.sh
(
  set -m
)
$ dash test_ok.sh &
[1]  + done       dash test_ok.sh

It is not clear for me why that extra fork fixes the problem, but it works, 
thanks!

Unfortunately, my initial goal is to get a new process group for later 
children processes, but FreeBSD's sh (as well as dash) requires 'set -m' to be 
executed from the first process [1]. The extra fork breaks that requirement. 
The following example shows that the new process' PGID remains the same as the 
initial shell:

$ cat test_pgid.sh
(
  set -m
  (
    sleep 1
  ) &
  i=$!
  echo "Main shell has: $(ps -o pid,pgid $$)"
  echo "Sub-shell has: $(ps -o pid,pgid $i)"
  wait $i
)
$ dash test_pgid.sh &
Main shell has:   PID  PGID
10362 10362
Sub-shell has:   PID  PGID
10364 10362
[1]  + done       dash test_pgid.sh

So I am afraid the 'extra fork' tip is not useable for me...

Cheers,

Ganael.

[1] Discussed here: https://lists.freebsd.org/archives/freebsd-hackers/2022-March/000924.html

-- 
Ganael LAPLANCHE <ganael.laplanche@xxxxxxxxxxxx>
http://www.martymac.org | http://contribs.martymac.org
FreeBSD: martymac <martymac@xxxxxxxxxxx>, http://www.FreeBSD.org





[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux