Bug 5522

Summary: sed: jumps are not handled correctly inside command groups
Product: Busybox Reporter: steffen1956
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.19.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

Description steffen1956 2012-09-13 22:47:42 UTC
Hi!

BusyBox' sed has problems when a command ground "{...}" ends with a jump statement "b". I tried the following examples both in my local BusyBox 1.19.4 and in the VM (http://busybox.net/live_bbox/live_bbox.html) with version 1.20.0. Both examples work without any problems when executed by GNU sed.

example 1 (jump with label)
---------------------------
/ # echo 'a                                                                     
> b                                                                             
> c                                                                             
> d' | sed -ne ':a /^b/ {n;p;b a}'                                              
sed: unterminated {


example 2 (jump w/o label)
--------------------------
/ # echo 'a                                                                     
> b                                                                             
> c                                                                             
> d' | sed -ne '/^b/ {x;p;b}' -e 'h'                                            
sed: unterminated {


Adding a semicolon before the closing brace is a workaround in both cases.

/ # echo 'a                                                                     
> b                                                                             
> c                                                                             
> d' | sed -ne '/^b/ {x;p;b;}' -e 'h'
a