Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E3D2F166062 for ; Tue, 22 Aug 2017 03:50:06 +0200 (CEST) Received: (qmail 62983 invoked by uid 500); 22 Aug 2017 01:50:05 -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 62959 invoked by uid 99); 22 Aug 2017 01:50:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Aug 2017 01:50:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 0B055C0480 for ; Tue, 22 Aug 2017 01:50:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id x92hNGBWDpka for ; Tue, 22 Aug 2017 01:50:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id E34D75FBE2 for ; Tue, 22 Aug 2017 01:50:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id F1BFBE0C1D for ; Tue, 22 Aug 2017 01:50:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4983525385 for ; Tue, 22 Aug 2017 01:50:00 +0000 (UTC) Date: Tue, 22 Aug 2017 01:50:00 +0000 (UTC) From: "Glenn McCall (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CLI-275) Cannot get a full quoted argument through MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLI-275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16136139#comment-16136139 ] Glenn McCall edited comment on CLI-275 at 8/22/17 1:49 AM: ----------------------------------------------------------- Agreed, if the Command Interpreter has processed the quotes and presented an argument in quotes to CLI, then CLI should retain them. By not doing so, this creates an awfully confusing scenario for end users trying to explain those familiar with escaping quoted arguments (to bash for example) to pass quotes to a program only to have different rules apply for an apache-CLI based program. Some other scenarios that produce "strange results" when invoked from bash (format is as entered on command line -> as output from CLI followed by notes explaining the input string in parenthesis. Correctness or otherwise is as compared to echo when run on bash - why? because this is how we explain quoting to end users - try your escaped string in echo to see how it will get passed through to an application. Here is the "strange results list": {code:other} "~" -> ~ (this is correct) \"~\" -> ~ (INcorrect) '"~"' -> ~ (single quote - double quote - tilde - double quote - single quote => INcorrect) "'"~"'" -> '~' (double - single - double - tilde - double - single - double => correct - surprisingly to me, echo produces the same result.) "'~'" -> '~' (double-single-tilde-single-double) -> Correct) '""' -> empty string (single-double-double-single) -> INcorrect) "''" -> '' (double-single-single-double -> single-single -> Correct) "\"~\"" -> ~ (double - esc double - tilde - esc double - double -> INcorrect). "\\"~\\"" -> \~\ (double - esc backslash - double - tilde - esc backslash - double -> correct) {code} it seems that CLI has some sort of vendetta against double quotes. was (Author: glennm): Agreed, if the Command Interpreter has processed the quotes and presented an argument in quotes to CLI, then CLI should retain them. By not doing so, this creates an awfully confusing scenario for end users trying to explain those familiar with escaping quoted arguments (to bash for example) to pass quotes to a program only to have different rules apply for an apache-CLI based program. Some other scenarios that produce "strange results" when invoked from bash (format is as entered on command line -> as output from CLI followed by notes explaining the input string in parenthesis. Correctness or otherwise is as compared to echo when run on bash - why? because this is how we explain quoting to end users - try your escaped string in echo to see how it will get passed through to an application. Here is the "strange results list": {code:text} "~" -> ~ (this is correct) \"~\" -> ~ (INcorrect) '"~"' -> ~ (single quote - double quote - tilde - double quote - single quote => INcorrect) "'"~"'" -> '~' (double - single - double - tilde - double - single - double => correct - surprisingly to me, echo produces the same result.) "'~'" -> '~' (double-single-tilde-single-double) -> Correct) '""' -> empty string (single-double-double-single) -> INcorrect) "''" -> '' (double-single-single-double -> single-single -> Correct) "\"~\"" -> ~ (double - esc double - tilde - esc double - double -> INcorrect). "\\"~\\"" -> \~\ (double - esc backslash - double - tilde - esc backslash - double -> correct) {code} it seems that CLI has some sort of vendetta against double quotes. > Cannot get a full quoted argument through > ----------------------------------------- > > Key: CLI-275 > URL: https://issues.apache.org/jira/browse/CLI-275 > Project: Commons CLI > Issue Type: Bug > Reporter: Csaba Skrabak > > CLI-185 has been partially fixed but user still cannot pass in an argument like "x" (the whole argument surrounded by one pair of double quotes.) If user enters \"x\" then the quotes get eaten (btw. WHY THE HECK?!). But if user enters \"\"x\"\" then both pairs of quotes are left intact. > The idea of removing the quotes is plain wrong, should be either forgotten entirely or the argument should be parsed properly (rather than tinkering from bug to bug with variations of find/substring call constructs) with the possibility to escape and quote quotation marks. > Blocks: PHOENIX-3710 -- This message was sent by Atlassian JIRA (v6.4.14#64029)