Subject: port-alpha/3450: fix for 64-bit bug in regex(3)
To: None <gnats-bugs@gnats.netbsd.org>
From: Ross Harvey <ross@teraflop.com>
List: netbsd-bugs
Date: 04/05/1997 23:23:13
>Number: 3450
>Category: port-alpha
>Synopsis: fix for 64-bit bug in regex(3)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Apr 5 23:35:02 1997
>Last-Modified:
>Originator: Ross Harvey
>Organization:
Avalon Computer Systems, Inc.
>Release: 1.2D 970326
>Environment:
NetBSD epsilon.teraflop.com 1.2D NetBSD 1.2D (e)
#5: Sat Mar 29 22:32:33 PST 1997
Alpha
>Description:
Fix provided for certain regex(3) features involving
expression engine opcodes>=16 that fail in the 64-bit
environment.
>How-To-Repeat:
run vi or ex on NetBSD-Alpha, type /\<o\> above some lines like:
how now brown cow
how now o brown cow
here is another o line
You won't match any o at all. Probably is in grep and others too.
>Fix:
Apply enclosed patch. Note, you could also just get rid of
all the longs, there aren't too many...this fix at least
makes the (incorrect) longs work, with a much smaller patch.
All it does is add L's to the constants that get shifted into
bit 31. It would probably also work to define them with an
(unsigned) cast included.
Apply patch in /usr/src/lib/libc/regex
--- original-regex2.h Sat Apr 5 20:47:20 1997
+++ regex2.h Sat Apr 5 21:02:30 1997
@@ -102,11 +102,11 @@
#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19<<OPSHIFT) /* begin word - */
-#define OEOW (20<<OPSHIFT) /* end word - */
+#define OOR1 (16L<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
+#define OOR2 (17L<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
+#define O_CH (18L<<OPSHIFT) /* end choice back to OOR1 */
+#define OBOW (19L<<OPSHIFT) /* begin word - */
+#define OEOW (20L<<OPSHIFT) /* end word - */
/*
* Structure for [] character-set representation. Character sets are
>Audit-Trail:
>Unformatted: