[gnu.utils.bug] problems with sed

mam@ra.umb.edu (Margaret Ann Metcalf) (10/28/89)

This is to report a bug found with gnu sed versions 1.02 and 1.06.
Problem lies in asking sed to perform branches (b label).
Error message is
    /usr/local/gnu/bin/sed: Can't find label for jump to ''

Machines are Sun3 runing SunOS 3.4, Sun SPARCStation running
SunOS 4.0.3, Sun 386i running SunOS 4.0.1.  Only version 1.06 was
tried on SPARC and Sun386i.

Here are details on script used for test.  Script used for test is
known to work with /bin/sed (Sun's sed).  It was modified only to
specify use of GNU sed.  Script expects input lines in format of
/etc/passwd with hostname prepended.  I.E.,
    ra|root:lWlgn9USZ1TPI:0:1:System Administrator:/:/bin/csh
Expected output is of form
    Administrator, System	root	0	ra	/
    
Here's script

#!/bin/sh
/usr/local/gnu/bin/sed							\
-e ':jr'								\
    -e '/ Jr[^:]*:/ {'							\
    -e '/:\([^: ]*\) \([^: ]*\) Jr[\.]*:/s//:\2, \1 Jr.:/'	\
    -e '/:\([^: ]* [^: ]*\) \([^: ]*\) Jr[\.]*:/s//:\2, \1 Jr.:/'	\
    -e 'b all'								\
    -e '}'								\
-e ':3d2p'								\
    -e '/[^:]*:[^:]*:[^:]*:[^:]*:[^ ]* [^ ]* [IV]*:/ {'			\
    -e '/:\([^: ]*\) \([^: ]*\) \([IV\.]*\):/s//:\2, \1 \3:/'	\
    -e 'b all'								\
    -e '}'								\
-e '/^\([^:]*:[^:]*:[^:]*:[^:]*:\)\([^: ]* [^: ]*\) \([^: ]*\) \([IV\.]*\):/{' \
    -e 's//\1\3, \2 \4:/'					\
    -e 'b all'								\
    -e '}' \
    -e ':3pn'								\
    -e '/^\([^:]*:[^:]*:[^:]*:[^:]*:\)\([^: ]* [^: ]*\) \([^: ]*\):/ {'	\
    -e 's//\1\3, \2:/'						\
    -e 'b all'								\
    -e '}'								\
    -e ':2pn'								\
    -e '/^\([^:]*:[^:]*:[^:]*:[^:]*:\)\([^: ]*\) \([^: ]*\):/ {'	\
    -e 's//\1\3, \2:/'						\
    -e 'b all'								\
    -e '}'								\
-e ':all'								\
-e '/^\([^:| 	]*\)[| 	]*\([^:]*\):[^:]*:\([^:]*\):[^:]*:\([^:]*\):\([^:]*\).*/ {' \
    -e 's//\4	\2	\3	\1	\5/' \
    -e 'b' \
    -e '}' \

#    -e 's/^\([^:]*\):[^:]*:/\1::/'					\

#      1=machine            2=login         3=uid           4=name    5=home
# juniors - handle various forms then kick out
# thirds - handle various forms then kick out
# 3 part names
# 2 part names
# all lines - strip out password field

thanks,
mam@umb.umb.edu

tarvaine@tukki.jyu.fi (Tapani Tarvainen) (10/28/89)

In article <8910280012.AA06569@ra.umb.edu> mam@ra.umb.edu (Margaret Ann Metcalf) writes:

>This is to report a bug found with gnu sed versions 1.02 and 1.06.
>Problem lies in asking sed to perform branches (b label).
>Error message is
>    /usr/local/gnu/bin/sed: Can't find label for jump to ''

>Here's script

The offending line was this:

>    -e 'b' \

'b' or 't' without a label were compiled incorrectly (they should
branch to the end of script).  Fixing this required small changes in
setup_jump and in main() at the point where jump addresses were
stored (the execution phase already tested for this).

The fixed version can be obtained via anonymous ftp from tukki.jyu.fi
(128.214.7.5) in ~ftp/pub/sed/gnused106t2.tar.Z (or by sending me mail).

Incidentally, if anybody has ftp'd gnused106t1.tar.Z there was another
bug which is also corrected now (it wouldn't compile with non-ANSI
compilers because I'd forgotten to add non-ANSI declaration for
two functions).
-- 
Tapani Tarvainen    (tarvaine@tukki.jyu.fi, tarvainen@finjyu.bitnet)