If you try searching for a system preference with something like *black* you will get an ugly error message: Software error: Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE notes/ at /usr/share/koha/intranet/cgi-bin/admin/preferences.pl line 255.
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