Bug 12593 - search facets die with regex error if biblio has square brackets in fields
Summary: search facets die with regex error if biblio has square brackets in fields
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low critical (vote)
Assignee: Dobrica Pavlinusic
QA Contact: Testopia
URL:
Keywords:
Depends on: 12151
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-17 10:29 UTC by Dobrica Pavlinusic
Modified: 2019-06-27 09:24 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12593 - search facets die with regex error if biblio has square brackets in fields (1.21 KB, patch)
2014-07-17 10:32 UTC, Dobrica Pavlinusic
Details | Diff | Splinter Review
Bug 12593 - search facets die with regex error if biblio has square brackets in fields (1.64 KB, patch)
2014-07-17 13:58 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[PASSED QA] Bug 12593 - search facets die with regex error if biblio has square brackets in fields (1.71 KB, patch)
2014-07-18 12:01 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Dobrica Pavlinusic 2014-07-17 10:29:29 UTC
It's quite common to have [something] within facet data, and it produces following error:

Unmatched [ in regex; marked by <-- HERE in m/^[ <-- HERE Život i običaji narodni ;$/ at /srv/koha//C4/Search.pm line 535. 

This problem was intoduced in Bug 12151
Comment 1 Dobrica Pavlinusic 2014-07-17 10:32:32 UTC Comment hidden (obsolete)
Comment 2 Marcel de Rooy 2014-07-17 12:49:24 UTC
I tested with an author name including [something] as well as [something
So, the second case included an unmatched [ in regex, but I did not get the error (on current master). I see the [ in the facets.

Could you please add some more details to reproduce this? Does it depend on specific perl version?
Comment 3 Tomás Cohen Arazi 2014-07-17 13:58:06 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2014-07-18 11:25:07 UTC
(In reply to Tomás Cohen Arazi from comment #3)
> To test:
> - Created a bibliographic record, linked to an authority record (personal
> name). Did a search that returned the author as a facet.
> - Added a [ symbol to the author name.
> - Repeated the search
> => FAIL: "Unmatched [ in regex; marked by <-- HERE in m/^[ <-- HERE"

I didn't reproduce neither.
When I relaunch the search, the facet does not appear anymore in the facet list, that's all. I didn't get any error.
Comment 5 Kyle M Hall 2014-07-18 12:01:04 UTC
Created attachment 29824 [details] [review]
[PASSED QA] Bug 12593 - search facets die with regex error if biblio has square brackets in fields

It's quite common to have [something] within facet data, and it produces following error:

Unmatched [ in regex; marked by <-- HERE in m/^[ <-- HERE

This problem was intoduced in Bug 12151 but is trivial to fix.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Good catch.

To test:
- Created a bibliographic record, linked to an authority record (personal name). Did a search that returned the author as a facet.
- Added a [ symbol to the author name.
- Repeated the search
=> FAIL: "Unmatched [ in regex; marked by <-- HERE in m/^[ <-- HERE"
- Apply the patch
- Retry the search
=> SUCCESS: No error, bracket shows correctly.

Passes koha-qa.pl too.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Tomás Cohen Arazi 2014-07-18 15:52:29 UTC
Patch pushed to master.

Thanks Dobrica!
Comment 7 Jonathan Druart 2014-07-18 16:03:52 UTC
It would be good to know how reproduce this issue.
Comment 8 Tomás Cohen Arazi 2014-07-18 16:05:01 UTC
(In reply to Jonathan Druart from comment #7)
> It would be good to know how reproduce this issue.

On comment #3 I explained the steps I used to reproduce it.
Comment 9 Jonathan Druart 2014-07-21 07:54:51 UTC
(In reply to Tomás Cohen Arazi from comment #8)
> (In reply to Jonathan Druart from comment #7)
> > It would be good to know how reproduce this issue.
> 
> On comment #3 I explained the steps I used to reproduce it.

I have seen them, but that didn't help me. It seems working for both of you, so I suppose the patch works :)
Looking at it, the changes looks consistent.
Comment 10 Marcel de Rooy 2014-07-21 08:04:26 UTC
(In reply to Jonathan Druart from comment #9)
> (In reply to Tomás Cohen Arazi from comment #8)
> > (In reply to Jonathan Druart from comment #7)
> > > It would be good to know how reproduce this issue.
> > 
> > On comment #3 I explained the steps I used to reproduce it.
> 
> I have seen them, but that didn't help me. It seems working for both of you,
> so I suppose the patch works :)
> Looking at it, the changes looks consistent.

I could not reproduce this problem too. Could it be a matter of some sysprefs, or perl version?
Comment 11 Dobrica Pavlinusic 2014-07-21 13:16:08 UTC
In our case, we have in 440$a "[ Život i običaji ;" which is probably a mistake, but does trigger this bug.

I don't think we modified any system preferences related to facets.
Comment 12 Tomás Cohen Arazi 2014-07-21 13:36:42 UTC
I have Ubuntu 14.04 (amd64). This implies Perl 5.18 and Apache 2.4. For testing the patch I did:

> DROP DATABASE koha_devel;
> CREATE DATABASE koha_devel;

Run the webinstaller (mine is a DOM+MARC21 setup). Selected all the sample data. Added some sample records I have so facets are build.

Made a search, 
Edited a Personal Name authority (appearing on the facets) adding '[' in the middle of the name.

Reindexed, launched the search
=> BROKEN
Comment 13 Galen Charlton 2014-09-23 20:53:16 UTC
Pushed to 3.16.x for inclusion in 3.16.4.
Comment 14 Fridolin Somers 2015-01-23 12:48:10 UTC
Bug 12151 not in 3.14.x

I set as resolved