On Tue, Aug 23, 2011 at 06:04:39AM -0400, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date:         Tue Aug 23 10:04:39 UTC 2011
> Modified Files:
>       src/bin/sh: expand.c
> Log Message:
> PR/45269: Andreas Gustafsson: Instead of falling off the edge when eating 
> trailing newlines
> if the block has moved, arrange so that trailing newlines are never placed in 
> the string
> in the first place, by accumulating them and adding them only after we've 
> encountered a
> non-newline character. This allows also for more efficient appending since we 
> know how much
> we need beforehand. From FreeBSD.

I'm not sure the old netbsd code is wrong - after the fix in rev 1.68
(netbsd 3 timescales).
All the values used when stripping the newlines should be valid.
Maybe there is something iffy with the sequence points in some of
the earlier code - or gcc is just getting them wrong.
The string buffer being extended shouldn't make a difference - even
if it isn't the last fragment of the heap list.

I've done a test with rev 1.84 and got the string extended while adding the
output from $(...) and it was ok - but I'm using a much older gcc.

I think it might be worth looking as the asm output from gcc for
a compilation that is known to get it wrong.


David Laight: da...@l8s.co.uk

Reply via email to