Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 94836 invoked from network); 15 Jun 2009 15:24:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jun 2009 15:24:21 -0000 Received: (qmail 77880 invoked by uid 500); 15 Jun 2009 15:24:32 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 77793 invoked by uid 500); 15 Jun 2009 15:24:31 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 77783 invoked by uid 99); 15 Jun 2009 15:24:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2009 15:24:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2009 15:24:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 94CA6234C055 for ; Mon, 15 Jun 2009 08:24:07 -0700 (PDT) Message-ID: <938433390.1245079447608.JavaMail.jira@brutus> Date: Mon, 15 Jun 2009 08:24:07 -0700 (PDT) From: "Emmanuel Bourg (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (CLI-185) Commons CLI incorrectly stripping leading and trailing quotes In-Reply-To: <1305584945.1244638567563.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CLI-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719594#action_12719594 ] Emmanuel Bourg commented on CLI-185: ------------------------------------ The single quotes are never stripped, it's only the double quotes. I tried to remove the stripping, it broke two tests: - test15648 in BugsTest: that's the test of CLI-22, it checks if the quotes of an argument are removed after the parsing. This can be easily changed. - testWorkaround2 in BugCLI148Test: this is the test for CLI-148, this one is more tricky to fix. Is the workaround introduced in CLI-148 worth keeping? Is it possible to keep the workaround without messing with other cases like the one exposed by Einar? > Commons CLI incorrectly stripping leading and trailing quotes > ------------------------------------------------------------- > > Key: CLI-185 > URL: https://issues.apache.org/jira/browse/CLI-185 > Project: Commons CLI > Issue Type: Bug > Components: Parser > Affects Versions: 1.1, 1.2 > Environment: Darwin dator 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386 > GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0) > and > Linux build-einarmr 2.6.9-023stab048.4-smp #1 SMP Fri Jul 11 18:50:44 MSD 2008 x86_64 x86_64 x86_64 GNU/Linux > GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu) > Reporter: Einar M R Rosenvinge > Fix For: 1.3 > > > org.apache.commons.cli.Parser.processArgs() calls Util.stripLeadingAndTrailingQuotes() for all argument values. IMHO this is incorrect and totally broken. > It is trivial to create a simple test for this. Output: > $ java -cp target/clitest.jar Clitest --balloo "this is a \"test\"" > Value of argument balloo is 'this is a "test'. > The argument 'balloo' should indeed keep its trailing double quote. It is what the shell gives it, so don't try to do something clever to it. > The offending code was committed here: > http://svn.apache.org/viewvc?view=rev&revision=129874 > and has been there for more than 6 years (!). Why was this committed in the first place? > The fix is trivial, just get rid of Util.stripLeadingAndTrailingQuotes(), and consequently avoid calling it from Parser.processArgs(). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.