The following reply was made to PR bin/169500; it has been noted by GNATS. From: Garrett Wollman <[email protected]> To: [email protected] Cc: [email protected] Subject: Re: bin/169500: /bin/expr improperly requires forward slash to be escaped Date: Wed, 27 Jun 2012 21:36:24 -0400 (EDT)
In article <[email protected]>, [email protected] writes: >According to my reading of Sections 2.8.3.1.1 and 2.8.3.1.2 of the ANSI/IEEE >standard 1003.2, a forward slash character (/) is an "ordinary" basic >regular expression (BRE) character, and as such can be used in a BRE alone >to match itself. IEEE Std.1003.2 was obsoleted by the publication of IEEE Std.1003.1-2001; your reference is at least fifteen years old. >As far as I can tell, backslash-escaping of this specific character >should not be required within BREs. Nothing to do with the BRE-ness. As the 2001 edition of the standard states (page 429, lines 16598-16599): A string argument is an argument that cannot be identified as an integer argument or as one of the expression operator symbols shown in the OPERANDS section. '/' is "one of the expression operator symbols shown", and thus is not permitted as the second (or first!) operand of the ':' operator, which must both be "string arguments" meeting this defintion. As the APPLICATION USAGE section states (same page, lines 16609ff): After argument processing by the shell, expr is not required to be able to tell the difference between an operator and an operand except by the value. If "$a" is '=', the command: expr $a = '=' looks like: expr = = = as the arguments are passed to expr (and they all may be taken as the '=' operator). -GAWollman -- Garrett A. Wollman | What intellectual phenomenon can be older, or more oft [email protected]| repeated, than the story of a large research program Opinions not shared by| that impaled itself upon a false central assumption my employers. | accepted by all practitioners? - S.J. Gould, 1993 _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "[email protected]"
