Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You are a very redundant person, that's what kind of person you are.


comp / comp.unix.shell / Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?

SubjectAuthor
* When/why does the shell (bash) (sometimes) not re-cycle job IDs?Kenny McCormack
`* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Christian Weisgerber
 +* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Lawrence D'Oliveiro
 |+- Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?vallor
 |+* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Janis Papanagnou
 ||+* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Kenny McCormack
 |||`* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Janis Papanagnou
 ||| `* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Kenny McCormack
 |||  `- Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Janis Papanagnou
 ||`- Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Lawrence D'Oliveiro
 |+- Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Kenny McCormack
 |`* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Christian Weisgerber
 | `* Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Lawrence D'Oliveiro
 |  `- Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Christian Weisgerber
 `- Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?Kenny McCormack

1
Subject: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Kenny McCormack
Newsgroups: comp.unix.shell
Organization: The official candy of the new Millennium
Date: Sat, 11 May 2024 19:47 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sat, 11 May 2024 19:47:25 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <v1oi0d$rrf5$3@news.xmission.com>
Injection-Date: Sat, 11 May 2024 19:47:25 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="912869"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

I recently experienced the following situation. I have 3 background jobs,
all interactive shells, nicely arranged as job #1, job #2, and job #3.

When I do the "j" command ("j" is aliased to "jobs -l"), I get something
like:

[1]+ <number> Running ssh somesystem &
[2] <number> Running ssh someOthersystem &
[3] <number> Running sudo bash &

Now, I did %1 and (accidentally) logged out of somesystem. Now, when I do
"j", I get:

[2] <number> Running ssh someOthersystem &
[3] <number> Running sudo bash &

So, I ssh back into somesystem and do the usual ~^Z and find that it is now
job #4. I want it to be job #1, like it was before.

Now, usually, when something like this happens, it is because some file or
some other resource is still open on the old object, so it cannot be
recycled. But this doesn't seem to be the case here. I tried it a few
times, but could not get back the #1 slot.

Eventually, I exited jobs 2 & 3, and then re-launched ssh somesystem and it
came out as job #1, after which I was able to re-construct jobs 2 & 3 and
then things were as they should be. But should this hack be necessary?

--
In American politics, there are two things you just don't f*ck with:

1) Goldman Sachs
2) The military/industrial complex

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Christian Weisgerber
Newsgroups: comp.unix.shell
Date: Sat, 11 May 2024 22:44 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sat, 11 May 2024 22:44:03 -0000 (UTC)
Message-ID: <slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de>
References: <v1oi0d$rrf5$3@news.xmission.com>
Injection-Date: Sat, 11 May 2024 22:44:03 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="51409"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
View all headers

On 2024-05-11, Kenny McCormack <gazelle@shell.xmission.com> wrote:

> I tried it a few times, but could not get back the #1 slot.

If no job is running, a new job gets 1, otherwise new jobs are
numbered consecutively.

I've only cursorily glanced over the code history, but I think it's
been like this in csh(1) since its initial import into the BSD
repository in 1980, and other shells have copied the behavior.

> Eventually, I exited jobs 2 & 3, and then re-launched ssh somesystem and it
> came out as job #1, after which I was able to re-construct jobs 2 & 3 and
> then things were as they should be. But should this hack be necessary?

As I accidentally discovered while looking at the code, csh(1) tries
to recycle smaller job IDs once it goes beyond 9. tcsh(1) preserves
that behavior to this day.

I offer no opinion on this, nor on the Plan 9 assertion that job
control is a poor hack and you should just open another window.

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 12 May 2024 00:14 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 00:14:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <v1p1kf$2ake7$1@dont-email.me>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 12 May 2024 02:14:08 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="98653f459e1a4c07d89f5088126edc2d";
logging-data="2445767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pyc4PVjE4VP7/1txrXm+G"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:sK0RJBRyRWQkv0usXAZpOJvytnA=
View all headers

On Sat, 11 May 2024 22:44:03 -0000 (UTC), Christian Weisgerber wrote:

> If no job is running, a new job gets 1, otherwise new jobs are numbered
> consecutively.

Job numbers are reused after it has notified you of termination of the
previous job. At least in Bash.

I’ve often wondered why shells don’t use poll/select-based event loops.
Then they can notify you of job termination immediately, instead of
waiting for you to press return.

> I offer no opinion on this, nor on the Plan 9 assertion that job control
> is a poor hack and you should just open another window.

I use job control, I use both tabs and windows in my favourite terminal
emulator (Konsole), and I use screen when SSH’ing to a client’s remote
test server. I have a bunch of containers running on the latter to try out
various things, and each one has its own session within screen.

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: vallor
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 12 May 2024 00:22 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 00:22:16 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <v1p23o$2358g$2@dont-email.me>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 12 May 2024 02:22:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="9fc4d1b29b3e59e18aeea1649650c530";
logging-data="2200848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cc6PvrfMZkLu9Hr6KYWMc"
User-Agent: Pan/0.158 (Avdiivka; a81241a; Linux-6.8.9)
Cancel-Lock: sha1:8KmlGxUmK20hqIdlA8aCVgpSu4Y=
X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n
XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ
View all headers

On Sun, 12 May 2024 00:14:08 -0000 (UTC), Lawrence D'Oliveiro
<ldo@nz.invalid> wrote in <v1p1kf$2ake7$1@dont-email.me>:

> I’ve often wondered why shells don’t use poll/select-based event loops.
> Then they can notify you of job termination immediately, instead of
> waiting for you to press return.

With bash: set -b

--
-v

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Janis Papanagnou
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 12 May 2024 01:38 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 03:38:03 +0200
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <v1p6hr$2btq7$1@dont-email.me>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 12 May 2024 03:38:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d0e5823276b1e40e4fa2dab904e6f31c";
logging-data="2488135"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+ykUYBi8GvLxnr7x4tAUz"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:9SYJbQNdri072qNLZMR0dfZ9LHI=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <v1p1kf$2ake7$1@dont-email.me>
View all headers

On 12.05.2024 02:14, Lawrence D'Oliveiro wrote:
> On Sat, 11 May 2024 22:44:03 -0000 (UTC), Christian Weisgerber wrote:
>
>> If no job is running, a new job gets 1, otherwise new jobs are numbered
>> consecutively.
>
> Job numbers are reused after it has notified you of termination of the
> previous job. At least in Bash.

Also the same behavior in Ksh, ever since I can remember; lowest job
number "available" gets re-used first. (Where "available" means that
its finishing status has been reported and not that the job finished.)

>
> I’ve often wondered why shells don’t use poll/select-based event loops.
> Then they can notify you of job termination immediately, instead of
> waiting for you to press return.

It may be considered undesired in an interactive shell to unnecessarily
spoil the output of other running processes. If job output would be
written asynchronously then you could also easily miss the output of
the job control system. Likely two undesired effects.

>
>> I offer no opinion on this, nor on the Plan 9 assertion that job control
>> is a poor hack and you should just open another window.

I'm using a lot shell windows, subshell instances, and also background
jobs. Each for different sets of use cases.

For me it's much faster to fire up a background job than opening a new
window. And a lot less overhead (typing, switching, timing, resources).

Sounds more like a "Use the hammer for this screw!" suggestion to me.

Janis

> [...]

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Kenny McCormack
Newsgroups: comp.unix.shell
Organization: The official candy of the new Millennium
Date: Sun, 12 May 2024 02:29 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 02:29:30 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <v1p9ia$s8og$1@news.xmission.com>
References: <v1oi0d$rrf5$3@news.xmission.com> <slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
Injection-Date: Sun, 12 May 2024 02:29:30 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="926480"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <v1p1kf$2ake7$1@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>On Sat, 11 May 2024 22:44:03 -0000 (UTC), Christian Weisgerber wrote:
>
>> If no job is running, a new job gets 1, otherwise new jobs are numbered
>> consecutively.
>
>Job numbers are reused after it has notified you of termination of the
>previous job. At least in Bash.

No, they don't. That's the point.

As Christian notes, they only get reused (starting over at #1) if there
aren't any jobs.

--
"Every time Mitt opens his mouth, a swing state gets its wings."

(Should be on a bumper sticker)

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Kenny McCormack
Newsgroups: comp.unix.shell
Organization: The official candy of the new Millennium
Date: Sun, 12 May 2024 02:30 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 02:30:29 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <v1p9k5$s8og$2@news.xmission.com>
References: <v1oi0d$rrf5$3@news.xmission.com> <slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me> <v1p6hr$2btq7$1@dont-email.me>
Injection-Date: Sun, 12 May 2024 02:30:29 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="926480"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <v1p6hr$2btq7$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>On 12.05.2024 02:14, Lawrence D'Oliveiro wrote:
>> On Sat, 11 May 2024 22:44:03 -0000 (UTC), Christian Weisgerber wrote:
>>
>>> If no job is running, a new job gets 1, otherwise new jobs are numbered
>>> consecutively.
>>
>> Job numbers are reused after it has notified you of termination of the
>> previous job. At least in Bash.
>
>Also the same behavior in Ksh, ever since I can remember; lowest job
>number "available" gets re-used first. (Where "available" means that
>its finishing status has been reported and not that the job finished.)

Nope. Sorry.

--
Those on the right constantly remind us that America is not a
democracy; now they claim that Obama is a threat to democracy.

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Kenny McCormack
Newsgroups: comp.unix.shell
Organization: The official candy of the new Millennium
Date: Sun, 12 May 2024 02:34 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 02:34:43 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <v1p9s3$s8og$3@news.xmission.com>
References: <v1oi0d$rrf5$3@news.xmission.com> <slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de>
Injection-Date: Sun, 12 May 2024 02:34:43 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="926480"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de>,
Christian Weisgerber <naddy@mips.inka.de> wrote:
>On 2024-05-11, Kenny McCormack <gazelle@shell.xmission.com> wrote:
>
>> I tried it a few times, but could not get back the #1 slot.
>
>If no job is running, a new job gets 1, otherwise new jobs are
>numbered consecutively.

Yeah, that seems to be it. I wonder why...

....
>As I accidentally discovered while looking at the code, csh(1) tries
>to recycle smaller job IDs once it goes beyond 9. tcsh(1) preserves
>that behavior to this day.

That's weird. I wonder why...

>I offer no opinion on this, nor on the Plan 9 assertion that job
>control is a poor hack and you should just open another window.

Well, certainly, having lots of windows open (and having things like
screen/tmux) is nice and is the modern way, but this is one situation where
I actually like having these other things running as jobs. If they were in
other windows (and/or in screen/tmux windows), I'd lose track of them.

As it is, I sometimes forget they are there.

--
Politics is show business for ugly people.

Sports is politics for stupid people.

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 12 May 2024 02:43 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 02:43:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <v1pabl$2g5ao$6@dont-email.me>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
<v1p6hr$2btq7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 12 May 2024 04:43:02 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="98653f459e1a4c07d89f5088126edc2d";
logging-data="2626904"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mA7QthOKiE7oiSVFf7UnQ"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:uMyH9Pn42bSyPUzcApbK+CbweJs=
View all headers

On Sun, 12 May 2024 03:38:03 +0200, Janis Papanagnou wrote:

> On 12.05.2024 02:14, Lawrence D'Oliveiro wrote:
>
>> I’ve often wondered why shells don’t use poll/select-based event
>> loops. Then they can notify you of job termination immediately, instead
>> of waiting for you to press return.
>
> It may be considered undesired in an interactive shell to unnecessarily
> spoil the output of other running processes.

Fair, but it could still do the report while waiting for you to input your
next command.

Bash uses GNU Readline, so it has the partial line you’ve input already,
and can redisplay it after the message, to allow you to continue typing
from where you left off.

DEC’s old VMS OS had a special terminal read operation called “read-with-
prompt”. If your partial input got messed up, it could be redisplayed,
along with the prompt string that was included in the read operation.

> If job output would be
> written asynchronously then you could also easily miss the output of
> the job control system.

That happens anyway. The only thing background processes are blocked from
doing is input from the controlling terminal.

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Christian Weisgerber
Newsgroups: comp.unix.shell
Date: Sun, 12 May 2024 09:47 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 09:47:16 -0000 (UTC)
Message-ID: <slrnv41414.1vaq.naddy@lorvorc.mips.inka.de>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
Injection-Date: Sun, 12 May 2024 09:47:16 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="64859"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
View all headers

On 2024-05-12, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

>> If no job is running, a new job gets 1, otherwise new jobs are numbered
>> consecutively.
>
> Job numbers are reused after it has notified you of termination of the
> previous job. At least in Bash.

Demonstrably false:

bash$ sleep 10 &
[1] 64882
bash$ sleep 200 &
[2] 64883
bash$ sleep 300 &
[3] 64884
bash$ sleep 400 &
[4] 64885
[1] Done sleep 10
bash$ sleep 500 &
[5] 64886
bash$ sleep 600 &
[6] 64887

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Janis Papanagnou
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 12 May 2024 16:36 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 18:36:36 +0200
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <v1qr6l$2qsv6$1@dont-email.me>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
<v1p6hr$2btq7$1@dont-email.me> <v1p9k5$s8og$2@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 12 May 2024 18:36:38 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="023db4f938d914569a9f6ad154da7beb";
logging-data="2978790"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/o2CBCZZAT2WEt1nDqv4Iq"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:s8ePw1F0gKaXdCUR8pbuZA752A8=
In-Reply-To: <v1p9k5$s8og$2@news.xmission.com>
View all headers

On 12.05.2024 04:30, Kenny McCormack wrote:
> In article <v1p6hr$2btq7$1@dont-email.me>,
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>> On 12.05.2024 02:14, Lawrence D'Oliveiro wrote:
>>> On Sat, 11 May 2024 22:44:03 -0000 (UTC), Christian Weisgerber wrote:
>>>
>>>> If no job is running, a new job gets 1, otherwise new jobs are numbered
>>>> consecutively.
>>>
>>> Job numbers are reused after it has notified you of termination of the
>>> previous job. At least in Bash.
>>
>> Also the same behavior in Ksh, ever since I can remember; lowest job
>> number "available" gets re-used first. (Where "available" means that
>> its finishing status has been reported and not that the job finished.)
>
> Nope. Sorry.

I read that as "in Bash it's not the case". - Can't tell; I can just
say that what LDO was claiming for Bash at least is the behavior for
Ksh. (You are not arguing that Ksh would behave differently, do you?)

Janis

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Kenny McCormack
Newsgroups: comp.unix.shell
Organization: The official candy of the new Millennium
Date: Sun, 12 May 2024 16:51 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 16:51:09 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <v1qs1t$suqb$1@news.xmission.com>
References: <v1oi0d$rrf5$3@news.xmission.com> <v1p6hr$2btq7$1@dont-email.me> <v1p9k5$s8og$2@news.xmission.com> <v1qr6l$2qsv6$1@dont-email.me>
Injection-Date: Sun, 12 May 2024 16:51:09 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="949067"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
View all headers

In article <v1qr6l$2qsv6$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
....
>>>> Job numbers are reused after it has notified you of termination of the
>>>> previous job. At least in Bash.
>>>
>>> Also the same behavior in Ksh, ever since I can remember; lowest job
>>> number "available" gets re-used first. (Where "available" means that
>>> its finishing status has been reported and not that the job finished.)
>>
>> Nope. Sorry.
>
>I read that as "in Bash it's not the case". - Can't tell; I can just
>say that what LDO was claiming for Bash at least is the behavior for
>Ksh. (You are not arguing that Ksh would behave differently, do you?)

You said that it does the right thing in ksh (*). LDO claimed
(incorrectly) that it does the right thing in bash. You then claimed that
it does the same thing in ksh as in bash, which is, clearly, incorrect.
Hence my Nope, Sorry.

(*) I have, just now, verified that it does the right thing in ksh - that
is, whatever version of ksh was laying around on this system for me to test
with.

P.S. I have also verified that, as noted by Christian, it does the wrong
thing in tcsh as well. I have not (yet) verified his statement about
things changing (in tcsh) when you have more than 9 background jobs...

--
On the subject of racism being depicted in the media, the far right and the far left have
met up in agreement (sort of like how plus infinity meets up with minus infinity).
The far left doesn't want it, because they are afraid it will make people racist.
The far right doesn't want it, because they are afraid it will make people feel bad about being racist.

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 12 May 2024 20:46 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Sun, 12 May 2024 20:46:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <v1r9rb$2vljb$4@dont-email.me>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
<slrnv41414.1vaq.naddy@lorvorc.mips.inka.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 12 May 2024 22:46:35 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="98653f459e1a4c07d89f5088126edc2d";
logging-data="3135083"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XgnxG+spVc2gycBkoxiXV"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:l9RpGKDHZSJWuTkEvMTeqDbIhsM=
View all headers

On Sun, 12 May 2024 09:47:16 -0000 (UTC), Christian Weisgerber wrote:

> On 2024-05-12, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>
>> Job numbers are reused after it has notified you of termination of the
>> previous job. At least in Bash.
>
> Demonstrably false:

Works for me:

ldo@theon:~> sleep 10 &
[1] 1094669
ldo@theon:~> sleep 1 &
[2] 1094670
ldo@theon:~>
[2]+ Done sleep 1
ldo@theon:~> sleep 1 &
[2] 1094671

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Janis Papanagnou
Newsgroups: comp.unix.shell
Organization: A noiseless patient Spider
Date: Sun, 12 May 2024 22:48 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Mon, 13 May 2024 00:48:22 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <v1rgvn$31c1v$1@dont-email.me>
References: <v1oi0d$rrf5$3@news.xmission.com> <v1p6hr$2btq7$1@dont-email.me>
<v1p9k5$s8og$2@news.xmission.com> <v1qr6l$2qsv6$1@dont-email.me>
<v1qs1t$suqb$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 13 May 2024 00:48:23 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="68a0cdbb5860b077df633bb789caf29f";
logging-data="3190847"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fUw0b4MzxfR/Ysomel9ZD"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:omVhSqU+juGfjtGSUxclBBz/ONQ=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <v1qs1t$suqb$1@news.xmission.com>
View all headers

On 12.05.2024 18:51, Kenny McCormack wrote:
> In article <v1qr6l$2qsv6$1@dont-email.me>,
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> ...
>>>>> Job numbers are reused after it has notified you of termination of the
>>>>> previous job. At least in Bash.
>>>>
>>>> Also the same behavior in Ksh, ever since I can remember; lowest job
>>>> number "available" gets re-used first. (Where "available" means that
>>>> its finishing status has been reported and not that the job finished.)
>>>
>>> Nope. Sorry.
>>
>> I read that as "in Bash it's not the case". - Can't tell; I can just
>> say that what LDO was claiming for Bash at least is the behavior for
>> Ksh. (You are not arguing that Ksh would behave differently, do you?)
>
> You said that it does the right thing in ksh (*). LDO claimed
> (incorrectly) that it does the right thing in bash. You then claimed that
> it does the same thing in ksh as in bash, which is, clearly, incorrect.
> Hence my Nope, Sorry.

I was assuming that LDO made a correct claim. But all I wanted to say
was that ksh is doing what LDO was describing. It wasn't my intention
to give the impression that I verified what Bash would do - Bash is
not the shell I am using.

>
> (*) I have, just now, verified that it does the right thing in ksh - that
> is, whatever version of ksh was laying around on this system for me to test
> with.

Not sure what the Right Thing would be. After all (for me) the choice
of %n is no more or less "right" than the choice of PIDs are; all I
need is certainty about validity in certain instances of time, not so
much whether or when the numbering is reused, restarted from 1.

Is there any practical problem I'm unaware about?

Janis

>
> [...]

Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
From: Christian Weisgerber
Newsgroups: comp.unix.shell
Date: Mon, 13 May 2024 10:42 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: When/why does the shell (bash) (sometimes) not re-cycle job IDs?
Date: Mon, 13 May 2024 10:42:08 -0000 (UTC)
Message-ID: <slrnv43rk0.2sq1.naddy@lorvorc.mips.inka.de>
References: <v1oi0d$rrf5$3@news.xmission.com>
<slrnv3vt5j.1gfp.naddy@lorvorc.mips.inka.de> <v1p1kf$2ake7$1@dont-email.me>
<slrnv41414.1vaq.naddy@lorvorc.mips.inka.de> <v1r9rb$2vljb$4@dont-email.me>
Injection-Date: Mon, 13 May 2024 10:42:08 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="95042"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
View all headers

On 2024-05-12, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

>>> Job numbers are reused after it has notified you of termination of the
>>> previous job. At least in Bash.
>>
>> Demonstrably false:
>
> Works for me:
>
> ldo@theon:~> sleep 10 &
> [1] 1094669
> ldo@theon:~> sleep 1 &
> [2] 1094670
> ldo@theon:~>
> [2]+ Done sleep 1
> ldo@theon:~> sleep 1 &
> [2] 1094671

So if the highest numbered job terminates, that number is immediately
reused. Earlier ones are not.

It's a stack.

And again, that behavior is already present in csh.

--
Christian "naddy" Weisgerber naddy@mips.inka.de

1

rocksolid light 0.9.8
clearnet tor