[Toybox] sed's supposed 'x' flag

enh enh at google.com
Thu Dec 3 16:46:58 PST 2020


i thought adding the 's' command's 'x' flag would be a nice warm up to
trying to implement `tar --transform` ... but it turns out there's no such
flag in GNU sed. we just misread the GNU tar manual (which never strictly
claims this to be the case, but also didn't explicitly call out that this
isn't also supported in sed).

i've attached the patch anyway, since i only worked this out after
the fact, but i'm deliberately not sending the usual "[PATCH]" style mail
to call your attention to the fact that this would be a toybox extension if
we added it to sed.

 --

[PATCH] sed: add 'x' flag to the 's' command.

The GNU tar manual, when talking about the `tar --transform` option that I
need to implement, describes the 'x' flag by saying "regexp is an extended
regular expression (see section 'Extended regular expressions' in GNU sed)".

Only it turns out that even the latest GNU sed doesn't actually have
that flag. It's unique to `tar --transform`. That link is just telling
you that the sed manual will explain extended regular expressions, not
that GNU sed also supports the 'x' flag.

So I don't know whether we want this in toybox sed after all. (It made
sense that sed would have such a flag, but no sed that I know of
actually does.)
---
 tests/sed.test   |  2 ++
 toys/posix/sed.c | 16 +++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20201203/ed7be5f0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sed-add-x-flag-to-the-s-command.patch
Type: text/x-patch
Size: 3725 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20201203/ed7be5f0/attachment-0002.bin>


More information about the Toybox mailing list