Bug 535606 (RHQ-2284)

Summary: Browse Resources search and DynaGroups don't escape special characters properly
Product: [Other] RHQ Project Reporter: Charles Crouch <ccrouch>
Component: No ComponentAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1.2CC: cwelton, hbrock, jshaughn
Target Milestone: ---Keywords: SubBug
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-2284
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-09 15:29:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 542828    
Bug Blocks: 565628    

Description Charles Crouch 2009-07-31 18:31:00 UTC
Problem: Assume some of the resources in your inventory contain the "_" character. Trying to search for those resources using a term which include "_" in either the Browse Resources page or via a Dyna group doesn't show any matching resources.

We should make sure to test the fix with any other special characters e.g. *, %, &, \, / and also across all supported database options


(1:11:35 PM) joseph: yeah, we may not be escaping special chars properly
(1:11:41 PM) joseph: i'm looking at code now ccrouch
(1:11:53 PM) ghinkle: um _ is a special character in jpql
(1:12:05 PM) ghinkle: it means match one character
(1:12:23 PM) ccrouch: some escaping is in order i think
(1:13:51 PM) joseph: go here http://jon06.mw.lab.eng.bos.redhat.com:7080/admin/test/hibernate.jsp
(1:14:01 PM) joseph: execute select res.name from Resource res where res.name like '%\_3%'
(1:16:02 PM) joseph: but this works   select res.name from Resource res where res.name like '%\_3%' escape '\'
(1:16:26 PM) joseph: so, our PersistenceUtility is properly escaping underscores, but we're not giving the hint for what the escape character is
(1:17:30 PM) ccrouch: ok, sounds like a jira :-)
(1:17:39 PM) ccrouch: but i guess for now there is no workaround?
(1:17:43 PM) ccrouch: just avoid using _ ?
(1:17:53 PM) joseph: lemme reference some doco
(1:23:23 PM) joseph: don't see any workarounds
(1:24:46 PM) ccrouch: joseph: ok thanks for investigating
(1:25:15 PM) joseph: can't believe this has been like that for...well...ever

Comment 1 Charles Crouch 2009-07-31 18:37:35 UTC
(1:33:39 PM) joseph: ccrouch: and now criteria queries too

Comment 2 Red Hat Bugzilla 2009-11-10 21:01:28 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2284


Comment 3 wes hayutin 2010-02-16 16:53:00 UTC
Temporarily adding the keyword "SubBug" so we can be sure we have accounted for all the bugs.

keyword:
new = Tracking + FutureFeature + SubBug

Comment 4 wes hayutin 2010-02-16 16:58:32 UTC
making sure we're not missing any bugs in rhq_triage

Comment 5 Corey Welton 2010-11-22 19:37:05 UTC
jshaughn - is this fixed? add commit and close out

Comment 6 Jay Shaughnessy 2010-11-23 14:08:56 UTC
This should have gotten fixed a while back when I overhauled the ESCAPE clause
stuff in our Criteria query generator.  But since this fix would be a side-effect of that work I'd say it should go to QA for
verification and not yet be closed.