Roger Persson wrote:
> I get a strange sed warning/error of "unterminated substitute pattern"
> while using gnulib-tool. I'm building bison and the bootstrapping
> process uses gnulib-tool. ...
> 
> I tracked down the failure to a regular expression in
> "func_get_automake_snippet"  in gnulib-tool:906. This is the
> expression.
> 
>       # Synthesize an EXTRA_DIST augmentation.
>       sed_combine_lines='/\\$/{
>        :a
>         N
>         s/\\\
> //
>         s/\\$/\\/
>         ta
>       }'
> 
> I can't say if this is an illegal regular expression, but changing it
> to the expression below removes the problem. Be aware of my limited
> experience with this.
> 
>       sed_combine_lines='/\\$/{
>        :a
>         N
>         s/\\[\n]//
>         s/\\$/\\/
>         ta
>       }'

Thanks for analyzing and reporting this. Indeed the current regular expression
is invalid according to POSIX, since it says in
  
http://www.opengroup.org/onlinepubs/009695399/utilities/sed.html#tag_04_126_13_02
  "The escape sequence '\n' shall match a <newline> embedded in the pattern
   space. A literal <newline> shall not be used in the BRE of a context address
   or in the substitute function."

I'm applying this:


2006-11-01  Bruno Haible  <[EMAIL PROTECTED]>

        * gnulib-tool (func_get_automake_snippet): Change sed_combine_lines to
        be POSIX compliant.
        Reported by Roger Persson <[EMAIL PROTECTED]>.

*** gnulib-tool 23 Oct 2006 11:25:20 -0000      1.184
--- gnulib-tool 1 Nov 2006 13:14:05 -0000
***************
*** 916,923 ****
        sed_combine_lines='/\\$/{
          :a
          N
!         s/\\\
! //
          s/\\$/\\/
          ta
        }'
--- 916,922 ----
        sed_combine_lines='/\\$/{
          :a
          N
!         s/\\\n//
          s/\\$/\\/
          ta
        }'


Reply via email to