Re: Sourcing a script from a pipe is not reliable

2019-01-11 Thread Jeremy
x86_64-Apple-Darwin >> >> >> Bash Version: 3.2 >> >> Patch Level: 48 >> >> Release Status: relase >> >> >> Although bashbug listed the Patch Level as 48 (and misspelled "release") >> the version string is >> >&

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Jeremy
I appreciate the help, Martijn, and I suspect I will find your suggestions useful in the future, but they do not completely work for us in the present instance. We are, in part, trying to determine if our script may have lost its positional parameters because it was invoked by someone else using ".

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Chet Ramey
On 1/10/19 4:52 PM, Jeremy wrote: > Have you considered reading stdin into a string (if it's one line) or an > array (if it's more) and using `eval' on it? That obviously works better > if it's one line, but could be made to work on multiple lines. > > > We are trying to determine if

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Martijn Dekker
Op 10-01-19 om 22:52 schreef Jeremy: > We are trying to determine if the current shell supports passing positional > arguments to a script sourced by dot (.), and we are trying to do it in a > way that will work under pretty much any shell. If you can show me how to > do that with eval, then that

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Jeremy
> Bash Version: 3.2 > > Patch Level: 48 > > Release Status: relase > > > Although bashbug listed the Patch Level as 48 (and misspelled "release") > the version string is > > 3.2.57(1)-release (x86_64-apple-darwin15) > > > This is on MacOS 10.11.6.

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Robert Elz
Date:Thu, 10 Jan 2019 13:52:59 -0800 From:Jeremy Message-ID: ps: (intended to add this in the previous reply and forgot...) | even though in general I hate | to ship a script that uses eval. Why?eval is a prefectly proper and useful part of the shell, and

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Robert Elz
Date:Thu, 10 Jan 2019 13:52:59 -0800 From:Jeremy Message-ID: | We are trying to determine if the current shell supports passing positional | arguments to a script sourced by dot (.), and we are trying to do it in a | way that will work under pretty much any sh

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Jeremy
On Thu, Jan 10, 2019 at 11:59 AM Chet Ramey wrote: > On 1/10/19 2:52 PM, Jeremy wrote: > >> This command line should run forever: > > >> i=0; while [ "_$(echo echo '$1' | . /dev/stdin yes)" = "_yes" ]; \ > > do echo -n .; ((i++)); done; printf "\n%s\n" $i > > >> When I run it, it usually term

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Chet Ramey
On 1/10/19 2:52 PM, Jeremy wrote: > This bug seems not to be in current versions of bash 4.x, but I have not > made an exhaustive study. The thing is I do not have control over which > versions of bash people use to run the script, so I need a workaround. I > was hoping this was a known bug with a

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Jeremy
On Thu, Jan 10, 2019 at 11:38 AM Chet Ramey wrote: > On 1/10/19 2:36 PM, Jeremy wrote: > > Agreed there is no likelihood of a patch to 3.2. However, this version of > > bash still has a significant presence in the wild and this bug is > breaking > > an installation script, so I am looking for a P

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Greg Wooledge
On Thu, Jan 10, 2019 at 11:36:03AM -0800, Jeremy wrote: > Agreed there is no likelihood of a patch to 3.2. However, this version of > bash still has a significant presence in the wild and this bug is breaking > an installation script, so I am looking for a POSIX-compliant (and works > under Cygwin)

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Chet Ramey
On 1/10/19 2:36 PM, Jeremy wrote: > Agreed there is no likelihood of a patch to 3.2. However, this version of > bash still has a significant presence in the wild and this bug is breaking > an installation script, so I am looking for a POSIX-compliant (and works > under Cygwin) alternative that avoi

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Jeremy
Agreed there is no likelihood of a patch to 3.2. However, this version of bash still has a significant presence in the wild and this bug is breaking an installation script, so I am looking for a POSIX-compliant (and works under Cygwin) alternative that avoids this bug so the script can be modified.

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread Greg Wooledge
On Thu, Jan 10, 2019 at 12:01:10AM -0800, don fong wrote: > but on my mac, adding the sleep makes it fail reliably on the first > iteration. > > on my linux machine, it seems to succeed reliably even with the sleep - as > expected. That's because the version of bash on Mac OS X is 3.2. Bash 3.2

Re: Sourcing a script from a pipe is not reliable

2019-01-10 Thread don fong
e: x86_64-Apple-Darwin > > > Bash Version: 3.2 > > Patch Level: 48 > > Release Status: relase > > > Although bashbug listed the Patch Level as 48 (and misspelled "release") > the version string is > > 3.2.57(1)-release (x86_64-apple-darwin15) > > > T

Re: Sourcing a script from a pipe is not reliable

2019-01-09 Thread Eduardo Bustamante
On Wed, Jan 9, 2019 at 10:54 PM Jeremy wrote: (...) > 3.2.57(1)-release (x86_64-apple-darwin15) > > > This is on MacOS 10.11.6. If there is a better place for me to report this > bug, please let me know. Have you tried the latest version? Bash 5.0 was just released: https://lists.gnu.org/archive/

Sourcing a script from a pipe is not reliable

2019-01-09 Thread Jeremy
eport this bug, please let me know. Description: Sourcing a script from a pipe is not reliable. Repeat-By: This command line should run forever: i=0; while [ "_$(echo echo '$1' | . /dev/stdin yes)" = "_yes" ]; \ do echo -n .; ((i++)); done; printf "\n%s

Sourcing a script from a pipe is not reliable

2019-01-09 Thread Jeremy
: x86_64-Apple-Darwin Bash Version: 3.2 Patch Level: 48 Release Status: relase Description: Sourcing a script from a pipe is not reliable. Repeat-By: This command line should run forever: i=0; while [ "_$(echo echo '$1' | . /dev/stdin yes)" = "_yes" ]; \