Support cross-testing (version 3)
Joseph S. Myers
joseph@codesourcery.com
Fri Nov 2 18:09:00 GMT 2012
On Fri, 2 Nov 2012, Andreas Schwab wrote:
> "Joseph S. Myers" <joseph@codesourcery.com> writes:
>
> > +# Remove unnecessary newlines from a Bourne shell command sequence.
> > +remove_newlines ()
> > +{
> > + sed -n \
> > + -e '1h' \
> > + -e '2,$H' \
> > + -e '${g
> > + s/\([^\]\)\n/\1; /g
> > + p
> > + }'
> > +}
>
> That doesn't work with embedded newlines.
As I just said, I'd be happy for it to be removed. Fortunately nothing is
relying on environment variables with newlines being passed through this
way, and as I've also said I think we should aim for not needing this
environment variable passthrough by getting everywhere relying on
environment variables set in makefiles, at top of scripts etc. being
applicable on the host to pass them explicitly via test-wrapper-env - but
that cleanup may be a longer-term goal (it requires checking a lot of code
that might set environment variables and working out where their values
are needed).
I'm not sure what "The 'export -p' command adds backslashes for
environment variables which contain newlines." was originally referring to
- maybe some way in which the output of older versions of bash differed
from what bash now does. (This optimization originated in
<http://www.eglibc.org/archives/patches/msg00318.html> in 2007.)
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list