[Bug 15166] New: Bug in substitution function of the ed applet

bugzilla at busybox.net bugzilla at busybox.net
Tue Dec 6 23:21:46 UTC 2022


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

            Bug ID: 15166
           Summary: Bug in substitution function of the ed applet
           Product: Busybox
           Version: 1.34.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: rozel at enertech.fr
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

Non global substitution isn't done in two consecutive lines when the string on
the 2nd line is before or at the same place of the first line.
For example :

,s/OLD/NEW/ on 
--
OLD
OLD
--
 gave 
--
OLD
NEW
--
(bug)

but on
--
OLD

OLD
--
 gave
--
NEW

NEW
--
(OK)

and on 
--
OLD
XXXOLD
--
(OK)

gave 
--
NEW
XXXNEW
--
(OK).

On the first example, ,s/OLD/NEW/g works correctly (all OLD are substituted).

Looking at the source of the 1.35 version (editors/ed.c), it seems that this
problem can be corrected by initializing "offset = 0;" each time "lp =
lp->next; num1++;" in the subCommand() function (so in line 729 and 770).

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


More information about the busybox-cvs mailing list