Description of problem: I am trying to set up drift on my Windows 7 64-bit desktop. The drift detection fails when getting the initial snapshot with this error in the agent logs: 2011-11-10 19:41:24,293 ERROR [pool-3-thread-2] (rhq.core.pc.drift.DriftDetector)- Drift detection failed: Illegal/unsupported escape sequence near index 4 (C:\Users\elladeon\Documents\work\redhat\JON\trunk\Admin_Config\en-US/(.*[^/]*)) ^ java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 4 (C:\Users\elladeon\Documents\work\redhat\JON\trunk\Admin_Config\en-US/(.*[^/]*)) ^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.escape(Unknown Source) at java.util.regex.Pattern.atom(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.group0(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.<init>(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at org.rhq.core.util.file.FileUtil.generateRegex(FileUtil.java:428) at org.rhq.core.pc.drift.FilterFileVisitor.<init>(FilterFileVisitor.java:86) at org.rhq.core.pc.drift.DriftDetector.generateSnapshot(DriftDetector.java:417) at org.rhq.core.pc.drift.DriftDetector.run(DriftDetector.java:117) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source) at java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 2011-11-10 19:41:24,294 INFO [pool-3-thread-2] (rhq.core.pc.drift.DriftDetector)- Reverting snapshot for DriftDetectionSchedule[resourceId: 10001, driftDefinitionId: 0, driftDefinitionName: Template-File System] Path: C:\Users\elladeon\Documents\work\redhat\JON\trunk\Admin_Config\ Version-Release number of selected component (if applicable): Version: 4.2.0.JON300-SNAPSHOT Build Number: 19b0ceb How reproducible: Always. Steps to Reproduce: Create a drift definition for a Windows platform resource.
I tried a pathname without an underscore, and got a different parse error: http://pastebin.test.redhat.com/67641 That was for C:\Users\elladeon\Documents\work\redhat\freeipa-guide\ipa-admin. I tried C:\Users\elladeon\Documents\work\test -- no hyphens or underscores -- and got the original error again. 2011-11-10 21:16:24,404 ERROR [pool-3-thread-1] (rhq.core.pc.drift.DriftDetector)- Drift detection failed: Illegal/unsupported escape sequence near index 4 (C:\Users\elladeon\Documents\work\test/(.*[^/]*))|(C:\Users\elladeon\Documents\work\test\drift/(.*[^/]*)) ^ java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 4 (C:\Users\elladeon\Documents\work\test/(.*[^/]*))|(C:\Users\elladeon\Documents\work\test\drift/(.*[^/]*)) ^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.escape(Unknown Source) at java.util.regex.Pattern.atom(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.group0(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.<init>(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at org.rhq.core.util.file.FileUtil.generateRegex(FileUtil.java:428) at org.rhq.core.pc.drift.FilterFileVisitor.<init>(FilterFileVisitor.java:86) at org.rhq.core.pc.drift.DriftDetector.generateSnapshot(DriftDetector.java:417) at org.rhq.core.pc.drift.DriftDetector.run(DriftDetector.java:117) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source) at java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Then I tried the short and simple C:\rhq\test and that worked. Detection ran as expected.
It turns out that this problem has been around since we initially introduced filtering with drift definitions. When a definition is created with filters, those filters are compiled into regular expressions. The regular expressions are then used to determine which files to includes/exclude for drift monitoring. The problem is that we are not escaping backslashes which are of course used in paths on Windows platforms. Jay and I have discussed this and decided to normalize on using forward slashes everywhere. We already do this in some places but not in the paths for the base directory or filters.
There was definitely support lacking for windows paths in the base directory and path filters. master commit 945cacd1ee63aa0a6a6743ffcbc941cda606d3cf Test Notes: Can be tested using any windows platform. Make sure you use filters.
release.x commit 63f8e66b055b487821151763e69119646ac352e5
Sorry, wrong release commit: release3.x commit 338e7cf8d267bd6da9891a7ed5cfab2dd8f1d6f1
okay ... this looks good on windows. 1) no errors on inital snapshot 2) i am using filters ... and that is working 4 test cases as follows: base dir path pattern ---------------------------------------------- c:\foo /mydir no pattern c:\foo /mydir txt c:\foo /mydir **\*.txt c:\foo ----- -------
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE