🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.bugs.sys5
12 messages
12 total messages Started by 9704 Wed, 18 Oct 1989 01:17
s/A*./B/g editor bug?
#124
Author: 9704
Date: Wed, 18 Oct 1989 01:17
28 lines
1468 bytes
I've noticed the ED s///g command works incorrectly when given the command
	s/b*a/c/g
on the input line
	aaaaaaaaaaaaaaaaaaaaa
-- the result is:
	cacacacacacacacacacac
and it should be:
	ccccccccccccccccccccc

This is incorrect according to ED(1):

     (.,.)s/RE/replacement/g
                         The substitute command searches each
                         addressed line for an occurrence of the
                         specified RE.  In each line in which a
                         match is found, ALL (NON-OVERLAPPED)
                         matched strings are replaced by the
                         replacement if the global replacement
                         indicator g appears after the command.

These occurrences ARE non-overlapping.  The form s/ab*/c/g works as expected.
Both VI and ED behave this way, on at least System V.2 and Ultrix-32 V3.1.
Is this a confirmed bug in the RE matcher or the substitute code, and has
it been resolved?  This sounds trivial, but it did cause real problems.

					-- Greg Ubben
					   bink@aplcen.apl.jhu.edu
					   ...!uunet!mimsy!aplcen!bink
Re: s/A*./B/g editor bug?
#125
Author: Doug Gwyn
Date: Wed, 18 Oct 1989 13:55
10 lines
943 bytes
In article <3522@aplcen.apl.jhu.edu> bink@aplcen.apl.jhu.edu (9704) writes:
-I've noticed the ED s///g command works incorrectly when given the command
-	s/b*a/c/g
-on the input line
-	aaaaaaaaaaaaaaaaaaaaa
-Is this a confirmed bug in the RE matcher or the substitute code, and has
-it been resolved?  This sounds trivial, but it did cause real problems.

I believe it's a real bug.  The corresponding "sam" x/b*a/c/c/ works as
you expected the "ed" command to work.
Re: s/A*./B/g editor bug?
#112
Author: Perry Hutchison
Date: Wed, 18 Oct 1989 22:42
17 lines
1076 bytes
In article <3522@aplcen.apl.jhu.edu> bink@aplcen.apl.jhu.edu (9704) writes:

+ I've noticed the ED s///g command works incorrectly when given the command
+ 	s/b*a/c/g
+ on the input line
+ 	aaaaaaaaaaaaaaaaaaaaa
+ -- the result is:
+ 	cacacacacacacacacacac
+ and it should be:
+ 	ccccccccccccccccccccc

< documentation citation, according to which this is a bug, deleted >

+ Both VI and ED behave this way, on at least System V.2 and Ultrix-32 V3.1.

Both also behave this way on SunOS 3.5, which is a 4.2 BSD derivative.
Anyone care to try it out on a 2bsd or a V7 system?
Re: s/A*./B/g editor bug?
#113
Author: Henry Spencer
Date: Thu, 19 Oct 1989 16:47
19 lines
1233 bytes
In article <741@ccssrv.UUCP> perry@ccssrv.UUCP (Perry Hutchison) writes:
>+ 	s/b*a/c/g
>+ on the input line
>+ 	aaaaaaaaaaaaaaaaaaaaa
>+ -- the result is:
>+ 	cacacacacacacacacacac
>+ Both VI and ED behave this way, on at least System V.2 and Ultrix-32 V3.1.
>
>Both also behave this way on SunOS 3.5, which is a 4.2 BSD derivative.
>Anyone care to try it out on a 2bsd or a V7 system?

Using our ed, which although it runs on a Sun is a V6-derived program,
I get the right answer.  Looks like somebody broke it -- Berkeley, for
a guess, but I could be wrong -- and everyone else blindly copied the
mistake.  (I unfortunately don't have a V7 ed source handy to check;
just conceivably it was broken there, although it would surprise me.)
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
Re: s/A*./B/g editor bug?
#114
Author: Guy Harris
Date: Thu, 19 Oct 1989 17:24
5 lines
682 bytes
>Both also behave this way on SunOS 3.5, which is a 4.2 BSD derivative.
>Anyone care to try it out on a 2bsd or a V7 system?

"vi", but not "ed", behaves that way on SunOS 4.0, whose "vi" is
4.3BSD-derived and whose "ed" is S5R3-derived.
Re: s/A*./B/g editor bug?
#115
Author: Patrick Place
Date: Thu, 19 Oct 1989 20:11
13 lines
958 bytes

To add fuel to the broken regular expressions fire, using a 3B1 - I
have no idea where this version of ed was derived from, but I would
guess from AT&T System V - ed is again broken in the way indicated
by others.

I would be interested if Henry Spencer, who has a V6 derived ed,
can determine whether he is using the standard regular expression
package or if in the derivation path the appropriate routines have
been fixed.

