[Bug 5084] New: Small differences between Gnu and BusyBox sed

bugzilla at busybox.net bugzilla at busybox.net
Thu Apr 12 00:09:28 UTC 2012


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

           Summary: Small differences between Gnu and BusyBox sed
           Product: Busybox
           Version: 1.19.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Standard Compliance
        AssignedTo: unassigned at busybox.net
        ReportedBy: dubiousjim at gmail.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


BusyBox 1.19.3, built against uClibc 0.9.32, on i686 Linux

(1) BusyBox sed without -r, as well as Gnu sed, rejects unmatched \( and
unmatched \) both as invalid patterns. So too do their grep implementations
without -E.

Similarly, gnu sed with -r rejects unmatched ( and unmatched ) both as
invalid patterns. And so too do both egrep implementations.

Like everyone else, BusyBox sed with -r rejects unmatched ( as invalid.
But it diverges in treating unmatched ) as literal.


(2) With:

$ printf 'abc\n' | sed -n 's/x*/=&=/gp'

Gnu sed will replace against four zero-length matches. BusyBox sed will only
replace against the first.


(3) BusyBox sed accepts multiple adjacent quantifiers without error (for
example, "a**"), with or without the -r flag. Gnu sed with with the -r flag
behaves the same; without the -r flag it rejects such patterns as invalid. I'm
pointing this difference out, in case anyone wants to know, but I'm not sure
it's desirable to change BusyBox's existing behavior here.


(4) In Basic Regex settings (grep without -E, sed without -r), Gnu and BusyBox
treat quantifiers (*, \?, \+, \{1\}) in bad positions (such as the start of a
pattern) as literal expressions. (An exception is that Gnu sed rejects \{1\} in
those positions as invalid. Gnu grep and BusyBox grep and sed treat it as
literal.)
In Extended Regex settings (egrep, sed with -r), Gnu and BusyBox instead
silently drop the quantifiers from the pattern. However the way they drop "{1}"
is different: Gnu drops just the leading "{", leaving behind a literal "1}".
BusyBox drops the whole phrase "{1}".
Here, too, I'm pointing this difference out, in case anyone wants to know, but
I'm not sure it's desirable to change BusyBox's existing behavior.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list