Description of problem: When using a path for the Includes/Excludes property for a Drift Detection Definition, the drift snapshot is empty if the path entered contains a trailing file separator (/ or \). In the relative sense, all three of the following are equal: . ./ / When this is appended to a base directory/path of: /tmp/some The result would become: /tmp/some/. /tmp/some/./ /tmp/some// Again, all three are identical, however, only the first one works: . -or- /tmp/some/. And the remaining two fail: ./ -or- /tmp/some/./ / -or- /tmp/some// Version-Release number of selected component (if applicable): 4.4.0 How reproducible: Always Steps to Reproduce: 1. Install JON system 2. Create a test directory that contains a parenthesis cd /tmp mkdir -p some/dir/for/drift 3. Add some files to the test directory cd /tmp touch some/dir/for/drift/file01.txt touch some/dir/for/drift/file02.txt echo "A file with only one line of text" >>some/dir/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:** `Relative Path Pattern` * **Drift Definition Description:** `A drift path which uses a pattern that contains path alias .` * **Enabled:** `Yes` * **Attached to Template:** `Yes` * **Drift Handling Mode:** `normal`` * **Pinned:** `No` * **Interval:** `10` * **Base Directory:** * **Value Context:** `fileSystem` * **Value Name:** `/tmp/some` * **Includes:** * **Path:** *either* `./` *or* `/` * **Pattern:** `dir/for/drift/**` * **Excludes:** **Leave empty** 6. Click **Finish** 7. Wait for drift detection to occur for the newly created drift or use **Detect Now** Snapshot should reflect 0 8. Click on the **Pin** button to view the contents of the drift snapshot Actual results: The snapshot is empty Expected results: The snapshot should contain: dir/for/drift |-- file01.txt `-- file02.txt Additional info: When directory traversal occurs it is normal and expected that a user will include the trailing slash (/). When building the path using base directory, relative base, and file or directory pattern, special consideration should be given to what constitutes a path and the fact that drift expects it to be relative. Therefore, all of the following should be treated as the same: /tmp/some/. <-- . /tmp/some/./ <-- ./ /tmp/some// <-- / /tmp/some/ <-- <null>
I agree that they *should* be equivalent but I remember the coding for this to be somewhat tricky. We may need to instead convert all of these to just be "." at input time.
Master commit db072ef663ee9d9e276971e1cce9021e26cafef5 - Add support for more flexible specification of the drift base directory in a Drift Filter. - Add relevant tests for new features.
There seems to still be a problem on Linux. Looking further.
master commit 00ea14c228bd08d6572d0f17ef8040e447b9a0dd There were two ways to go here. One was to add special case handling for the various filter paths that equate to ".". The other was to normalize in the Filter constructor. Since I tried option 1 and missed a spot in my first try to fix it, I've now opted for option 2. The downside is only that what the user types may get normalized to ".". But I added some more description text to state as much. Also, existing Filter paths using "/" or "./" will need to be updated to "." manually, but I doubt there are any out there currently since it wasn't working.
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.