Article View: net.bugs.usg
Article #317An expr bug/misfeature
From: Guy Harris
Date: Wed, 18 Jun 1986 23:53
Date: Wed, 18 Jun 1986 23:53
34 lines
1858 bytes
1858 bytes
> > < Nice fix. Try "expr -5 * ---6". The problem cannot be correctly fixed
> > < w/out going all out and implementing UMINUS is the yacc grammar. Any
> > < takers?
>
> > (fixed in S5) Sorry, but I haven't looked at the expr code to see what
> > the real fix was.
>
> It may have been to rewrite the whole thing in C. It had been so rewritten
> as of S3, although the S3 version still maintained the old "index",
> "substr", and "length" operators from V7, which were undocumented and caused
> confusion if those names appeared as operands. S5 ripped them out.
Unfortunately, they did NOT rip out the "match" operator, which is a prefix
synonym for the infix ":" operator. As such,
expr match : "[a-z]atch"
gets a "syntax error" message, while
expr hatch : "[a-z]atch"
doesn't. The person who deleted them must have been confused, and figured
"match" had to stay in because its infix equivalent was still there.
Of course, even if you rip "match" out,
expr : : "[a-z]atch"
still gets a "syntax error", so "expr" can't do mattern matching on
arbitrary strings. Be warned.
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy@sun.com (or guy@sun.arpa)
Technical Details
Message-ID:
<4229@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!husc6!harvard!think!nike!lll-crg!lll-lcc!pyramid!decwrl!sun!guyReferences:
<270@cirl.UUCP> <219@decvax.UUCP> <2795@pegasus.UUCP> <4143@sun.uucp>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!husc6!harvard!think!nike!lll-crg!lll-lcc!pyramid!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.bugs.usg,net.bugs.4bsd,net.bugs.v7,net.bugs.2bsd Subject: An expr bug/misfeature Message-ID: <4229@sun.uucp> Date: Wed, 18-Jun-86 19:53:58 EDT Article-I.D.: sun.4229 Posted: Wed Jun 18 19:53:58 1986 Date-Received: Sat, 21-Jun-86 08:13:56 EDT References: <270@cirl.UUCP> <219@decvax.UUCP> <2795@pegasus.UUCP> <4143@sun.uucp> Distribution: net Organization: Sun Microsystems, Inc. Lines: 34