Pat Place
Re: s/A*./B/g editor bug?
#127
Author: Richard Stevens
Date: Fri, 20 Oct 1989 11:26
10 lines
689 bytes
V7's ed is broken too, so that must have been where it happened,
since Henry says V6 did it correctly.

Also, the 4.3BSD sed doesn't show this bug.

Under SVR3.2 on a 386, ed, vi, *and* sed all show the bug.

	Richard Stevens
	Health Systems International, New Haven, CT
	   stevens@hsi.com
Re: s/A*./B/g editor bug?
#117
Author: Peter da Silva
Date: Fri, 20 Oct 1989 13:48
7 lines
873 bytes
Brian Beattie's Software-Tools-derived 'ed' works fine, so it looks like
Kernighan got it right.
-- 
Peter da Silva, *NIX support guy @ Ferranti International Controls Corporation.
Biz: peter@ficc.uu.net, +1 713 274 5180. Fun: peter@sugar.hackercorp.com. `-_-'
"You can tell when a USENET discussion is getting old when one of the      'U`
 participants drags out Hitler and the Nazis" -- Richard Sexton
Re: s/A*./B/g editor bug?
#116
Author: Henry Spencer
Date: Fri, 20 Oct 1989 18:20
18 lines
1363 bytes
In article <4586@fy.sei.cmu.edu> prp@sei.cmu.edu (Patrick Place) writes:
>I would be interested if Henry Spencer, who has a V6 derived ed,
>can determine whether he is using the standard regular expression
>package or if in the derivation path the appropriate routines have
>been fixed.

The derivation path can be described, most inadequately, as "long and
twisty".  The modification log is several hundred lines long.  I took a
quick look through it and found nothing specifically identified as
fixing regular-expression bugs, but there are enough slightly-mysterious
references to cleanups and such that it's hard to be sure.

It would be rather difficult to recover an original V6 source, and I
probably couldn't make it run on a Sun to check.  I may be able to give
a definitive answer about V7 next week.
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
Re: s/A*./B/g editor bug?
#131
Author: Daniels Tso (Wiesel)
Date: Sat, 21 Oct 1989 20:47
18 lines
1465 bytes
In article <1989Oct20.182045.21541@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>It would be rather difficult to recover an original V6 source, and I
>probably couldn't make it run on a Sun to check.  I may be able to give
>a definitive answer about V7 next week.

	For what it's worth, ed is broken on PWB 1.2 (The precursor to
USG System 3.0 that was released between V6 and V7). Almost everything
on PWB 1.2 is V6-like, so I speculate that if V6 ed "works" (as Henry's
suggests) and PWB 1.2 and V7 is broken, that the change was made on the
research group's UNIX before the PWB people picked it up.
	I could fetch a V6 ed and diff it with the PWB ed. The number of
diffs should be very small...
				Cheers,
				Dan Ts'o
				Dept. Neurobiology	212-570-7671
				Rockefeller Univ.	...cmcl2!rna!dan
				1230 York Ave.		dan@rna.rockefeller.edu
				NY, NY 10021		tso@rockefeller.edu
Re: s/A*./B/g editor bug?
#132
Author: Arnold D. Robbins {EUCC}
Date: Wed, 25 Oct 1989 15:30
12 lines
1310 bytes
In article <6606@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
>Brian Beattie's Software-Tools-derived 'ed' works fine, so it looks like
>Kernighan got it right.

Indeed.  The "Georgia Tech 'se' Screen Editor", which is also derived from
the Software Tools 'ed', gets it right as well.  ('Se' is available in your
nearest comp.sources.unix archive.)
-- 
Arnold Robbins -- Emory U. Information Technology Div.  | Laundry increases
DOMAIN: arnold@emoryu1.cc.emory.edu			| exponentially in the
UUCP: gatech!emoryu1!arnold  PHONE: +1 404 727-7636	| number of children.
BITNET: arnold@emoryu1	     FAX:   +1 404 727-2599	|   -- Miriam Hartholz
Re: s/A*./B/g editor bug?
#133
Author: Bill Webb
Date: Wed, 25 Oct 1989 21:39
20 lines
1527 bytes
>...
> It would be rather difficult to recover an original V6 source, and I
> probably couldn't make it run on a Sun to check.  I may be able to give
> a definitive answer about V7 next week.
> -- 
> A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
> megabyte of flaming.           | uunet!attcan!utzoo!henry
henry@zoo.toronto.edu

I've just tried it on a Version 6 ed (I knew that PDP 11 simulator would
eventually come in handy!) that had only one slight modification over the
standard v6 ed (it output a prompt character) and it has the bug. I could
probably recompile the original ed.c (dated May 13, 1975) and test that but
I expect it has the bug as well, but I'd have recreate the simulated v6
environment to do so which would take a few hours.

----------------------------------------------------------------
The above views are my own, not necessarily those of my employer.
Bill Webb (IBM AWD Palo Alto), (415) 855-4457).
UUCP: ...!uunet!ibmsupt!webb
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads