bug-gnulib
[Top][All Lists]
Advanced

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

Re: gnulib-tool bug


From: Bruno Haible
Subject: Re: gnulib-tool bug
Date: Sun, 1 Mar 2009 18:44:39 +0100
User-agent: KMail/1.9.9

Paolo Bonzini wrote:
> FWIW, the bug mentioned earlier in the thread is already fixed in git sed.

Thanks for the info. I'm re-enabling the use of the --posix option for when
sed 4.2 will be released.


2009-03-01  Bruno Haible  <address@hidden>

        * gnulib-tool (sed): Do alias as "sed --posix" if sed's version is at
        least 4.2.

*** gnulib-tool.orig    2009-03-01 18:42:18.000000000 +0100
--- gnulib-tool 2009-03-01 18:42:10.000000000 +0100
***************
*** 63,90 ****
    AUTOPOINT="${GETTEXTPATH}autopoint"
  fi
  
! # Disabled because "sed --posix" is buggy in GNU sed 4.1.5, see
  # <http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00225.html>.
! if false; then
!   # When using GNU sed, turn off as many GNU extensions as possible,
!   # to minimize the risk of accidentally using non-portable features.
!   # However, do this only for gnulib-tool itself, not for the code that
!   # gnulib-tool generates, since we don't want "sed --posix" to leak
!   # into makefiles.
!   if (alias) > /dev/null 2>&1 && echo | sed --posix -e d >/dev/null 2>&1; then
!     # Define sed as an alias.
!     # It is not always possible to use aliases. Aliases are guaranteed to work
!     # if the executing shell is bash and either it is invoked as /bin/sh or
!     # is a version >= 2.0, supporting shopt. This is the common case.
!     # Two other approaches (use of a variable $sed or of a function func_sed
!     # instead of an alias) require massive, fragile code changes.
!     # An other approach (use of function sed) requires `which sed` - but
!     # 'which' is hard to emulate, due to missing "test -x" on some platforms.
!     if test -n "$BASH_VERSION"; then
!       shopt -s expand_aliases >/dev/null 2>&1
!     fi
!     alias sed='sed --posix'
    fi
  fi
  
  # sed_noop is a sed expression that does nothing.
--- 63,94 ----
    AUTOPOINT="${GETTEXTPATH}autopoint"
  fi
  
! # When using GNU sed, turn off as many GNU extensions as possible,
! # to minimize the risk of accidentally using non-portable features.
! # However, do this only for gnulib-tool itself, not for the code that
! # gnulib-tool generates, since we don't want "sed --posix" to leak
! # into makefiles. And do it only for sed versions 4.2 or newer,
! # because "sed --posix" is buggy in GNU sed 4.1.5, see
  # <http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00225.html>.
! if (alias) > /dev/null 2>&1 \
!    && echo | sed --posix -e d >/dev/null 2>&1 \
!    && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
!         [1-3]* | 4.[01]*) false;; \
!         *) true;; \
!       esac \
!    ; then
!   # Define sed as an alias.
!   # It is not always possible to use aliases. Aliases are guaranteed to work
!   # if the executing shell is bash and either it is invoked as /bin/sh or
!   # is a version >= 2.0, supporting shopt. This is the common case.
!   # Two other approaches (use of a variable $sed or of a function func_sed
!   # instead of an alias) require massive, fragile code changes.
!   # An other approach (use of function sed) requires `which sed` - but
!   # 'which' is hard to emulate, due to missing "test -x" on some platforms.
!   if test -n "$BASH_VERSION"; then
!     shopt -s expand_aliases >/dev/null 2>&1
    fi
+   alias sed='sed --posix'
  fi
  
  # sed_noop is a sed expression that does nothing.




reply via email to

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