Re: process substitution fd lifetime race condition

2020-04-21 Thread Chet Ramey
On 4/21/20 12:29 AM, Jason A. Donenfeld wrote: > Were you planning on committing this to Savannah? Yes, this will most likely end up as patch 17, unless a higher-priority thing comes up first. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevi

Re: process substitution fd lifetime race condition

2020-04-20 Thread Jason A. Donenfeld
Were you planning on committing this to Savannah?

Re: process substitution fd lifetime race condition

2020-04-20 Thread Chet Ramey
On 4/20/20 6:02 PM, Jason A. Donenfeld wrote: > It seems like process substitution fifo lifetime is really tricky. You > can't really reference track, since the path is just a string that > could be manipulated. So how do you know when it's safe to clean up > that fd and that nobody is using it?

Re: process substitution fd lifetime race condition

2020-04-20 Thread Jason A. Donenfeld
On Mon, Apr 20, 2020 at 3:58 PM Chet Ramey wrote: > OK, good. It was either that or closing the fd after reaping the child > process -- I couldn't tell 100% from the system call trace. The latter is an interesting possibility. I assume SIGCHLD comes in through a signal handler, so it's asynchrono

Re: process substitution fd lifetime race condition

2020-04-20 Thread Chet Ramey
On 4/20/20 5:56 PM, Jason A. Donenfeld wrote: > On Mon, Apr 20, 2020 at 3:49 PM Chet Ramey wrote: >> >> On 4/20/20 5:01 PM, Jason A. Donenfeld wrote: >>> On 4/20/20, Chet Ramey wrote: On 4/20/20 1:15 AM, Jason A. Donenfeld wrote: > Hi, > > I've uncovered a very unusual race condi

Re: process substitution fd lifetime race condition

2020-04-20 Thread Jason A. Donenfeld
On Mon, Apr 20, 2020 at 3:49 PM Chet Ramey wrote: > > On 4/20/20 5:01 PM, Jason A. Donenfeld wrote: > > On 4/20/20, Chet Ramey wrote: > >> On 4/20/20 1:15 AM, Jason A. Donenfeld wrote: > >>> Hi, > >>> > >>> I've uncovered a very unusual race condition when using process > >>> substitution and dev

Re: process substitution fd lifetime race condition

2020-04-20 Thread Chet Ramey
On 4/20/20 5:01 PM, Jason A. Donenfeld wrote: > On 4/20/20, Chet Ramey wrote: >> On 4/20/20 1:15 AM, Jason A. Donenfeld wrote: >>> Hi, >>> >>> I've uncovered a very unusual race condition when using process >>> substitution and developed as minimal a reproducer as I could create: >> >> What versio

Re: process substitution fd lifetime race condition

2020-04-20 Thread Jason A. Donenfeld
This one will reproduce immediately: #!/bin/bash set -e a="my name is a" b="my name is b" sleep() { read -t "$1" -N 1 || true; } doit() { sleep 0.1; "$@"; } while true; do doit cat <(echo "$a") <(echo "$b") done

Re: process substitution fd lifetime race condition

2020-04-20 Thread Jason A. Donenfeld
Here's a simpler reproducer: set -e a="my name is a" b="my name is b" pretty() { echo -e "\x1b[0m"; } doit() { pretty; "$@"; } while true; do doit cat <(echo "$a") <(echo "$b") done

Re: process substitution fd lifetime race condition

2020-04-20 Thread Jason A. Donenfeld
On 4/20/20, Chet Ramey wrote: > On 4/20/20 1:15 AM, Jason A. Donenfeld wrote: >> Hi, >> >> I've uncovered a very unusual race condition when using process >> substitution and developed as minimal a reproducer as I could create: > > What version of bash are you using? > 5.0.016

Re: process substitution fd lifetime race condition

2020-04-20 Thread Chet Ramey
On 4/20/20 1:15 AM, Jason A. Donenfeld wrote: > Hi, > > I've uncovered a very unusual race condition when using process > substitution and developed as minimal a reproducer as I could create: What version of bash are you using? Chet -- ``The lyf so short, the craft so long to lerne.'' - Chauce

process substitution fd lifetime race condition

2020-04-19 Thread Jason A. Donenfeld
Hi, I've uncovered a very unusual race condition when using process substitution and developed as minimal a reproducer as I could create: set -e private="$(wg genkey)" public="$(wg genkey | wg pubkey)" preshared="$(wg genpsk)" ip link del wg0 type wireguard || true ip link add wg0 type wireguard