This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: r150960 changed ltmain.sh and broke the build


      Patterns should not include the separator (unless escaped), even
      as part of a character class.  In conformance with Posix, the Cray
      `sed' rejects `s/[^/]*$//': use `s,[^/]*$,,'.
[...]
      Portable `sed' regular expressions should use `\' only to escape
      characters in the string `$()*.0123456789[\^n{}'.


   Ah, I didn't read those two conditions as applying simultaneously.  Since
the second condition essentially says that you must only ever escape a special
character to make it non-meaningful or a normal character to make it special,
maybe the first condition say something a bit more like ...

   Patterns should not include the separator (not even escaped, unless
   you fancy having to use a semantically significant metacharacter for
   your separator), even as part of a ...

No. The problem is exactly when you use a semantically significant metacharacter for your separator.


\*   => unportable, a\* may become either a* or a\*
\>   => unportable, a\> may become either a> or a\>
\$   => unportable, a\$ may become either a$ or a\$
\,   => unportable, part of \{a,b\}
\|   => unportable, a\|b may become either a|b or a\|b and the latter
        may be parsed as alternation
\/   => in theory unportable in practice it would be insane to introduce
        a special sequence \/
\@ \: etc. => in theory unportable, in practice they should be fine.

All of these are forbidden by the wording in Autoconf manual.

One could add / to the list in the second paragraph, and saying something like "only / should be used as a separator if you wish to escape it, to avoid inadvertent introduction or escaping of regular expression operators".

Or even better, it should be left as is.

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]