[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep-2.9.69-f91c on OSF/1
From: |
Jim Meyering |
Subject: |
Re: grep-2.9.69-f91c on OSF/1 |
Date: |
Sat, 12 Nov 2011 17:49:29 +0100 |
Stefano Lattarini wrote:
> On Saturday 12 November 2011, Jim Meyering wrote:
>> Stefano Lattarini wrote:
>> > This might cause annoying slow-downs on systems where forks are more
>> > expensive (i.e., MinGW and Cygwin). What about doing something like
>> > this instead, so that the extra forks are avoided when the shell is
>> > Bash (as is the usual case under MinGW and Cygwin, if I'm not
>> > mistaken):
>> >
>> > if test -n "$BASH_VERSION"; then
>> > export_with_values () { export "$@"; }
>> > else
>> > export_with_values () { ... your implementation here ... }
>> > fi
>> >
>> > My testing shows that this idiom should work with at least bash 4.1,
>> > 3.2, 3.0, 2.05 and 2.0.
>>
>> I like the idea but prefer to test for the precise feature being replaced.
>> Then we don't even penalize those who use dash or zsh.
>>
> Or you could do this, to shave off the extra fork on MinGW and Cygwin:
>
>> It is tricky, due to the brokenness of Solaris' /bin/sh, but as we
>> learned via init.sh, you have to eval the test in a sub-shell:
>>
>> if (eval "export v=x") 2>/dev/null; then
>> export_with_values () { export "$@"; }
>> else
>> export_with_values () { ... Bruno's implementation here ... }
>> fi
>>
> Or you could do this, to shave off the extra fork on MinGW and Cygwin:
>
> if test -n "$BASH_VERSION" || (eval "export v=x") 2>/dev/null; then
> export_with_values () { export "$@"; }
> else
> export_with_values () { ... Bruno's implementation here ... }
Hi Stefano,
Thanks for the suggestion.
I was leaning towards accepting it, but then checked...
When /bin/sh is a link to bash, that envvar is not set here (F16):
$ env -i sh -c env
PWD=/h/j/w/co/grep
SHLVL=1
_=/bin/env
$ ls -og /bin/sh
lrwxrwxrwx. 1 4 Sep 29 04:19 /bin/sh -> bash
Is it set for MinGW or Cygwin?
Or is this expected to take effect solely when make is invoked
with SHELL=/bin/bash or similar?
- Re: grep-2.9.69-f91c on OSF/1, (continued)
- Re: grep-2.9.69-f91c on OSF/1, Jim Meyering, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Jim Meyering, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Bruno Haible, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Stefano Lattarini, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Bruno Haible, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Stefano Lattarini, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Jim Meyering, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Stefano Lattarini, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1,
Jim Meyering <=
- Re: grep-2.9.69-f91c on OSF/1, Stefano Lattarini, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Jim Meyering, 2011/11/12
- Re: grep-2.9.69-f91c on OSF/1, Jim Meyering, 2011/11/12
grep-2.9.69-f91c testing, Bruno Haible, 2011/11/11
Re: grep-2.10 testing (was: grep-2.9.69-f91c testing), Bruno Haible, 2011/11/20