Bug 827634 - Unable to enter a Drift Detection Definition Base Directory fileSystem path that contains parenthesis
Summary: Unable to enter a Drift Detection Definition Base Directory fileSystem path t...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core UI, drift
Version: 4.4
Hardware: All
OS: All
urgent
high
Target Milestone: ---
: RHQ 4.5.0
Assignee: Jay Shaughnessy
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: 827633
TreeView+ depends on / blocked
 
Reported: 2012-06-01 22:28 UTC by Larry O'Leary
Modified: 2013-09-01 10:01 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 827633
Environment:
JON 3.0.1 and JON 3.1.0.Beta1 Tested in Linux
Last Closed: 2013-09-01 10:01:57 UTC
Embargoed:


Attachments (Terms of Use)

Description Larry O'Leary 2012-06-01 22:28:26 UTC
+++ This bug was initially created as a clone of JON Product Bug #827633 +++

Description of problem:
When attempting to set up a drift definition for monitoring an application on Windows, the UI does not allow the user to enter a path which contains a parenthesis.

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

How reproducible:
Always

Steps to Reproduce:
1.  Install JON system
2.  Create a test directory that contains a parenthesis

        cd ${TESTENV_DIR}
        mkdir -p "Program Files (x86)"/test/for/drift

3.  Add some files to the test directory

        cd ${TESTENV_DIR}
        touch "Program Files (x86)"/test/for/drift/file01.txt
        touch "Program Files (x86)"/test/for/drift/file02.txt
        echo "A file with only one line of text" >>"Program Files (x86)"/test/for/drift/file02.txt

4.  Start JON system
5.  Import platform into inventory
6.  Create a **Resource Drift Detection Definition** for the newly imported platform resource

    1.  Navigate to the platform resource's *Drift > Definitions* tab
    2.  Click the **New** button
    3.  Select **Drift Definition Template** `Template-File System`
    4.  Click **Next**
    5.  Set the following values:

        *   **Drift Definition Name:** `Path with parenthesis`
        *   **Drift Definition Description:** `Monitor a file system path that contains parenthesis () in its name for drift.`
        *   **Enabled:** `Yes`
        *   **Attached to Template:** `Yes`
        *   **Drift Handling Mode:** `normal``
        *   **Pinned:** `No`
        *   **Interval:** `90`
        *   **Base Directory:**
            *   **Value Context:** `fileSystem`
            *   **Value Name:** <THE FULL PATH CREATED EARLIER WHICH CONTAINS ( and/or )>
        *   **Includes:** **Leave empty**
        *   **Excludes:** **Leave empty**
        
        Please note that this fails due to the bug. The **Base Directory/Value Name** value will show as invalid due to the `(` and/or `)`


        To workaround this bug:

        *   **Base Directory:**
            *   **Value Context:** `fileSystem`
            *   **Value Name:** <THE ROOT PATH UP TO THE DIRECTORY THAT CONTAINS THE ( and/or )>
        *   **Includes:**
            *   **Path:** `.`
            *   **Pattern:** `Program Files ?x86?/test/for/drift/**`
        *   **Excludes:** **Leave empty**

    6.  Click **Finish**
  
Actual results:
Unable to complete step 6.6. because **Base Directory > Value Name** reports "Invalid Value"

Expected results:
The Drift Detection Definition should have been saved and a snapshot properly created.

Additional info:
This affects other valid file system characters as well. Parenthesis is a pretty bad offender though because Windows systems use (x86) in file paths to denote 32-bit versions of applications and libraries:

 C:\Program Files (x86)\...
 C:\Windows\System (x86)\...
 C:\Windows (x86)\...

Comment 2 Jay Shaughnessy 2012-06-06 18:20:19 UTC
I have a bad feeling about this due to the fact that parens are meaningful in the underlying regex stuff.  I'll take a look...

Comment 3 Larry O'Leary 2012-06-06 19:17:42 UTC
Escaping the input for the regex is the safest thing to do. This user input should be treated the same as user input being used in a database  query. I thought the Java regex utility included a utility to escape input for the regex but perhaps I am thinking of another library.

Comment 4 Jay Shaughnessy 2012-06-07 18:33:30 UTC
master commit db072ef663ee9d9e276971e1cce9021e26cafef5
- Add support for Windows allowance of parentheses in directory names.

Comment 5 Heiko W. Rupp 2013-09-01 10:01:57 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.