Den 2010-10-02 08:32 skrev Ralf Wildenhues: > Hi Peter, > > * Peter Rosin wrote on Fri, Oct 01, 2010 at 11:22:54PM CEST: >> Subject: [PATCH] cwrapper: split long lines when dumping the wrapper script. >> >> * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src): If >> the wrapper script contains long lines, split them for >> readability and to conform with C standards. > > OK with me with nits addressed. I see this as a fairly straightforward > way to work around the issue; we can still think about following Chuck's > proposal in due course even with this in place. > > Nit 1: testsuite exposure. Should be fairly straightforward to set > PATH=$PATH$PATH_SEPARATOR$PATH > > a couple of times until long enough (but not too long so that > environment plus command line length already go over the limit), then > build a library and a program linked against it, covering the path that > failed for you, no?
Should do it, but I can't fix that this weekend. I guess I'll get to it sometime next week. >> --- a/libltdl/config/ltmain.m4sh >> +++ b/libltdl/config/ltmain.m4sh >> @@ -4268,9 +4268,14 @@ void lt_dump_script (FILE* f) >> { >> EOF >> func_emit_wrapper yes | >> - $SED -e 's/\([\\"]\)/\\\1/g' \ >> - -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' >> - >> + $SED -n -e ' >> +s/^\(.\{79\}\)\(..*\)/\1\n\2/ > > \n is portable only in the regex part, but not in the replacement part. > For that you need backslash then literal newline. Ok, so replacing with s/^\(.\{79\}\)\(..*\)/\1\ \2/ is portable? Easy enough, I'll fold it in with nit 1 and repost before I push (if someone beats me to it and writes the test, feel free to snarf the sed program and push if you do). >> +h >> +s/\([\\"]\)/\\\1/g >> +s/$/\\n/ >> +s/\([^\n]*\).*/ fputs ("\1", f);/p > > Why not above, right after h, do s/\n.*// and then simplify this s > command? > >> +g >> +D' Because then we no longer know if the C-string "\n" at the end of the line (added by the 's/$/\\n/' statement) should be inserted or not. The trick is to add it and then cut it out if the string was too long (contains a literal newline from the s command). We can only have the "\n" for the final chunk, otherwise the output will be riddled with too many newlines. Cheers, Peter