Hi,

I think the following gives a clue:

        % cmp f f2
        f f2 differ: char 8193

The following snippet from the Xbackq code seems to be the culprit:

        char wd[8193];
        int c;
        char *s, *ewd=&wd[8192], *stop;

        ...

                while((c = rchr(f))!=EOF){
                        if(strchr(stop, c) || s==ewd){
                                if(s!=wd){
                                        *s='\0';
                                        v = newword(wd, v);
                                        s = wd;
                                }
                        }
                        else *s++=c;
                }

Keeping the loop from dropping characters is trivial.  Getting rid of
the inserted space probably requires a dynamic buffer.  I might give
it a shot.

Regards,
        Martin

* Uriel (urie...@gmail.com) wrote:
> At first I thought very big rc variables seem to become strangely corrupted.
> 
> % for(i in `{seq 1000}) { echo 0123456789 >> f }
> % ifs='' {x=`{cat f}}
> % echo -n $x > f2
> % diff f f2
> 745c745
> < 0123456789
> ---
> > 01234567 9
> 
> But the bug seems to be in `{ } because replacing the use of the x var
> with simply:
> 
> % ifs='' { echo -n `{cat f} > f2}
> 
> Produces the same results.
> 
> Longer strings get more random(?) characters 'blanked'.
> 
> The results are identical in p9p and native plan9.
> 
> I looked a bit around the rc source that seemed relevant, but didn't
> see any obvious errors, but I don't fully understand the code.
> 
> Peace
> 
> uriel

Reply via email to