libtool
[Top][All Lists]
Advanced

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

Re: solaris link line length problem == buggy sed


From: libtool
Subject: Re: solaris link line length problem == buggy sed
Date: Tue, 17 Jul 2001 22:15:26 -0500
User-agent: Mutt/1.2.5i

On Tue, Jul 17, 2001 at 06:33:06PM -0500, Robert Boehne wrote:
> Alex Hornby wrote:
> > 
> > My earlier link line truncation problem on solaris was not due to
> > command line length restrictions (getconf reports a healthy 109kb for
> > ARG_MAX).
> > 
> > Solaris 2.6 /usr/bin/sed, as used by libtool during the link, has
> > problems with "long" lines of > 3999 characters, truncating them as it
> > sees fit.
> > 
> > By putting GNU sed ahead of solaris sed on my PATH the build succeeds.
> > 
> > Should libtool work around such broken sed's during the build phase,
> > and would patches be considered that did this?
> > 
> > Regards,
> > Alex.
> > 
> 
> Ok, I'm trying to write a macro for libtool.m4 that will check for
> bugs such as this one in sed.  However, if I create a file inline
> with 8202 characters on one line, Linux bash segfaults!
> It does work under IRIX and Solaris, so my approach seems OK.
> Here is what it basically does:
> 
>   cat > conftest.$ac_ext <<EOF
> XXXXXXXXXX<SNIP 8200 'X' characters>
> EOF
>   sed 's/Y/Z/g' conftest.$ac_ext > conftest.out
>   lt_cv_buggy_sed="yes"
>   cmp conftest.$ac_ext conftest.out >/dev/null && lt_cv_buggy_sed="no"
> 2>&1
>   ls -al conftest.$ac_ext conftest.out
>   cat conftest.$ac_ext
> fi
> 
> Since bash 1.14.7 under Linux (Redhat 6.2) seems to have a
> problem with such a long inline file, is there a way to
> concatenate a character or characters into a file without
> adding newlines?
> Granted, I can simply skip this if GNU sed is found, but
> I'm sure it will come up again on some other sed/shell
> combination.

I have a script to solve the above problem. /usr/xpg4/bin/sed on
Solaris works better than /bin/sed. Hardcoding the number of of X's
above isn't the best solution. Much better to walk a list of sed's and
pick the one that can take the most characters.

I've attached the script below. Want to work this into your solution?
I'm short on time to do it myself at the moment.

-- 
albert chin (address@hidden)

-- snip snip
#!/bin/sh

trap "rm -f /tmp/$$-sed-out /tmp/$$-sed-in /tmp/$$-sed-in-nl \
/tmp/$$" 0 2 13

if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn
/dev/null; then
    ac_n= ac_c='
' ac_t='        '
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi

_max=0
_count=0

for _sed in /bin/sed /usr/xpg4/bin/sed; do
  test ! -f ${_sed} && break

  cp /dev/null /tmp/$$-sed-in

  _count=0
  echo $ac_n "0123456789$ac_c" >/tmp/$$-sed-in
  while /bin/true; do
    echo "sed: $_sed, _count: $_count"

    cat /tmp/$$-sed-in /tmp/$$-sed-in >/tmp/$$
    mv /tmp/$$ /tmp/$$-sed-in
    cp /tmp/$$-sed-in /tmp/$$-sed-in-nl
    echo >>/tmp/$$-sed-in-nl

    ${_sed} -e 's/a$//' < /tmp/$$-sed-in-nl >/tmp/$$-sed-out
    test $? -ne 0 && break
    cmp -s /tmp/$$-sed-out /tmp/$$-sed-in-nl
    test $? -ne 0 && break

    # 10000 chars as input seems more than enough
    test $_count -gt 10 && break

    _count=`expr $_count + 1`
    if test $_count -gt $_max; then
      _max=$_count
      _best_sed=$_sed
    fi
  done
done

echo $_best_sed



reply via email to

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