Summary: | System preference search doesn't work for search terms starting with * | ||
---|---|---|---|
Product: | Koha | Reporter: | Katrin Fischer <katrin.fischer> |
Component: | System Administration | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | trivial | ||
Priority: | P5 - low | CC: | chris, gmcharlt, mtompset, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 10131: Add a fallback if the pref search is not a valid regex
Bug 10131: Add a fallback if the pref search is not a valid regex Bug 10131: Add a fallback if the pref search is not a valid regex [PASSED QA] Bug 10131: Add a fallback if the pref search is not a valid regex |
Description
Katrin Fischer
2013-04-26 14:59:07 UTC
Created attachment 37818 [details] [review] Bug 10131: Add a fallback if the pref search is not a valid regex It's possible to search prefs using a regex. But it the regex is not correctly written, the app explodes. We should provide a fallback. Test plan: 0/ Does not apply the patch 1/ Search for sysprefs with "notes.*", note the number of results 2/ Search for *notes*, boom 3/ Apply the patch 4/ Repeat 1 and confirm you get the same number of results 5/ Repeat 2 and confirm you don't get the error anymore (In reply to Jonathan Druart from comment #1) > 1/ Search for sysprefs with "notes.*", note the number of results > 2/ Search for *notes*, boom > 3/ Apply the patch > 4/ Repeat 1 and confirm you get the same number of results > 5/ Repeat 2 and confirm you don't get the error anymore Actually, I've tried: black -- works (1 result) black.* -- works (1 result) .*black -- works (1 result) .*black.* -- works (1 result) black* -- works (1 result) *black -- runs (0 results) *black* -- runs (0 results) Perl 5.18.2 on Ubuntu 14.04 if that matters. Why the two with 0 results? Since bugzilla didn't tell me that Jonathan got my question, and since he provided the patch, I changed the bug so he is the assigned person. (In reply to M. Tompsett from comment #2) > (In reply to Jonathan Druart from comment #1) > > 1/ Search for sysprefs with "notes.*", note the number of results > > 2/ Search for *notes*, boom > > 3/ Apply the patch > > 4/ Repeat 1 and confirm you get the same number of results > > 5/ Repeat 2 and confirm you don't get the error anymore > > Actually, I've tried: > black -- works (1 result) > black.* -- works (1 result) > .*black -- works (1 result) > .*black.* -- works (1 result) > black* -- works (1 result) > *black -- runs (0 results) > *black* -- runs (0 results) > > Perl 5.18.2 on Ubuntu 14.04 if that matters. > Why the two with 0 results? Because it's not a well formatted regex. Created attachment 37825 [details] [review] Bug 10131: Add a fallback if the pref search is not a valid regex It's possible to search prefs using a regex. But it the regex is not correctly written, the app explodes. We should provide a fallback. Test plan: 0/ Does not apply the patch 1/ Search for sysprefs with "notes.*", note the number of results 2/ Search for *notes*, boom 3/ Apply the patch 4/ Repeat 1 and confirm you get the same number of results 5/ Repeat 2 and confirm you don't get the error anymore NOTE: As noted on comment #3, the kaboom is because of the leading * and not the following *, because 's*' is a valid regular expression, while '*n' is not. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Created attachment 37826 [details] [review] Bug 10131: Add a fallback if the pref search is not a valid regex It's possible to search prefs using a regex. But it the regex is not correctly written, the app explodes. We should provide a fallback. Test plan: 0/ Does not apply the patch 1/ Search for sysprefs with "notes.*", note the number of results 2/ Search for *notes*, boom 3/ Apply the patch 4/ Repeat 1 and confirm you get the same number of results 5/ Repeat 2 and confirm you don't get the error anymore NOTE: As noted on comment #4, the kaboom is because of the leading * and not the following *, because 's*' is a valid regular expression, while '*n' is not. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Created attachment 37920 [details] [review] [PASSED QA] Bug 10131: Add a fallback if the pref search is not a valid regex It's possible to search prefs using a regex. But it the regex is not correctly written, the app explodes. We should provide a fallback. Test plan: 0/ Does not apply the patch 1/ Search for sysprefs with "notes.*", note the number of results 2/ Search for *notes*, boom 3/ Apply the patch 4/ Repeat 1 and confirm you get the same number of results 5/ Repeat 2 and confirm you don't get the error anymore NOTE: As noted on comment #4, the kaboom is because of the leading * and not the following *, because 's*' is a valid regular expression, while '*n' is not. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Patch pushed to master. Thanks Jonathan! Pushed to 3.18.x will be in 3.18.6 |