btw: Things seem even worse, as also non-special characters used as
delimiters may be affected by implementation-ambiguities:


GNU sed:
$ printf '%s\n' '9+' |         sed 's+9\++X+'
X
$ printf '%s\n' '99+' | sed 's+9\++X+'
9X
$ printf '%s\n' '999+' | sed 's+9\++X+'
99X

=> these results are IMO fine, regardless of my other questions on what
the standard means with "literal" and how the command shall be parsed.

In BREs, + alone is never special, and whether one parses all at once
from left to right... or first looks for unquoted delimiter characters
and splits the command there...
... the RE should always be effectively the string "9+", which is (in
BREs) the literal 9 followed by the literal +.


However...


BusyBox sed:
$ printf '%s\n' '9+' | busybox sed 's+9\++X+'
X+
$ printf '%s\n' '99+' | busybox sed 's+9\++X+'
X+
$ printf '%s\n' '999+' | busybox sed 's+9\++X+'
X+

manages to transform the non-special character into a special one.
Which I think is generally (regardless of the interpretation or any
ambiguities in POSIX) a bug (I'll report it there).



Cheers,
Chris.

  • sed and deli... Christoph Anton Mitterer via austin-group-l at The Open Group
    • Re: sed... Don Cragun via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group
    • Fwd: se... Oğuz via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group
        • ... Christoph Anton Mitterer via austin-group-l at The Open Group
        • ... Oğuz via austin-group-l at The Open Group
          • ... Don Cragun via austin-group-l at The Open Group
            • ... Oğuz via austin-group-l at The Open Group
              • ... Christoph Anton Mitterer via austin-group-l at The Open Group
                • ... Oğuz via austin-group-l at The Open Group
            • ... Christoph Anton Mitterer via austin-group-l at The Open Group
          • ... Christoph Anton Mitterer via austin-group-l at The Open Group

Reply via email to