Re: nofork command substitution

2023-05-22 Thread Martijn Dekker
Op 22-05-2023 om 16:18 schreef Chet Ramey: I'd call that a bug. It's not how mksh documents this type of command substitution to work. ksh93 documents the parsing the same way. So it does, yet ksh93 also accepts omitting the ;. The only documentation of this is in the legacy changelog: 08-03

Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-22 Thread Chet Ramey
On 5/21/23 5:01 PM, Martin D Kealey wrote: 1. ${array[@]:start:count} can under some circumstances return elements with indeces >= start+count, completely contravening expectations from other programming languages. There should be a `declare` or `local` option to fix that, and/or a shopt setting

Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-22 Thread Chet Ramey
On 5/20/23 8:00 PM, Emanuele Torre wrote: This was already reported 12 and a half years ago, but there have not been many replies: https://lists.gnu.org/archive/html/bug-bash/2010-12/msg00128.html It seems more natural, especially in the presence of sparse arrays, to allow references to uns

Re: nofork command substitution

2023-05-22 Thread Chet Ramey
On 5/19/23 2:42 PM, Robert Elz wrote: Date:Fri, 19 May 2023 12:03:51 -0400 From:Chet Ramey Message-ID: <0a85095a-1665-d936-b4fa-118dd158e...@case.edu> | Maybe, and certainly possible, but a more likely use is just a simple | assignment to REPLY. In such c

Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-22 Thread Oğuz
22 Mayıs 2023 Pazartesi tarihinde Martin D Kealey yazdı: > I disagree: this would constitute a major change, breaking behaviour that > is (for good reasons) depended on. > How so? I wouldn't expect expanding `a[1]' to not fail when `a[1]' is unset and `set -u' is in effect, and can't see why any

"environment:" instead of $0 in front of fatal errors from functions

2023-05-22 Thread Emanuele Torre
Error messages for fatal error e.g. ${x?foo} or rovar=foo or $x expanded with nounset, report an error message prefixed by the string "environment:" instead of "scriptname:" (or "$0:"). $ bash -c '${x?hi}' asd asd: line 1: x: hi $ bash -c 'a () { ${x?hi} ;}; a' asd environment: lin

Re: `wait -n` returns 127 when it shouldn't

2023-05-22 Thread Robert Elz
Date:Mon, 22 May 2023 02:43:18 -0300 From:Aleksey Covacevice Message-ID: | I fail to see where the race condition in `true & wait -n` is. It wasn't in the script - but in the implementation inside bash. Chet has (apparently, I don't look at bash sources, and onl

Re: setarray[unsetkey] doesn't trigger nounset in arithmetic context

2023-05-22 Thread Martin D Kealey
On Mon, 22 May 2023, 12:59 Emanuele Torre, wrote: > I am not really proposing a major change to the behaviour of nounset, I > am only pointing out the incorrect bash behaviour for that case. I disagree: this would constitute a major change, breaking behaviour that is (for good reasons) depended

Re: `wait -n` returns 127 when it shouldn't

2023-05-22 Thread alex xmb ratchev
On Mon, May 22, 2023, 07:43 Aleksey Covacevice wrote: > On Thu, May 18, 2023 at 3:07 PM Chet Ramey wrote: > > > > On 5/18/23 7:51 AM, Robert Elz wrote: > > > > > Apparently, in bash, if the code is running in a (shell) loop (like > inside > > > a while, or similar, loop) then each iteration arou