Deutsch   English   Français   Italiano  
<837cajx1s1.fsf@helmutwaitzmann.news.arcor.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Helmut Waitzmann <nn.throttle@xoxy.net>
Newsgroups: comp.unix.shell
Subject: Re: (bash) How (really!) does the "current job" get determined?
Date: Mon, 07 Oct 2024 19:26:22 +0200
Organization: A noiseless patient Spider
Lines: 23
Sender: Helmut Waitzmann <12f7e638@mail.de>
Message-ID: <837cajx1s1.fsf@helmutwaitzmann.news.arcor.de>
References: <vdn864$2p69n$1@news.xmission.com>
	<20241003170607.397@kylheku.com> <vdopmn$2ptf8$1@news.xmission.com>
	<20241004070133.515@kylheku.com>
	<slrnvg0alc.1le3.naddy@lorvorc.mips.inka.de>
	<vdpgf0$bchi$1@dont-email.me>
	<slrnvg0s5f.1qk1.naddy@lorvorc.mips.inka.de>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Date: Mon, 07 Oct 2024 19:29:12 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="28b53b9b7692c972ca5696d9038b8db8";
	logging-data="1901274"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18PVwVyLLRRQ3K32G12SzAFEttWkmQ8THs="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:pkz9TQUTuj1RAhVVje1vNyyqBhs=
	sha1:8ZFlR8nblEj6U7FPsEFZF0LZEo4=
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mail-Copies-To: nobody
Bytes: 2426

 Christian Weisgerber <naddy@mips.inka.de>:

> That said, here's something I stumbled across recently:=20
>
>
>     background job &
>     ...
>     kill %1     # clean up
>
> What happens if the background job has already terminated on its=20
> own accord before we reach the kill(1)?  Not much, because with job=20
> control, the shell knows that no such job exists.  If you do this=20
> with "kill $!", you signal that PID, which no longer refers to the=20
> intended process and may in fact have been reused for a different=20
> process.=20
>

 In order for the pid "$!" to have been reused for a different=20
 process the shell would have needed call "wait()" (or=20
 "waitpid()") beforehand.=C2=A0 (Otherwise the terminated process would=20
 remain a zombie (i.e. an unwaited) process.)=C2=A0 Does the shell even=20
 call "wait()" or "waitpid()" if given the "set" option "+b"?=20