Date: Thu, 28 Jun 2012 01:40:08 GMT From: Garrett Wollman <wollman@hergotha.csail.mit.edu> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/169500: /bin/expr improperly requires forward slash to be escaped Message-ID: <201206280140.q5S1e8Q3007896@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/169500; it has been noted by GNATS. From: Garrett Wollman <wollman@hergotha.csail.mit.edu> To: rfg@tristatelogic.com Cc: freebsd-gnats-submit@freebsd.org 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 <20120627214105.A1EA35081B@segfault.tristatelogic.com>, rfg@tristatelogic.com 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 wollman@bimajority.org| 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206280140.q5S1e8Q3007896>