[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: non portable sed scripts

From: Ralf Wildenhues
Subject: Re: non portable sed scripts
Date: Fri, 19 May 2006 22:24:59 +0200
User-agent: Mutt/1.5.11+cvs20060403

* Ralf Wildenhues wrote on Fri, May 19, 2006 at 08:42:46PM CEST:
> > 
> > I'm pretty sure the syntax of the sed script is ok.  It's probably that
> > your sed has a length restriction.

Well, Autoconf-2.59 has been using 38 lines per here document:
| # Maximum number of lines to put in a shell here document.
| # This variable seems obsolete.  It should probably be removed, and
| # only ac_max_sed_lines should be used.
| : ${ac_max_here_lines=38}

|   sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS

2.59c uses 99 commands now (for CONFIG_HEADERS substitutions).

Neither have been computing the number of characters in the sed script.
So, probably 2.59 has just been lucky to produce short enough scripts.

FWIW, we may easily generate too long scripts for CONFIG_FILES as well
now: the 2.59 method did 48 substitutions per script (because it used
two commands per substitution), now we do 96.  I've see a couple of
real-world examples with more than 4000 bytes with 2.59c.

FWIW, on Solaris, /usr/ucb/sed errors out with scripts longer than 6810
characters, /usr/xpg4/bin/sed segfaults at some point (don't remember
the exact number), /bin/sed allows much longer scripts.  My testing on
Solaris always had /bin early in $PATH, thus did not expose this issue.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]