[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sourcing a script from a pipe is not reliable
From: |
Jeremy |
Subject: |
Re: Sourcing a script from a pipe is not reliable |
Date: |
Thu, 10 Jan 2019 15:28:02 -0800 |
A more reliable way to demonstrate the bug:
cat <(echo echo '$1' 2) | . /dev/stdin yes
Should output "yes 2", and does in bash 4.4.23, but in
bash 3.2.57(1)-release it outputs nothing: the output of cat does not get
sourced.
Reminder, I'm seeking a workaround rather than a patch, to reliably test if
the current shell supports passing positional parameters to a sourced
script, without creating a temporary file.
On Wed, Jan 9, 2019 at 8:11 PM Jeremy <asfbugzilla@nuru.net> wrote:
> Configuration Information [Automatically generated, do not change]:
>
> Machine: Mac
>
> OS: Darwin
>
> Compiler: gcc
>
> Compilation CFLAGS: Xcode
>
> uname output: Darwin Octo.local 15.6.0 Darwin Kernel Version 15.6.0: Thu
> Jun 21\
>
> 20:07:40 PDT 2018; root:xnu-3248.73.11~1/RELEASE_X86_64 x86_64
>
> Machine Type: 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)
>
>
> This is on MacOS 10.11.6. If there is a better place for me to report 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\n" $i
>
>
> When I run it, it usually terminates with $i much less than 1,000.
>
Re: Sourcing a script from a pipe is not reliable, don fong, 2019/01/10
Re: Sourcing a script from a pipe is not reliable,
Jeremy <=