[darcs-users] darcs patch: tests/*: refactor remaining IFS calls to lib

Trent W. Buck trentbuck at gmail.com
Tue Dec 2 23:49:21 UTC 2008


"Gwern Branwen" <gwern0 at gmail.com> writes:

> On Mon, Dec 1, 2008 at 10:47 AM, Eric Kow  wrote:
>> Ah, I was just about to write you to report that tests are still passing
>> after your first patch.
>>
>> But are you sure this is a good idea, below, to effectively make /every/
>> test set IFS=''?
>>
>> The bash manpage says:
>>
>> IFS    The Internal Field Separator that is  used  for  word  splitting
>>       after  expansion  and  to  split  lines into words with the read
>>       builtin  command.   The  default  value  is  ''       line>''.
>>
>> I confess that I still don't fully understand the consquences of this.
>> One thing I'm worried about is breaking other non-IFS-y tests.  Another
>> deeper worry is that we start (unknowingly) writing tests that depend
>> on this behaviour.
>>
>> What do you think?
>
> (Sorry about the previous email, I pressed the wrong buttons.)
>
> Points:
> 1) Only lib callers are affected.
> 2) Should any of our scripts be calling read?

I don't see why not, but if IFS is there to affect read, perhaps it
would be better to use bashisms.  At the very least, I would expect

    while IFS='' read foo; do ...; done

to be better than the stateful

    oldIFS="$IFS"
    IFS=''
    while read foo; do ...; done
    IFS="$oldIFS"

> 3) Each test should be running in its own shell or subshell for
> maximum separation.

I thought that was being done already.



More information about the darcs-users mailing list