Bug 824129 - JON CLI - Parameters to exec command not parsed correctly when using quotes
JON CLI - Parameters to exec command not parsed correctly when using quotes
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
i686 Linux
unspecified Severity medium (vote)
: ---
: RHQ 4.5.0
Assigned To: John Sanda
Mike Foley
Depends On: 829309
Blocks: 826604
  Show dependency treegraph
Reported: 2012-05-22 15:30 EDT by Jochen Cordes
Modified: 2013-09-01 06:17 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 826604 (view as bug list)
Last Closed: 2013-09-01 06:17:02 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Jochen Cordes 2012-05-22 15:30:08 EDT
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

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
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 15:33:27 EDT
Created attachment 586141 [details]
The script that receives the parameters
Comment 2 Jochen Cordes 2012-05-22 15:36:40 EDT
Created attachment 586143 [details]
A library script
Comment 3 Mike Foley 2012-05-29 10:41:28 EDT
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 19:33:24 EDT
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 14:32:25 EDT
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 06:17:02 EDT
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.