Bug 824129 - JON CLI - Parameters to exec command not parsed correctly when using quotes
Summary: JON CLI - Parameters to exec command not parsed correctly when using quotes
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 4.4
Hardware: i686
OS: Linux
unspecified
medium
Target Milestone: ---
: RHQ 4.5.0
Assignee: John Sanda
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 829309
Blocks: 826604
TreeView+ depends on / blocked
 
Reported: 2012-05-22 19:30 UTC by Jochen Cordes
Modified: 2013-09-01 10:17 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 826604 (view as bug list)
Environment:
Last Closed: 2013-09-01 10:17:02 UTC
Embargoed:


Attachments (Terms of Use)
Script with input redirection (195 bytes, application/x-shellscript)
2012-05-22 19:30 UTC, Jochen Cordes
no flags Details
The script that receives the parameters (131 bytes, text/javascript)
2012-05-22 19:33 UTC, Jochen Cordes
no flags Details
A library script (5.40 KB, text/javascript)
2012-05-22 19:36 UTC, Jochen Cordes
no flags Details

Description Jochen Cordes 2012-05-22 19:30:08 UTC
Created attachment 586140 [details]
Script with input redirection

Description of problem:

Parameters to exec command not parsed correctly when using quotes (single/double) around value

Version-Release number of selected component (if applicable):

RHQ Remoting Client 4.4.0.310BETA1

How reproducible:

Call a script with an index parameter in the exec command when using JON CLI in interactive mode

Steps to Reproduce:
1. Call a script that does input redirection including exec command
2.
3.
  
Actual results:

The value of the parameter as retrieved via args[0] contains the quotes and ends with character before the first space

Expected results:

The value of the parameter is the value between the quotes.

Additional info:

Comment 1 Jochen Cordes 2012-05-22 19:33:27 UTC
Created attachment 586141 [details]
The script that receives the parameters

Comment 2 Jochen Cordes 2012-05-22 19:36:40 UTC
Created attachment 586143 [details]
A library script

Comment 3 Mike Foley 2012-05-29 14:41:28 UTC
per BZ Triage 5/29/2012 (ccrouch, loleary, asantos, mfoley, myarborough) moving these to JON 3.1.1 or later

Comment 4 John Sanda 2012-05-31 23:33:24 UTC
I am not sure why, but we were treating both single and double quotes as regular words/symbols as opposed to quote delimiters. I have checked in a fix to master.

commit hash: 522ff41ba7

This commit fixes the immediate problem, but I believe that there is a larger, more fundamental problem that needs to be addressed. CLI code is JavaScript with the exception of a handful of built in commands. So we have the majority of code that is written and executed as JavaScript, and then we have a small fixed set of commands that executes as Java. Because of this we have multiple layers of parsing code. These multiple layers of parsers has led to this bug as well as bug 813912, and others. To make things even worse, not all of these built-in commands are available in batch mode. 

I strongly believe that the best solution is to completely do away with these built-in commands. The functionality provided by the built-in commands should be implemented within the framework in which users operate; in other words, the functionality should be exposed via functions and methods of objects that are available in the script bindings. In so we doing, we can eliminate most if not all of these buggy parsing layers, provide a uniform and consistent syntax, and take better advantage of the features that JavaScript has to offer (if we so choose).

I will post this info to the devel list for additional feedback and based on that feedback open up another bug to track this.

Comment 5 John Sanda 2012-06-06 18:32:25 UTC
Added fix for bug 829309. The parsing changes now only take effect for the script arguments in the command line. The commit has been pushed to master.

commit hash: 5e8863403

Comment 6 Heiko W. Rupp 2013-09-01 10:17:02 UTC
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.


Note You need to log in before you can comment on or make changes to this bug.