Path: csiph.com!tncsrv06.tnetconsulting.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: quote removal issues within character class Date: Wed, 13 Nov 2019 09:56:57 -0500 Lines: 38 Approved: bug-bash@gnu.org Message-ID: References: <68562615-8764-3b33-37d7-d07355a37292@case.edu> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1573657027 31291 209.51.188.17 (13 Nov 2019 14:57:07 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: =?UTF-8?B?T8SfdXo=?= , bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1573657020; bh=CL7xxr+ThBOG93WCyLPHYZu0fnTAtyvYA6yEY9kqrLE=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=nWaXgI08G2dA5tGqwfjDRxpQU8pxjBLxTrVHksm4+Yobk4eTaq5Lv96eQvjuyDm0Xf JQvzyqJn5aRCZll72RKVk8N2bKU12yIjUbeoXD6Uwt1gnoUEbnJyq+rxwLgthbHVX89 EPXLk3+eUfnTIQNqsdbW1e5NI/c2ucvSlvTNyf3ezMwxSRBhSq9GPx5iqDtdj03REzz f2Cqgn2GK8LVNlE2W6X4P9matIX6HD4emPmvCrqjYj23gWGVc8ZQ+4ZYxA0mxNt5mZq TiVVNa6VXdLMmt7At7E7t8Z+t1drNSOLfy2vbnGCWnlmCEFlC22yqm+USRVw4swDk4f FcFJsOng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1573657019; bh=oX0d8BEJVSXaiU4fcjQpzAloWxxsiFFWrJXwWi12Cvw=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=pou8xdMHLdTvTaPJ7TU5G8NRViDJ92kexc+mjyrcaDh4jdQ5Y87ZPbX9Dkd7me3Qk3 tINRZ5POrdqhN4X+TBWpySYVdYGH2bOEBOeGQOewPjexDehl+0JG5HoUT+BpL92Ic2o p2vZp+kcMqORdQLpufN0yFwgJ8tTWtrkiqLFQwmT/YdxQlyhcAXo6Ur3p9S4e/2yKiH UHVzDbdsM0wtG0k7AY1kt9oztKPh56V+htEiqohPhEsKez77m2ArXmKpoKUwP9jv2Nt 2jnJCXaAo36WHWo3OG2NoqIldXI/3rWmc3wFnIprgQcvlMHeEyYQ6Ky541jD7QVE2CQ XBA8EV/A== User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 In-Reply-To: Content-Language: en-US X-Junkmail-Status: score=7/90, host=mpv3-2015.case.edu X-Junkmail-PrAS-Raw: score=7/90, refid=2.7.2:2019.11.13.133616:17:7.944, ip=, rules=DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __PHISH_SPEAR_SUBJ_ALERT, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_MAILTO, __URI_WITH_PATH, __URI_NO_WWW, __CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __BODY_NO_MAILTO, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1400_1499, __MIME_TEXT_P1, __MIME_TEXT_ONLY, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 129.22.103.194 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <68562615-8764-3b33-37d7-d07355a37292@case.edu> X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:15669 On 11/8/19 4:50 PM, Oğuz wrote: > v=foo > echo ${v#[[:"lower":]]} > > should print oo, but it prints foo instead. This is reproducible on bash >> 4.4 > > Plus > > case foo in (*[![:"lower":]]*) echo bar; esac > > prints bar, while The idea is that at this point in command processing, quote removal hasn't been performed. According to the abstract model the shell uses for word expansions, that means the double quotes are still present in the word, and `"lower"' is not the same as `lower'. There was a recent extensive discussion of this and other points on the posix mailing list, and, as kre said, the committee has decided to make this a special case. I changed this about a month ago, and the chage is in the devel branch. > case foo in (*[![":lower":]]*) echo bar; esac > > doesn't print anything. And this is only reproducible on bash >5.0 This is an invalid character class, since a class has to begin with the two-character sequence `[:'. The intervening double quote causes that test to fail (this case is not so special, it seems). The first `]' then terminates the bracket expression, so th string has to contain at least a `]' to have a possibility of matching. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/