[Toybox] Sed problem

Felix Janda felix.janda at posteo.de
Mon Mar 23 12:15:05 PDT 2015


David Halls wrote:
> I'm trying to compile libiconv. It has this in its configure script:
> 
>   sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
> func_dirname ()\
> {\
> \    case ${1} in\
> \      */*) func_dirname_result="${1%/*}${2}" ;;\
> \      *  ) func_dirname_result="${3}" ;;\
> \    esac\
> } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
> 
> This results in the following being generated:
> 
> func_dirname ()
> {
> \    case ${1} in
> \      */*) func_dirname_result="${1%/*}${2}" ;;
> \      *  ) func_dirname_result="${3}" ;;
> \    esac
> } # Extended-shell func_dirname implementation
> 
> i.e. backslashes are left in, which bash barfs on.
> 
> The busybox sed stripped out the backslashes, and libiconv compiled fine.

Another workaround is to autoreconf -i

There is very nice comment above in the configure script:

  # We use sed instead of cat because bash on DJGPP gets confused if
  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
  # text mode, it properly converts lines to CR/LF.  This bash problem
  # is reportedly fixed, but why not run on old versions too?

Anyway these sed invocations seem still quite common in configure
scripts.

Felix

 1427138105.0


More information about the Toybox mailing list