On 2016-04-06, frantisek holop <[email protected]> wrote:

> i am trying to track down some fgrep errors that show
> up in vim's configure run.
>
>  5733           if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = 
> "X"; then

Ah, yes.  We've run into this before.

As ksh(1) explains under "POSIX mode":

  o  Occurrences of \" inside double quoted `..` command substitutions.
     In POSIX mode, the \" is interpreted when the command is interpreted;
     in non-POSIX mode, the backslash is stripped before the command
     substitution is interpreted.  For example, echo "`echo \"hi\"`"
     produces ``"hi"'' in POSIX mode, ``hi'' in non-POSIX mode.  To avoid
     problems, use the $(...) form of command substitution.

The configure script switches the shell into POSIX mode (set -o posix),
but expects the other behavior.

To illustrate:
$ sh          -c 'echo "`echo \"hi\"`"'
hi
$ sh -o posix -c 'echo "`echo \"hi\"`"'
"hi"

The problem is that our sh's idea of POSIX-mandated behavior diverges
in this regard from that of other popular shells like bash or FreeBSD
sh.  I think it's time to change our shell.  I'll send something
to tech@ later tonight.

-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to