coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: factor-parallel test failure with SHELL=zsh


From: Pádraig Brady
Subject: Re: factor-parallel test failure with SHELL=zsh
Date: Thu, 02 Jul 2015 08:08:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 02/07/15 06:19, Jim Meyering wrote:
> I was surprised to see that the factor-parallel test was failing.
> However, when I installed the very latest binaries early in my
> path, it would succeed once again.
> 
> Turns out that when SHELL=zsh is in my environment,
> the split-run "$SHELL -c factor" command was using an
> PATH environment that did not have the usual .../src/: prefix,
> so it would use whatever other version of factor it could
> find in that PATH value.  In my case, it would use factor
> from 8.23, which lacks recent patches and makes the test
> fail. To show that, I ran a little experiment:
> 
> With zsh, it prints nothing for me:
> 
>   $ PATH=bogus:$PATH zsh -c 'echo $PATH'|grep bogus
>   $
> 
> with bash or sh, it works as expected and prints the prefixed
> value of $PATH.
> 
> This appears to be due to the fact that I set zsh's path via
> my ~/.zshenv file, and that file is sourced unconditionally.
> Perhaps what I am doing is best avoided? I've been doing
> it for many years, so far without such a problem.
> I'll send this now and investigate more later.

Seems you're not alone as I had another user
report 'factor not found' on BSD.

Personally I only set $PATH for login shells (.bash_profile).

This could be a general problem with `split --filter`
using `$SHELL -c`, with potential side effects
like ignoring the current $PATH etc. ?

> For me, an obvious work-around is to set SHELL=/bin/sh
> or similar.

Yes or to avoid the slight chance of /bin/sh also resetting the path
you could directly reference the binary as follows.
I slightly prefer setting the SHELL though.

diff --git a/tests/misc/factor-parallel.sh b/tests/misc/factor-parallel.sh
index 8cec630..b9c9ced 100755
--- a/tests/misc/factor-parallel.sh
+++ b/tests/misc/factor-parallel.sh
@@ -27,7 +27,8 @@ primes() { LC_ALL=C sed 's/.*: //; / /d'; }
 # Note -u not supplied to split, increased batching of quickly processed items.
 # As processing cost increases it becomes advantageous to use -u to keep
 # the factor processes supplied with data.
-nprimes=$(seq 1e6 | odd | split -nr/4 --filter='factor' | primes | wc -l)
+nprimes=$(seq 1e6 | odd | split -nr/4 \
+          --filter="'$abs_top_builddir/src/factor$EXEEXT'" | primes | wc -l)

 test "$nprimes" = '78498' || fail=1

thanks,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]