[Top][All Lists]

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

Re: cwrapper generates long strings.

From: Peter Rosin
Subject: Re: cwrapper generates long strings.
Date: Fri, 01 Oct 2010 23:22:54 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20100915 Thunderbird/3.1.4

Hi Chuck,

Den 2010-10-01 16:03 skrev Charles Wilson:
> On 10/1/2010 7:28 AM, Peter Rosin wrote:
>> I.e. I have this on line 865 in lt-main.c:
>>   fputs ("relink_command=\"(cd 
>> /c/cygwin/home/peda/libtool/git/msvc/tests/testsuite.dir/112; 
>> PATH=\\\"/LOADS:/OF:/ENTRIES\\\"; export PATH; 
>> PATH=\\\"/LOADS:/OF:/ENTRIES\\\"; export PATH; 
>> /c/cygwin/home/peda/automake/lib/compile cl -MD -Zi -EHsc -o @OUTPUT@ 
>> .libs/main-static.obj  sub2/.libs/a.lib )\"\n", f);
>> In my case the string is 3400+ characters which is too much for MSVC 6,
>> but this appears to not be really compiler specific, and I can easily
>> imagine other compilers with other arbitrary (and possibly standardized)
>> limits.
> c99 compilers must support const char* arrays of at least 4096.  Most
> compilers actually support much larger ones.
> c89 requires only support for up to 509.  See:
> http://lists.gnu.org/archive/html/libtool-patches/2008-04/msg00161.html
> http://lists.gnu.org/archive/html/libtool-patches/2009-01/msg00004.html

I vaguely remember that, and rereading reveals that noone thought about
one individual line being too long (not publicly anyway).

>> One thing that could be done is to only have the PATH once, but that is
>> not a real fix.
> It's also not general.  One is explicitly setting PATH, the other is
> setting $shlibpath_var (which happens to be PATH on win32).
>> Should we worry about my insane case?
> I don't think it is a high priority.  What we could do is implement a
> "line emitter" in ltmain.m4sh, for use by func_emit_cwrapper_exe.  Right
> now, it takes the output of func_emit_wrapper and puts "fputs(\"" and
> "\n\"" around each line.
> Instead, each line could be fed to a line-emitter function that chops
> the line into segments of <= 500 chars.
> But...that's a lot of effort for very little gain.

Ok, I wouldn't say a lot of effort, and it was a bit of fun.

> I think a better approach would be to start asking, why do we still need
> the cwrapper to contain and emit the shell wrapper code in the first
> place?  Maybe instead, we should just remove --lt-dump-script and all
> related code.
> It was originally present because the cwrapper would emit the shwrapper,
> and then exec it.  But now, the cwrapper exec's the real program
> directly, so this functionality is no longer needed.  It hasn't been
> needed for years, but I didn't want to make too many changes at once so
> I left it there even after cwrapper was changed to direct exec the real
> program.  But...I always intended to get rid of it.  Perhaps now is the
> time.

Right, but I had already sent the first version of the line splitter when
I read this.  Here's an improved version as a proper git patch (why is it
so hard to keep your fingers away from small scriptlets?).  Now, someone
needs to decide which way to go, and provide a --lt-dump-script removal
patch if that is decided.

Hardish testing outside libtool, and limited testing with the actual
patch, but at least stresstest.at is happy with my looong PATH from the
original post, and the lt-main.c code looks good too.


>From 9c30540472d66c0caf56bdc90a7bf7152ad771d4 Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Fri, 1 Oct 2010 22:55:55 +0200
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.

Signed-off-by: Peter Rosin <address@hidden>
 ChangeLog                  |    7 +++++++
 libltdl/config/ltmain.m4sh |   11 ++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a7aa489..515c23a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-01  Peter Rosin  <address@hidden>
+       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.
 2010-09-27  Peter Rosin  <address@hidden>
        tests: check if sys_lib_search_path_spec works on MSVC.
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 0418007..6eb13f0 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -4268,9 +4268,14 @@ void lt_dump_script (FILE* f)
            func_emit_wrapper yes |
-              $SED -e 's/\([\\"]\)/\\\1/g' \
-                  -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
+             $SED -n -e '
+s/\([^\n]*\).*/  fputs ("\1", f);/p
             cat <<"EOF"

reply via email to

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