🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #137

Problem in sed.

#137
From: Erik Forsberg
Date: Sun, 12 Apr 1992 09:48
37 lines
1394 bytes
This was found using GNU sed 1.08 while
trying to build TeX 3.14 mf. I have simplified
the test case down to a minimum.

Take this sed program

: again
/\.$/{
	N
	s/\.\n/./
	t again
}
s/\.hh/.hhfield/g

Apply it to this input file

foo.hh.bar.
xyzzy

and the last s command is applied too many times.
The jump 't again' transfers outside of the currently executing
subprogram but that is not reflected in the sed execution.
At the jump, it jumps but does not exit the current invokation
of execute_program. So the final substitution happens, we return
from execute_program back to the original execute_program loop
that then applies the substitution again. We end up with the
text

foo.hhfieldfield.bar.xyzzy  instead of the expected
foo.hhfield.bar.xyzzy

I have currently NO idea how to fix it (without breaking anything else)

EF

---------------------------------------------------------------------------
Erik Forsberg, erik@eab.retix.com Phone: (310) 476-7133 FAX: (310) 476-7657
Technical Details
Message-ID: <9204122348.AA06052@eab.retix.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!eab.retix.COM!erik

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!eab.retix.COM!erik
From: erik@eab.retix.COM (Erik Forsberg)
Subject: Problem in sed.
Message-ID: <9204122348.AA06052@eab.retix.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 12 Apr 1992 09:48:53 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 39