Re: [PATCH] t0300-credentials: Word around a solaris /bin/sh bug
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Feb 2, 2012, 20:16 UTC
- Message-ID
- <20120202201629.GA20200@burratino>
- In-Reply-To
- <1328211135-25217-1-git-send-email-bwalton@artsci.utoronto.ca>
Ben Walton wrote:
Show 12 quoted lines
> --- a/t/t0300-credentials.sh > +++ b/t/t0300-credentials.sh > @@ -8,10 +8,12 @@ test_expect_success 'setup helper scripts' ' > cat >dump <<-\EOF && > whoami=`echo $0 | sed s/.*git-credential-//` > echo >&2 "$whoami: $*" > + OIFS=$IFS > while IFS== read key value; do > echo >&2 "$whoami: $key=$value" > eval "$key=$value" > done > + IFS=$OIFS
Oh, good catch. Technically "read" is not a special builtin so POSIX shells are not supposed to do this (and Jeff's patch definitely looks right), but in any case temporary variable settings while running a builtin are close enough to the assignment-during-special-builtin-or-function case to make me shiver a little. ;-)
Would something like
( IFS== while read key value do ... done )
make sense?