another bug with the alias bug style but for . source .. ?

2020-11-21 Thread Alex fxmbsw7 Ratchev
( same text as http://ix.io/2F0B ) im over this bug while i got errors from aliases, now tried . source but .. here another bug ? ++ BEGINFILE ../ii.x7yz.source-err i source there the init script then it runs, and for the first part it works, but on the second with aixz= .. non existing .. i

Re: Possible race condition in bash

2020-11-21 Thread Daniel Colascione
On 11/21/20 1:15 PM, Chet Ramey wrote: On 11/21/20 2:32 PM, Andreas Schwab wrote: On Nov 21 2020, Chet Ramey wrote: but since the shell always ignores SIGTERM, Even a non-interactive shell? No, you're right, it's SIGQUIT the shell always ignores. It catches SIGTERM if there is an EXIT trap

Re: Possible race condition in bash

2020-11-21 Thread Chet Ramey
On 11/21/20 2:32 PM, Andreas Schwab wrote: > On Nov 21 2020, Chet Ramey wrote: > >> but since the shell always ignores SIGTERM, > > Even a non-interactive shell? No, you're right, it's SIGQUIT the shell always ignores. It catches SIGTERM if there is an EXIT trap so it can run the trap on EXIT be

Re: Possible race condition in bash

2020-11-21 Thread Andreas Schwab
On Nov 21 2020, Chet Ramey wrote: > but since the shell always ignores SIGTERM, Even a non-interactive shell? > I'd also try it with one of the bash-5.1 testing releases, since I did > some reworking of how the shell handles SIGTERM back in April. 5.1-rc3 has the same issue. Andreas. -- Andr

Re: Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
On 21.11.20 г. 20:50 ч., Chet Ramey wrote: > On 11/21/20 1:35 PM, Nikolay Borisov wrote: > >> I can see setting of SIGTERM handler for both 2 subshells _after_ receiving >> the signal. What exactly should I be looking at? > > That's your race condition. > So the kernel initializes the signa

Re: Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
On 21.11.20 г. 20:50 ч., Chet Ramey wrote: > On 11/21/20 1:35 PM, Nikolay Borisov wrote: > >> I can see setting of SIGTERM handler for both 2 subshells _after_ receiving >> the signal. What exactly should I be looking at? > > That's your race condition. > But shouldn't the default environme

Re: Possible race condition in bash

2020-11-21 Thread Chet Ramey
On 11/21/20 1:35 PM, Nikolay Borisov wrote: > I can see setting of SIGTERM handler for both 2 subshells _after_ receiving > the signal. What exactly should I be looking at? That's your race condition. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa,

Re: Possible race condition in bash

2020-11-21 Thread Chet Ramey
On 11/21/20 1:25 PM, Andreas Schwab wrote: > On Nov 21 2020, Chet Ramey wrote: > >> This is a potential race condition, but it's not with the shell. > > The race with the trap command in the function is obvious, but that > should not result in the signal to be ignored. There should always be a >

Re: Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
On 21.11.20 г. 20:09 ч., Chet Ramey wrote: > On 11/21/20 3:06 AM, Nikolay Borisov wrote: > >> The output is: >> >> my pid 12186 >> 12186 subfun xxx 0 >> funpid=12186 twopid=12187 mypid=12185 >> killing 12186 12187 >> waiting on everything >> my pid 12187 >> 12187 subfun yyy 0 >> received term f

Re: Problems with command substitution and command alias

2020-11-21 Thread Chet Ramey
On 11/21/20 10:04 AM, Hyunho Cho wrote: > > ### 2. > > alias-expand-line readline function affects not only command line but also > heredoc contents Yes, that is how it works. The alias-expand-line function just takes what is in the current readline line buffer, identifies tokens that are in a c

Re: Possible race condition in bash

2020-11-21 Thread Andreas Schwab
On Nov 21 2020, Chet Ramey wrote: > This is a potential race condition, but it's not with the shell. The race with the trap command in the function is obvious, but that should not result in the signal to be ignored. There should always be a trap active, either the main one or the one in the func

Re: Possible race condition in bash

2020-11-21 Thread Chet Ramey
On 11/21/20 3:06 AM, Nikolay Borisov wrote: > The output is: > > my pid 12186 > 12186 subfun xxx 0 > funpid=12186 twopid=12187 mypid=12185 > killing 12186 12187 > waiting on everything > my pid 12187 > 12187 subfun yyy 0 > received term for xxx > 12187 subfun yyy 1 > 12187 subfun yyy 2 > 12187 su

Re: Problems with command substitution and command alias

2020-11-21 Thread Andreas Schwab
On Nov 22 2020, Hyunho Cho wrote: > if i run following command ( including "prompt$" ) > then "command not found" error occurred > but "$( mktemp -d -p /dev/shm )" command substitution executed completely The expansion is of course performed before the command is executed. Andreas. -- Andreas

Re: Problems with command substitution and command alias

2020-11-21 Thread Robert Elz
Date:Sun, 22 Nov 2020 00:04:21 +0900 From:Hyunho Cho Message-ID: | if command does not exist then the command stop with "command not found" | error but the command substitution executed completely Yes, the args to any command are evaluated (which includes expa

Problems with command substitution and command alias

2020-11-21 Thread Hyunho Cho
Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux EliteBook 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:2

Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
Hello, It's possible to have the following script never terminate: #!/bin/bash subfun() { trap "echo received term for $*;exit 1" SIGTERM echo my pid $BASHPID i=0 while true; do echo $BASHPID subfun $* $i i=$((i+1)) sleep 5 done } trap 'ec