<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 26, 2017 at 7:51 AM, Eric Engestrom <span dir="ltr"><<a href="mailto:eric@engestrom.ch" target="_blank">eric@engestrom.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Friday, 2017-02-24 22:03:36 -0600, Aaron Watry wrote:<br>
> Using <<< for variable redirection is bash-specific behavior.<br>
> Ubuntu redirects sh -> dash, so this was erroring out.<br>
><br>
> Also, the initial error that led me to this was that srcdir is null when running make check<br>
> so I just copied something similar to what the optimization-test script does.<br>
> ---<br>
> src/glx/tests/dispatch-index-<wbr>check | 21 ++++++++++++++-------<br>
> 1 file changed, 14 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/src/glx/tests/dispatch-<wbr>index-check b/src/glx/tests/dispatch-<wbr>index-check<br>
> index 78464b8..ee1b9ee 100755<br>
> --- a/src/glx/tests/dispatch-<wbr>index-check<br>
> +++ b/src/glx/tests/dispatch-<wbr>index-check<br>
> @@ -1,24 +1,31 @@<br>
> #!/bin/sh<br>
><br>
> +if [ -z "$srcdir" ]; then<br>
> + scriptdir=`dirname "$0"`<br>
> +else<br>
> + scriptdir=$srcdir<br>
> +fi<br>
> +<br>
> +<br>
> # extract enum definition<br>
> dispatch_list=$(sed '/__GLXdispatchIndex/,/__<wbr>GLXdispatchIndex/!d' \<br>
> - "$srcdir"/../g_<wbr>glxglvnddispatchindices.h)<br>
> + "$scriptdir"/../g_<wbr>glxglvnddispatchindices.h)<br>
<br></div></div></blockquote><div></div><div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
</div></div>No need to create a new var that just copies the old one :)<br>
<span class=""><br></span></blockquote><div><br>Fair enough. I just didn't want this script to screw up anything in the future that sourced this script in by modifying externally declared variables that we knew about.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
><br>
> # extract values inside of enum<br>
> -dispatch_list=$(sed '1d;$d' <<< "$dispatch_list")<br>
> +dispatch_list=$(printf "$dispatch_list" | sed '1d;$d')<br>
<br>
</span>Never use a variable you have no control over as the format string for<br>
printf! Use `printf '%s' "$var"` instead.<br></blockquote><div><br></div><div>Yeah, that's my bad. I basically did a SO search for ways to de-bashify the '<<<' operator, and one of the first results used printf $var. In retrospect, your version is much more appropriate.<br><br></div><div>I'm generally a bash guy, so just declaring the scripts as actually being bash scripts works for me as well. Make check works again for me, and I agree with Vinson that it'd be nice to translate this to pure sh, but for now, this at least works.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I just pushed a1e5e55989 ("check: mark two tests are requiring bash")<br>
which fixes this by simply asking for bash in the shebang, which was<br>
what my original patch did, and was changed just before pushing because<br>
of a review comment that turned out to be wrong :)<br>
<br>
Cheers,<br>
Eric<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> # remove indentation<br>
> -dispatch_list=$(sed 's/^\s\+//' <<< "$dispatch_list")<br>
> +dispatch_list=$(printf "$dispatch_list" | sed 's/^\s\+//')<br>
><br>
> # extract function names<br>
> -dispatch_list=$(sed 's/DI_//;s/,//' <<< "$dispatch_list")<br>
> +dispatch_list=$(printf "$dispatch_list" | sed 's/DI_//;s/,//')<br>
><br>
> # same for commented functions, we want to keep them sorted too<br>
> -dispatch_list=$(sed 's#// ##;s/ implemented by [a-z]\+//' <<< "$dispatch_list")<br>
> +dispatch_list=$(printf "$dispatch_list" | sed 's#// ##;s/ implemented by [a-z]\+//')<br>
><br>
> # remove LAST_INDEX, as it will not be in alphabetical order<br>
> -dispatch_list=$(sed '/LAST_INDEX/d' <<< "$dispatch_list")<br>
> +dispatch_list=$(printf "$dispatch_list" | sed '/LAST_INDEX/d')<br>
><br>
> -sorted=$(LC_ALL=C sort <<< "$dispatch_list")<br>
> +sorted=$(LC_ALL=C printf "$dispatch_list" | sort)<br>
><br>
> test "$dispatch_list" = "$sorted"<br>
> --<br>
> 2.9.3<br>
><br>
</div></div></blockquote></div><br></div></div>