libtool-patches
[Top][All Lists]
Advanced

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

Re: Improving maximum command line length detection (Was: Re: [PATCH] Re


From: Gary V. Vaughan
Subject: Re: Improving maximum command line length detection (Was: Re: [PATCH] Removal of obsolete AmigaOS support)
Date: Wed, 08 Oct 2003 19:00:02 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 Thunderbird/0.3

I seem to recall working on a SCO 433MP box running an old Ultrix which had a 1k line limit with /bin/sh. That is only 2 loop iterations less, and might save us grief later.

Peter O'Gorman wrote:
+    # Make testring a little bigger before we do anything with it.
+    # a 4K string should be a reasonable start.
+    for p in 3 4 5 6 7 8 9 10 11 12 ; do

Why not use `i' here...

+      testring=$testring$testring
+    done
     # If test is not a shell built-in, we'll probably end up computing a
     # maximum length that is only half of the actual maximum length, but
     # we can't tell.
-    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 
2>/dev/null` \
-              = "XX$testring") >/dev/null 2>&1 &&
-           new_result=`expr "X$testring" : ".*" 2>&1` &&
-           lt_cv_sys_max_cmd_len=$new_result &&
-           test $i != 17 # 1/2 MB should be enough
+    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring$testring" 
2>/dev/null` \
+              = "XX$testring$testring") >/dev/null 2>&1 &&
+           test $i != 6 # 1/2 MB should be enough

And revert to $i != 17 here, for readability?

     do
       i=`expr $i + 1`
       testring=$testring$testring
     done
+    # Only check the string length outside the loop.
+    new_result=`expr "X$testring" : ".*" 2>&1`
+    lt_cv_sys_max_cmd_len=$new_result
     testring=
     # Add a significant safety factor because C++ compilers can tack on massive
     # amounts of additional arguments before passing them to the linker.

Haven't tested it, but looks good to me. If no-one reports a problem in the next couple of days, feel free to commit.

Don't forget a NEWS entry :-)

Cheers,
        Gary.
--
  ())_.  Gary V. Vaughan    gary@(lilith.warpmail.net|gnu.org)
  ( '/   Research Scientist http://www.oranda.demon.co.uk       ,_())____
  / )=   GNU Hacker         http://www.gnu.org/software/libtool  \'      `&
`(_~)_   Tech' Author       http://sources.redhat.com/autobook   =`---d__/





reply via email to

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