[Bug 13051] New: sed: the substitute command ignores the g flag if the supplied pattern starts with '^'

bugzilla at busybox.net bugzilla at busybox.net
Wed Jul 1 04:03:23 UTC 2020


https://bugs.busybox.net/show_bug.cgi?id=13051

            Bug ID: 13051
           Summary: sed: the substitute command ignores the g flag if the
                    supplied pattern starts with '^'
           Product: Busybox
           Version: 1.31.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: i at yvt.jp
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

$ sed --help
BusyBox v1.31.1 () multi-call binary.
[...]

The commit
<https://git.busybox.net/busybox/commit/?id=f36635cec6da728fe06b849089ce2f6c1690dc67>
introduced this behavior to address the bug with `echo "aah" | sed 's/^a/b/g'`.
However, this breaks other regexs, such as:

$ echo 'a b c' | sed -E 's/^a|b|c/d/g'
d b c

Simply reordering the clauses so that '^' doesn't appear at the start makes it
working as intended:

$ echo 'a b c' | sed -E 's/b|^a|c/d/g'
d d d

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list