Loading ...
Sorry, an error occurred while loading the content.

sed bug causing build failure?

Expand Messages
  • Mark Waggoner
    I ve discovered that the sed that exists on my solaris and HPUX machines is broken in a way that causes problems building vim. It can be demonstrated with
    Message 1 of 4 , Dec 3, 2003
    • 0 Attachment
      I've discovered that the sed that exists on my solaris and HPUX machines
      is broken in a way that causes problems building vim. It can be
      demonstrated with these commands:

      echo -n 'This is a test' | sed -e 's/is a/foo/'
      echo 'This is a test' | sed -e 's/is a/foo/'

      The first will print nothing at all, while the second prints "This foo
      test" as expected. sed does not seem to like lines with no carriage
      return. I've observed this on Solaris (5.6) and HPUX (11.0)

      This causes problems in src/auto/configure - the one I really ran in to
      is this:

      perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
      -e 'ccflags;perl_inc;' | sed -e 's/-fno[^ ]*//'`

      I needed to modify this to be:

      perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
      -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'`


      This is likely also hitting the problem, though it didn't prevent
      building:
      PERL_LIBS=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
      sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
      -e 's/-bE:perl.exp//' -e 's/-lc //'`

      I haven't gone looking for any other instances.

      --
      Mark Waggoner |
      waggoner@... | Then he'll want to look in a mirror
      503-712-3335 | to make sure he doesn't have a milk mustache.
      dpg-or.pdx.intel.com/~waggoner |
    • Bram Moolenaar
      ... That s a weird problem. I wonder why nobody noticed this before. ... Why doesn t Perl add a newline after the text it writes to stdout? Anyway, that s how
      Message 2 of 4 , Dec 24, 2003
      • 0 Attachment
        Mark Waggoner wrote:

        > I've discovered that the sed that exists on my solaris and HPUX machines
        > is broken in a way that causes problems building vim. It can be
        > demonstrated with these commands:
        >
        > echo -n 'This is a test' | sed -e 's/is a/foo/'
        > echo 'This is a test' | sed -e 's/is a/foo/'
        >
        > The first will print nothing at all, while the second prints "This foo
        > test" as expected. sed does not seem to like lines with no carriage
        > return. I've observed this on Solaris (5.6) and HPUX (11.0)

        That's a weird problem. I wonder why nobody noticed this before.

        > This causes problems in src/auto/configure - the one I really ran in to
        > is this:
        >
        > perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
        > -e 'ccflags;perl_inc;' | sed -e 's/-fno[^ ]*//'`
        >
        > I needed to modify this to be:
        >
        > perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
        > -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'`

        Why doesn't Perl add a newline after the text it writes to stdout?
        Anyway, that's how it is.

        > This is likely also hitting the problem, though it didn't prevent
        > building:
        > PERL_LIBS=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
        > sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
        > -e 's/-bE:perl.exp//' -e 's/-lc //'`

        This text *does* end in a newline. Thus Perl works different here.
        Don't know why...

        > I haven't gone looking for any other instances.

        I'll include the change suggested above. I'll await comments before
        sending it out. Let me know if you see another problem with this sed.

        --
        From "know your smileys":
        *<|:-) Santa Claus (Ho Ho Ho)

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
      • Jonathan D Johnston
        On Wed, 24 Dec 2003 15:00:03 +0100, ... [...] ... It s a *good* thing that Perl doesn t add a newline. The output of the subs ccflags(), perl_inc(), ldopts(),
        Message 3 of 4 , Dec 25, 2003
        • 0 Attachment
          On Wed, 24 Dec 2003 15:00:03 +0100,
          Bram Moolenaar <Bram@...> wrote:
          > Mark Waggoner wrote:
          [...]
          > > I needed to modify this to be:
          > >
          > > perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
          > > -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'`
          >
          > Why doesn't Perl add a newline after the text it writes to stdout?
          > Anyway, that's how it is.

          It's a *good* thing that Perl doesn't add a newline. The output of the
          subs ccflags(), perl_inc(), ldopts(), &c. was designed to be "glued"
          into a cc command line, such as:

          cc -o prog prog.c `perl -MExtUtils::Embed -e ccflags -e ldopts`

          Naturally, you wouldn't want newlines in the middle of your cc command.


          > > This is likely also hitting the problem, though it didn't prevent
          > > building:
          > > PERL_LIBS=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e
          'ldopts' | \
          > > sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
          > > -e 's/-bE:perl.exp//' -e 's/-lc //'`
          >
          > This text *does* end in a newline. Thus Perl works different here.
          > Don't know why...

          I can't resist: Because the programmer told it to!
          Perl, unlike Python, doesn't automatically add a newline for each print
          statement (unless invoked with -l [that's dash-el]). Looking at the
          source for the cc "glue" subs in ExtUtils::Embed v 1.2501, the only sub
          with a newline appended to it's output is ldopts().

          Why? I'm not sure, but I note that all of the examples in the man pages
          perlembed and ExtUtils::Embed have ldopts() being called last (or at the
          end) on the cc lines. Maybe ldopts() works best if called last and the
          newline is there to enforce that ordering - just speculation on my part.

          Merry Christmas,
          Jonathan D Johnston

          ________________________________________________________________
          The best thing to hit the internet in years - Juno SpeedBand!
          Surf the web up to FIVE TIMES FASTER!
          Only $14.95/ month - visit www.juno.com to sign up today!
        • Bram Moolenaar
          ... If you use backticks like that, the shell will remove the (trailing) newline for you. Most commands add line breaks, thus the shell removes them. Try this
          Message 4 of 4 , Dec 27, 2003
          • 0 Attachment
            Johnston D Johnston wrote:

            > On Wed, 24 Dec 2003 15:00:03 +0100,
            > Bram Moolenaar <Bram@...> wrote:
            > > Mark Waggoner wrote:
            > [...]
            > > > I needed to modify this to be:
            > > >
            > > > perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
            > > > -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'`
            > >
            > > Why doesn't Perl add a newline after the text it writes to stdout?
            > > Anyway, that's how it is.
            >
            > It's a *good* thing that Perl doesn't add a newline. The output of the
            > subs ccflags(), perl_inc(), ldopts(), &c. was designed to be "glued"
            > into a cc command line, such as:
            >
            > cc -o prog prog.c `perl -MExtUtils::Embed -e ccflags -e ldopts`
            >
            > Naturally, you wouldn't want newlines in the middle of your cc command.

            If you use backticks like that, the shell will remove the (trailing)
            newline for you. Most commands add line breaks, thus the shell removes
            them.

            Try this with a short "file" that contains line breaks:

            echo `cat file`

            It will display a single line.

            Thus Perl should add a newline in that output.

            --
            From "know your smileys":
            *<|:-) Santa Claus (Ho Ho Ho)

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
          Your message has been successfully submitted and would be delivered to recipients shortly.