From owner-freebsd-bugs@FreeBSD.ORG Thu Jun 28 01:40:09 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36F4A1065670 for ; Thu, 28 Jun 2012 01:40:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 07D548FC0C for ; Thu, 28 Jun 2012 01:40:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5S1e8Ke007897 for ; Thu, 28 Jun 2012 01:40:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q5S1e8Q3007896; Thu, 28 Jun 2012 01:40:08 GMT (envelope-from gnats) Date: Thu, 28 Jun 2012 01:40:08 GMT Message-Id: <201206280140.q5S1e8Q3007896@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Garrett Wollman Cc: Subject: Re: bin/169500: /bin/expr improperly requires forward slash to be escaped X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Garrett Wollman List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 01:40:09 -0000 The following reply was made to PR bin/169500; it has been noted by GNATS. From: Garrett Wollman 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