On 02/07/15 08:08, Pádraig Brady wrote:
> 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.

Yes given we should also set SHELL in tests/split/filter.sh,
I'll apply the attached in your name later on.

thanks,
Pádraig.
>From 01e3df1db80610bcd7387d84ae6238ff2aefb2a5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 2 Jul 2015 12:42:50 +0100
Subject: [PATCH] tests: avoid false failure due to split --filter $SHELL

* tests/misc/factor-parallel.sh: Some have their $SHELL configured to
reset $PATH on every invocation, so set SHELL='/bin/sh' to avoid that.
* tests/split/filter.sh: Likewise.
---
 tests/misc/factor-parallel.sh | 3 +++
 tests/split/filter.sh         | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/tests/misc/factor-parallel.sh b/tests/misc/factor-parallel.sh
index 8cec630..8a4332b 100755
--- a/tests/misc/factor-parallel.sh
+++ b/tests/misc/factor-parallel.sh
@@ -19,6 +19,9 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ factor
 
+# Use a more standard $SHELL for tests,
+# in case the current $SHELL resets $PATH etc.
+test -x /bin/sh && export SHELL='/bin/sh'
 
 odd() { LC_ALL=C sed '/[24680]$/d'; }
 primes() { LC_ALL=C sed 's/.*: //; / /d'; }
diff --git a/tests/split/filter.sh b/tests/split/filter.sh
index 55610e4..9e4e89f 100755
--- a/tests/split/filter.sh
+++ b/tests/split/filter.sh
@@ -20,6 +20,10 @@
 print_ver_ split
 xz --version || skip_ "xz (better than gzip/bzip2) required"
 
+# Use a more standard $SHELL for tests,
+# in case the current $SHELL resets $PATH etc.
+test -x /bin/sh && export SHELL='/bin/sh'
+
 for total_n_lines in 5 3000 20000; do
   seq $total_n_lines > in || framework_failure_
   for i in 2 51 598; do
-- 
2.4.1

Reply via email to