+++ 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)\...
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...
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.
master commit db072ef663ee9d9e276971e1cce9021e26cafef5 - Add support for Windows allowance of parentheses in directory names.
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.