Re: 'wait -n' with and without id arguments

2024-09-29 Thread Zachary Santer
CWRU/CWRU.chlog: >9/25 > > jobs.c > - wait_for_any_job: if the jobs table is empty and there are no > eligible procsubs, and the shell is in posix mode, take a random > pid from the bgpids table, delete it, and return its status > (since we would be deleting that pid from bgpids a

Re: 'wait -n' with and without id arguments

2024-09-26 Thread Chet Ramey
On 9/25/24 6:14 PM, Robert Elz wrote: Date:Wed, 25 Sep 2024 16:15:07 -0400 From:Chet Ramey Message-ID: <20daab70-09e2-4dfa-a98a-4ba29b622...@case.edu> | Do you think the text you quoted satisfies the "unless otherwise specified?" I think "unspecified whether

Re: 'wait -n' with and without id arguments

2024-09-26 Thread Robert Elz
Date:Thu, 26 Sep 2024 10:39:23 -0400 From:Chet Ramey Message-ID: | If it's going to be unspecified, it will be because there are conflicting | implementations, not because we can't decide on the right language. Yes, of course, and it wasn't the wording I meant,

Re: 'wait -n' with and without id arguments

2024-09-25 Thread Robert Elz
Date:Wed, 25 Sep 2024 16:15:07 -0400 From:Chet Ramey Message-ID: <20daab70-09e2-4dfa-a98a-4ba29b622...@case.edu> | Do you think the text you quoted satisfies the "unless otherwise specified?" I think "unspecified whether it is removed at A or B" is fairly clear tha

Re: 'wait -n' with and without id arguments

2024-09-25 Thread Chet Ramey
On 9/25/24 12:50 PM, Robert Elz wrote: Date:Wed, 25 Sep 2024 11:06:10 -0400 From:Chet Ramey Message-ID: | So you are saying that prompt notifications and `jobs' have the same | effect. POSIX implies but does not require this, and there is differing | be

Re: 'wait -n' with and without id arguments

2024-09-25 Thread Robert Elz
Date:Wed, 25 Sep 2024 11:06:10 -0400 From:Chet Ramey Message-ID: | So you are saying that prompt notifications and `jobs' have the same | effect. POSIX implies but does not require this, and there is differing | behavior among current implementatations. What i

Re: 'wait -n' with and without id arguments

2024-09-25 Thread Chet Ramey
On 9/8/24 8:35 PM, Zachary Santer wrote: This is still a discussion about interactive shell behavior only. What behavior do you want from the command lists that differs from what I described above? Since shell functions are essentially lists, you should get the same behavior from both. You'd

Re: 'wait -n' with and without id arguments

2024-09-22 Thread Zachary Santer
BASH_VERSION now says "5.3.0(1)-beta", so it seems like a fair time to test again: $ source ./wait-n-failure $ wait-n-failure::main Reliable. $ wait-n-failure::main explicit_pids Reliable. $ wait-n-failure::main monitor Still loses a few concurrent processes each time. Most often 5, which is in

Re: 'wait -n' with and without id arguments

2024-09-17 Thread Chet Ramey
On 9/9/24 10:45 AM, Zachary Santer wrote: He wants interactive shells to notify the user less frequently about job status changes so `wait -n' works better. That's one option, but not my preferred option. I'll attempt a tl;dr: Stipulating that this is for interactive shells only. A) Solve

Re: 'wait -n' with and without id arguments

2024-09-09 Thread Zachary Santer
On Mon, Sep 9, 2024 at 9:06 AM Chet Ramey wrote: > > On 9/8/24 11:13 PM, Oğuz wrote: > > On Monday, September 9, 2024, Zachary Santer > > wrote: > > > > Slightly improved wait-n-failure attached. > > > > > > It's >100 lines and your replies are too long. Summarize wh

Re: 'wait -n' with and without id arguments

2024-09-09 Thread Chet Ramey
On 9/8/24 11:13 PM, Oğuz wrote: On Monday, September 9, 2024, Zachary Santer > wrote: Slightly improved wait-n-failure attached. It's >100 lines and your replies are too long. Summarize what you want so others can contribute too without having to waste time readi

Re: 'wait -n' with and without id arguments

2024-09-08 Thread Oğuz
On Monday, September 9, 2024, Zachary Santer wrote: > Slightly improved wait-n-failure attached. It's >100 lines and your replies are too long. Summarize what you want so others can contribute too without having to waste time reading the whole thread. -- Oğuz

Re: 'wait -n' with and without id arguments

2024-09-08 Thread Zachary Santer
Slightly improved wait-n-failure attached. On Thu, Sep 5, 2024 at 12:10 PM Chet Ramey wrote: > > On 8/30/24 11:06 PM, Zachary Santer wrote: > > CWRU/CWRU.chlog: > > >8/26 > > > > > > > > execute_cmd.c > > > [...] > > > - execute_connection: in default mode, bash performs jobs not

Re: 'wait -n' with and without id arguments

2024-09-05 Thread Chet Ramey
On 8/30/24 11:06 PM, Zachary Santer wrote: New wait-n-failure attached. I'll look at this. These always take a long time. (Apparently ${SECONDS} can't be declared local and still work.) Making a variable local removes the special behavior on assignment and reference. $ source ~/random/wa

Re: 'wait -n' with and without id arguments

2024-09-05 Thread Chet Ramey
On 8/30/24 11:06 PM, Zachary Santer wrote: CWRU/CWRU.chlog: >    8/26 >    > execute_cmd.c > [...] > - execute_connection: in default mode, bash performs jobs notifications >   in an interactive shell between commands separated by ';' or '\n'. >   It shouldn't do this in posix mode,

Re: 'wait -n' with and without id arguments

2024-08-30 Thread Zachary Santer
CWRU/CWRU.chlog: >8/26 > > execute_cmd.c > [...] > - execute_connection: in default mode, bash performs jobs notifications > in an interactive shell between commands separated by ';' or '\n'. > It shouldn't do this in posix mode, since posix now specifies when > notifications can

Re: 'wait -n' with and without id arguments

2024-08-26 Thread Chet Ramey
On 8/16/24 8:21 AM, Zachary Santer wrote: On Wed, Aug 14, 2024 at 11:22 PM Zachary Santer wrote: The implicit 'jobs' isn't happening before each PS1, but after each command completes. Thus, all the [1] Donerandom_sleep notifications when sourcing wait-n-failure, before

Re: 'wait -n' with and without id arguments

2024-08-26 Thread Chet Ramey
On 8/14/24 11:22 PM, Zachary Santer wrote: On Wed, Aug 14, 2024 at 3:22 PM Chet Ramey wrote: On 8/7/24 2:47 PM, Zachary Santer wrote: Now I understand that this is because the list of terminated child processes that 'wait -n' currently ignores is only used in the interactive shell. It's no

Re: 'wait -n' with and without id arguments

2024-08-21 Thread Robert Elz
Date:Wed, 21 Aug 2024 11:00:19 -0400 From:Chet Ramey Message-ID: <1b229634-888f-4f06-8761-c16d62501...@case.edu> | POSIX doesn't actually say that. It says, in a couple of different places, | "the message shall be written immediately prior to writing the next prom

Re: 'wait -n' with and without id arguments

2024-08-21 Thread Chet Ramey
On 8/21/24 9:25 AM, Chet Ramey wrote: On 8/14/24 4:42 PM, Robert Elz wrote: the implicit "jobs" before each PS1). POSIX doesn't actually say that. It says, in a couple of different places, "the message shall be written immediately prior to writing the next prompt for input," which implies th

Re: 'wait -n' with and without id arguments

2024-08-21 Thread Chet Ramey
On 8/21/24 9:27 AM, Chet Ramey wrote: On 8/15/24 2:39 AM, Zachary Santer wrote: I figured it out. I had to futz with Windows, MSYS, and then git to have the symlinks in the repo actually be real-deal symlinks. What are `real-deal' symlinks on Windows? The symlinks in the devel repo work fine

Re: 'wait -n' with and without id arguments

2024-08-21 Thread Chet Ramey
On 8/15/24 2:39 AM, Zachary Santer wrote: I figured it out. I had to futz with Windows, MSYS, and then git to have the symlinks in the repo actually be real-deal symlinks. What are `real-deal' symlinks on Windows? The symlinks in the devel repo work fine on Unix machines. -- ``The lyf so shor

Re: 'wait -n' with and without id arguments

2024-08-21 Thread Chet Ramey
On 8/14/24 4:42 PM, Robert Elz wrote: Date:Wed, 14 Aug 2024 15:21:44 -0400 From:Chet Ramey Message-ID: <1413a9a0-cbef-44c5-8072-a3be7294e...@case.edu> | I'm not sure returning the status of some random process from some | arbitrary point in the past is goin

Re: 'wait -n' with and without id arguments

2024-08-16 Thread Zachary Santer
On Wed, Aug 14, 2024 at 11:22 PM Zachary Santer wrote: > > The implicit 'jobs' isn't happening before each PS1, but after each > command completes. Thus, all the > > [1] Donerandom_sleep > notifications when sourcing wait-n-failure, before it prints > > 3 processes waited / 8

Re: 'wait -n' with and without id arguments

2024-08-14 Thread Zachary Santer
On Wed, Aug 14, 2024 at 3:26 PM Chet Ramey wrote: > > On 8/12/24 11:57 AM, Zachary Santer wrote: > > > > Nobody had any answers in my help-bash > > thread on this topic, but does the devel branch have any build > > dependency that differs from those of the master and pre-release > > branches? > >

Re: 'wait -n' with and without id arguments

2024-08-14 Thread Zachary Santer
On Wed, Aug 14, 2024 at 3:22 PM Chet Ramey wrote: > > On 8/7/24 2:47 PM, Zachary Santer wrote: > > > Now I understand that this is because the list of terminated child > > processes that 'wait -n' currently ignores is only used in the > > interactive shell. > > It's not, but there might be some va

Re: 'wait -n' with and without id arguments

2024-08-14 Thread Robert Elz
Date:Wed, 14 Aug 2024 15:21:44 -0400 From:Chet Ramey Message-ID: <1413a9a0-cbef-44c5-8072-a3be7294e...@case.edu> | I'm not sure returning the status of some random process from some | arbitrary point in the past is going to be valuable. Not "some random process"

Re: 'wait -n' with and without id arguments

2024-08-14 Thread Chet Ramey
On 8/12/24 11:57 AM, Zachary Santer wrote: On Mon, Aug 12, 2024 at 11:12 AM Chet Ramey wrote: That stuff changed last month, after bash-5.3-alpha was released. Before that change, neither interactive nor non-interactive shells checked the list of saved statuses. The difference was when the use

Re: 'wait -n' with and without id arguments

2024-08-14 Thread Chet Ramey
On 8/9/24 9:29 PM, Zachary Santer wrote: On Fri, Aug 9, 2024 at 10:38 AM Chet Ramey wrote: When I source your script on macOS with the current devel build, I get the set of notification messages and termination with a false argument, and an infinite loop with a true argument. So basically, '

Re: 'wait -n' with and without id arguments

2024-08-14 Thread Chet Ramey
On 8/7/24 2:47 PM, Zachary Santer wrote: Now I understand that this is because the list of terminated child processes that 'wait -n' currently ignores is only used in the interactive shell. It's not, but there might be some value here. If you want the behavior of 'wait -n' to be consistent

Re: 'wait -n' with and without id arguments

2024-08-12 Thread Zachary Santer
On Mon, Aug 12, 2024 at 11:13 AM Chet Ramey wrote: > > On 8/7/24 2:47 PM, Zachary Santer wrote: > > > Now I understand that this is because the list of terminated child > > processes that 'wait -n' currently ignores is only used in the > > interactive shell. > > Do you mean when no arguments are s

Re: 'wait -n' with and without id arguments

2024-08-12 Thread Zachary Santer
On Mon, Aug 12, 2024 at 11:12 AM Chet Ramey wrote: > > That stuff changed last month, after bash-5.3-alpha was released. Before > that change, neither interactive nor non-interactive shells checked the > list of saved statuses. The difference was when the user was notified of > a process's exit st

Re: 'wait -n' with and without id arguments

2024-08-12 Thread Chet Ramey
On 8/7/24 2:47 PM, Zachary Santer wrote: Now I understand that this is because the list of terminated child processes that 'wait -n' currently ignores is only used in the interactive shell. Do you mean when no arguments are supplied? It's not. The difference is when a job is marked as notified

Re: 'wait -n' with and without id arguments

2024-08-12 Thread Chet Ramey
On 8/7/24 2:47 PM, Zachary Santer wrote: On Wed, Aug 7, 2024 at 11:06 AM Chet Ramey wrote: On 7/31/24 11:40 AM, Zachary Santer wrote: I think I was missing more than that. Was the original 'wait -n' discussion from January specific to its use within the interactive shell? No, it was due to

Re: 'wait -n' with and without id arguments

2024-08-09 Thread Zachary Santer
On Fri, Aug 9, 2024 at 10:38 AM Chet Ramey wrote: > > When I source your script on macOS with the current devel build, I get the > set of notification messages and termination with a false argument, and an > infinite loop with a true argument. So basically, 'wait -n' should be implemented such th

Re: 'wait -n' with and without id arguments

2024-08-09 Thread Greg Wooledge
On Fri, Aug 09, 2024 at 15:20:52 -0400, Zachary Santer wrote: > On Fri, Aug 9, 2024 at 2:52 PM Greg Wooledge wrote: > > > > The problem is that our entire understanding of what "wait -n" DOES has > > been annihilated. We thought it would "trigger" exactly once for every > > completed background p

Re: 'wait -n' with and without id arguments

2024-08-09 Thread Zachary Santer
On Fri, Aug 9, 2024 at 2:52 PM Greg Wooledge wrote: > > The problem is that our entire understanding of what "wait -n" DOES has > been annihilated. We thought it would "trigger" exactly once for every > completed background process, regardless of whether they completed > before or after calling "

Re: 'wait -n' with and without id arguments

2024-08-09 Thread Greg Wooledge
On Fri, Aug 09, 2024 at 13:59:58 -0400, Zachary Santer wrote: > I don't necessarily understand why someone would call 'wait -n' from > the interactive shell, so I don't really know what the desired > behavior would be when they do so. Would be nice if other people want > to chime in on that point.

Re: 'wait -n' with and without id arguments

2024-08-09 Thread Zachary Santer
On Fri, Aug 9, 2024 at 10:38 AM Chet Ramey wrote: > > OK, I see what's happening. When the shell is interactive, it notifies > the user when a background job terminates and prints a message to the > terminal. That's the series of > > [2] Donerandom_sleep > > messages you see.

Re: 'wait -n' with and without id arguments

2024-08-09 Thread Chet Ramey
On 7/31/24 3:52 PM, Zachary Santer wrote: On Wed, Jul 31, 2024 at 11:40 AM Zachary Santer wrote: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: msys Compiler: gcc Compilation CFLAGS: -g -O2 uname output: MSYS_NT-10.0-19045 Zack2021HPPavilion 3.5.3-d8b21

Re: 'wait -n' with and without id arguments

2024-08-07 Thread Zachary Santer
On Wed, Aug 7, 2024 at 11:06 AM Chet Ramey wrote: > > On 7/31/24 11:40 AM, Zachary Santer wrote: > > > > I think I was missing more than that. Was the original 'wait -n' > > discussion from January specific to its use within the interactive > > shell? > > No, it was due to processes exiting due to

Re: 'wait -n' with and without id arguments

2024-08-07 Thread Chet Ramey
On 7/31/24 11:40 AM, Zachary Santer wrote: On Fri, Jul 26, 2024 at 10:37 AM Chet Ramey wrote: On 7/20/24 1:50 PM, Zachary Santer wrote: 'wait' without -n or pid arguments doesn't look in the list of saved pids and statuses simply because it would serve no purpose for it to do so. The return

Re: 'wait -n' with and without id arguments

2024-08-07 Thread Chet Ramey
On 7/31/24 11:40 AM, Zachary Santer wrote: Thanks for your updates to the manual. "Wait for each specified child process id and return the termination status of the last id." Would it be better to say "Wait for each specified child process id and return the termination status of the last id arg

Re: 'wait -n' with and without id arguments

2024-07-31 Thread Zachary Santer
On Wed, Jul 31, 2024 at 11:40 AM Zachary Santer wrote: > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: msys > Compiler: gcc > Compilation CFLAGS: -g -O2 > uname output: MSYS_NT-10.0-19045 Zack2021HPPavilion > 3.5.3-d8b21b8c.x86_64 2024-07-09 18:03 UT

Re: 'wait -n' with and without id arguments

2024-07-31 Thread Zachary Santer
On Fri, Jul 26, 2024 at 10:37 AM Chet Ramey wrote: > > On 7/20/24 1:50 PM, Zachary Santer wrote: > > > > 'wait' without -n or pid arguments doesn't look in the list of saved > > pids and statuses simply because it would serve no purpose for it to > > do so. The return status will be 0, no matter h

Re: 'wait -n' with and without id arguments

2024-07-26 Thread Chet Ramey
On 7/20/24 1:50 PM, Zachary Santer wrote: Was "waiting for process substitutions" For context: $ git show -q origin/devel commit 6c703092759ace29263ea96374e18412c59acc7f (origin/devel) Author: Chet Ramey Date: Thu Jul 18 16:48:17 2024 -0400 job control cleanups; wait -n can return termi

'wait -n' with and without id arguments

2024-07-20 Thread Zachary Santer
Was "waiting for process substitutions" For context: $ git show -q origin/devel commit 6c703092759ace29263ea96374e18412c59acc7f (origin/devel) Author: Chet Ramey Date: Thu Jul 18 16:48:17 2024 -0400 job control cleanups; wait -n can return terminated jobs if supplied pid arguments; wait -n