Bug 748903

Summary: Systems advanced search: search term field too limited in length
Product: [Community] Spacewalk Reporter: Sven Mueller <sven-redhat>
Component: WebUIAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.5CC: slukasik
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-22 16:49:21 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:    
Bug Blocks: 723481    
Attachments:
Description Flags
I think this would solve it (mostly) none

Description Sven Mueller 2011-10-25 14:30:37 UTC
Description of problem:

While tracking security updates (more importantly, during security audits), we sometimes need to search for hosts that have a specific package installed, but not the most recent release. This is meant as a way to verify the systems are really up to date (and don't have a package left over from a time before we introduced spacewalk or something else.
This search can easily be done in the web interface with an advanced search, searching the field "installed packages", searching (for example) for:

bash version:3.2 -release:32.el5 

Which would list all systems that have bash 3.2 installed (with CentOS5, this is obviously the case), but not release 32.el5. 

This specific query works, but it is near the limit. When searching for mysql-server for example, the field is too short (maxlength ist 36).



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

1.5


How reproducible:

Try to Enter a search term longer than 36 characters.


Actual results:

Entry of longer search terms not possible

Expected results:

(almost) arbitrary length search terms should be possible. 

Additional info:

A similar search on commandline or with spacecmd would also be nice. We were not able to find one.

Comment 1 Sven Mueller 2011-10-26 08:08:11 UTC
Created attachment 530243 [details]
I think this would solve it (mostly)

I'm not a java programmer (but I know java syntax enough to read programs), so I got the git tree and checked the sources best I could. 
I patched systemsearch.jsp (see attached patch), and found no unintended side effects. I think it would even be no problem to drop the maxlength parameter altogether.

Actually, patching this file alone didn't do anything (on the live system, without recompiling), I still get the web page with maxlength="36" for the search_string parameter.

I try to get my system to rebuild spacewalk-java, but I experience several problems installing the build dependencies.

Comment 2 Tomas Lestach 2011-10-26 11:23:24 UTC
Hey Sven,
there's one more point:
code/src/com/redhat/rhn/frontend/action/systems/validation/systemSearchForm.xsd
that is used for input validation. So, if we would drop the maxlegth completely, you would get following validation error on webui, when entering string longer than 100chars:
"Search string cannot be greater than 100 characters (Note: double byte chars are not supported)."
So, I just increased the limit just to 100 chars.

spacewalk.git: 2df5137ea5be18beb58f75d30864bb5f215cffb5

For the command line option, try to use system.search.* APIs.

Comment 3 Sven Mueller 2011-10-27 10:49:59 UTC
Hi Thomas.

While I think 100 characters should be OK for us, I'm wondering where the limit comes from. All relevant database fields seem to be at least 128 characters in size (system names can have at least 200 characters IIRC from the SQL schema). So unless there are restrictions somewhere else, which enforce a lower limit, I would go to 128 characters at least (for both the systemSearchForm.xsd and the systemsearch.jsp files). Using arbitrarily low limits where there is no technical reason seems wrong to me, at least anywhere outside the database design.

Anyhow: Thanks a lot for taking on this bug so quickly.
One question though: Will this be in Spacewalk 1.6?

Regards,
Sven

Comment 4 Milan Zázrivec 2011-12-22 16:49:21 UTC
Spacewalk 1.6 has been released.