pdksh vs wine

Jakub Bogusz qboosh w pld.org.pl
Śro, 19 Lut 2003, 20:09:55 CET


Udało mi się namierzyć problem.

Chodzi o fragment z wygenerowanego configure:

cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }

int
main ()
{

  ;
  return 0;
}
_ACEOF

Podczas wykonywania ./configure ksh zamienia występujące tu ciągi
 '\"' na '"', natomiast ash, bash, ksh93 i zsh nie.

Pomaga zmiana '\"' na '\\"' (wtedy działa we wszystkich powłokach).

Wg SUSv2 raczej to ksh robi źle, choć nie jest to napisane tak
jednoznacznie... ("will not be treated specially" - ale w jakim kontekście?
gdyby nie wyrażenie "having a special meaning" w drugim fragmencie,
bliższy byłbym uznania, że to ksh jest OK).

| [n]<<word
|     here-document
| delimiter
|
|     If any character in word is quoted, the delimiter is formed by performing quote removal on
|     word, and the here-document lines will not be expanded. Otherwise, the delimiter is the word
|     itself.
|
|     If no characters in word are quoted, all lines of the here-document will be expanded for
|     parameter expansion, command substitution and arithmetic expansion. In this case, the
|     backslash in the input will behave as the backslash inside double-quotes (see Double-quotes
|     ). However, the double-quote character (") will not be treated specially within a
|     here-document, except when the double-quote appears within $( ), ` ` or ${ }.

Pod linkiem Double-quotes jest:

|     Double-quotes
|
|     Enclosing characters in double-quotes (" ") preserves the literal value of all characters
|     within the double-quotes, with the exception of the characters dollar-sign, backquote and
|     backslash, as follows:
[...]
|     \
|             The backslash retains its special meaning as an escape character (see Escape
|             Character (Backslash) ) only when followed by one of the characters:
|
| $   `   "   \   <newline>
|
|     A double-quote must be preceded by a backslash to be included within double-quotes. The
|     parameter @ has special meaning inside double-quotes and is described in Special Parameters
|     .
|
|     In double-quoting, if a backslash is immediately followed by a character that would be
|     interpreted as having a special meaning, the backslash is deleted and the subsequent
|     character is taken literally. If a backslash does not precede a character that would have a
|     special meaning, it is left in place unmodified and the character immediately following it
|     is also left unmodified.
[...]

W każdym razie interpretacja '\\"' nie pozostawia wątpliwości, więc
dodam takiego patcha na wine (po takiej zmianie skombilowane przy użyciu
ksh jako /bin/sh znowu działa).

Natomiast pdksh dobrze by było poprawić...
(i dopisać odpowiedni test do tests/heredoc.t na przyszłość)


-- 
Jakub Bogusz    http://www.cs.net.pl/~qboosh/



Więcej informacji o liście dyskusyjnej pld-devel-pl