Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C772C200B32 for ; Wed, 8 Jun 2016 22:34:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C6630160A0E; Wed, 8 Jun 2016 20:34:22 +0000 (UTC) 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 23437160A35 for ; Wed, 8 Jun 2016 22:34:21 +0200 (CEST) Received: (qmail 73936 invoked by uid 500); 8 Jun 2016 20:34:21 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 73842 invoked by uid 99); 8 Jun 2016 20:34:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2016 20:34:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id EE9642C14F8 for ; Wed, 8 Jun 2016 20:34:20 +0000 (UTC) Date: Wed, 8 Jun 2016 20:34:20 +0000 (UTC) From: "Matt Peterson (JIRA)" To: notifications@accumulo.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (ACCUMULO-4336) Command line interpreter escaping issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 08 Jun 2016 20:34:22 -0000 Matt Peterson created ACCUMULO-4336: --------------------------------------- Summary: Command line interpreter escaping issues Key: ACCUMULO-4336 URL: https://issues.apache.org/jira/browse/ACCUMULO-4336 Project: Accumulo Issue Type: Bug Components: shell Reporter: Matt Peterson Priority: Minor To see the problem, add the following unit test. It will fail. {code:title=ShellTest.java|borderStyle=solid} Test public void scanEscapedQuote() throws Exception { exec("createtable test", true); exec("insert \\\" f q v", true); exec("scan", true, "\" f: q [] v"); // passes exec("scan -e \\\"", true, "\" f: q [] v"); // fails exec("deletetable test -f", true, "Table: [test] has been deleted"); } {code} It appears that the commons-cli library that is used for parsing commands will strip the leading \" from the option's value and return an empty string. {code:title=Parser.java, line 332|borderStyle=solid} opt.addValueForProcessing(Util.stripLeadingAndTrailingQuotes(str)); {code} For scans, an empty string as an end row will cause the scan to do nothing, which is a reasonable way to fail. For compactions, an empty string as an end row will cause the end row to be ignored, which can lead to accidentally initiating a compaction over much of a table. It is not possible to test the compaction issue with ShellTest because MockTableOperationsImpl does not do anything with compactions. But the problem code can be seen in the constructor for CompactRange: {code:title=CompactRange.java|borderStyle=solid} this.endRow = endRow.length == 0 ? null : endRow; {code} This code will treat an end row of \" as though there was no end row at all. The workaround for this is to use the \x22 instead of \". Additionally, some characters are not possible to include as either begin or end rows. For example, a ! character cannot be escaped but without escaping will crash the shell. -- This message was sent by Atlassian JIRA (v6.3.4#6332)