[Bug 8350] New: $search = '0' or 0 will fail to affect SQL statement correctly in C4::Breeding
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Priority: P5 - low Change sponsored?: --- Bug ID: 8350 Assignee: gmcharlt@gmail.com Summary: $search = '0' or 0 will fail to affect SQL statement correctly in C4::Breeding Severity: normal Classification: Unclassified OS: All Reporter: mtompset@hotmail.com Hardware: All Status: NEW Version: unspecified Component: MARC Bibliographic record staging/import Product: Koha It is possible that a title or author could be '0', and thus the simple if ($search) will fail. By changing it to defined 0, '0', and '' are included. However, this would mess up the SQL include a pointless 'like %%'. So, add in a length check and all should be good. ($search) becomes (defined($search) && length($search)>0) Similar logic needs to apply to the isbn number too. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 --- Comment #1 from M. Tompsett <mtompset@hotmail.com> --- *** Bug 8349 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 --- Comment #2 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 10624 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=10624&action=edit Fixed string substitution bug (8349) and better SQL building Fixes bug 8349 and 8350 as the if statement does affect the cases encountered by the substitution which was moved into it. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #3 from Julian Maurice <julian.maurice@biblibre.com> --- Patch looks ok, but I'm not able to reproduce a bug. git grep tells me that the unique place where BreedingSearch is used is cataloguing/addbooks.pl. In cataloguing/addbooks.pl, if I search '0' or 0, BreedingSearch is not called, because of "if($query)" in script. If you want to allow searching for string '0', I think you should modify addbooks.pl as well. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 --- Comment #4 from M. Tompsett <mtompset@hotmail.com> --- Sadly, I don't know how to reproduce it either. Though, perhaps: "HTTP 500 error from koha server while importing Z39.50records" on the mailing list will give clues? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |mtompset@hotmail.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|$search = '0' or 0 will |Searching for a 10 or 13 |fail to affect SQL |digit string (with a number |statement correctly in |in it) that does not exist |C4::Breeding |in one's catalog will fail | |to affect SQL statement | |correctly in C4::Breeding -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 --- Comment #5 from M. Tompsett <mtompset@hotmail.com> --- I was able to trigger this by: - login - "Cataloguing" (goes to addbooks.pl) - Do a cataloguing search for "98765432310" (shouldn't exist in the library) - check error logs for my 3.6.3: [Thu Aug 30 12:03:05 2012] [error] [client 192.168.100.2] [Thu Aug 30 12:03:05 2012] addbooks.pl: Use of uninitialized value $search in substitution (s///) at /usr/share/koha/lib/C4/Breeding.pm line 188., referer: https://.../cgi-bin/koha/cataloguing/addbooks.pl -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 --- Comment #6 from M. Tompsett <mtompset@hotmail.com> --- Put in patching equivalent to my 3.6.3 system. No errors! However, fixing Breeding.pm may not be the only problem. I noticed, while trying to think through the possibilities that there are issues in addbooks.pl The BreedingSearch call has either title=undef or isbn=undef. Is this a reasonable expectation? Additionally, BreedingSearch has three parameters: search, isbn, z3950random. By calling with only two parameters, z3950 is always undef. This means that the "else" always runs. And as Julian Maurice pointed out, there is only one program currently using the BreedingSearch. Perhaps an optimization of the function needs to be made too? I was thinking of a substitution for a different function, but I'm not so sure of that. Someone else more familiar with the addbooks.pl processing would need to make that call. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 --- Comment #7 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 11888 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11888&action=edit Prevents incorrect SQL statement generation in C4::Breeding resulting from an error on an undefined string substitution. I generated a 3.6.x, 3.8.x, and master patch. Login -> Cataloguing -> 9876543210 (or some other 10 or 13 digit number not in your library's catalog) -- (catalogue search) Without the patch, there should be an error in C4::Breeding. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 --- Comment #8 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 11889 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11889&action=edit (3.8.x) Prevents incorrect SQL statement generation in C4::Breeding resulting from an error on an undefined string substitution. I generated a 3.6.x, 3.8.x, and master patch. Login -> Cataloguing -> 9876543210 (or some other 10 or 13 digit number not in your library's catalog) -- (catalogue search) Without the patch, there should be an error in C4::Breeding. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #10624|0 |1 is obsolete| | --- Comment #9 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 11890 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11890&action=edit (master) Prevents incorrect SQL statement generation in C4::Breeding resulting from an error on an undefined string substitution. I generated a 3.6.x, 3.8.x, and master patch. Login -> Cataloguing -> 9876543210 (or some other 10 or 13 digit number not in your library's catalog) -- (catalogue search) Without the patch, there should be an error in C4::Breeding. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11888|0 |1 is obsolete| | Attachment #11889|0 |1 is obsolete| | Attachment #11890|0 |1 is obsolete| | --- Comment #10 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Created attachment 11891 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11891&action=edit Bug 8350: warning in logs when searching for nonexistent ISBN Searching for a 10 or 13 digit numeric string that does not exist in one's catalog will fail to affect SQL statement correctly in C4::Breeding. Moved string substitution, which was triggering error when search was undefined, and fixed if statements accordingly. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |paul.poulain@biblibre.com --- Comment #11 from Paul Poulain <paul.poulain@biblibre.com> --- QA comment: * small patch, tiny side effect risk * passes koha-qa.pl fixes the error & cataloguing still work after patch passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master Version|unspecified |rel_3_8 --- Comment #12 from Paul Poulain <paul.poulain@biblibre.com> --- Patch pushed to master -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8350 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |chris@bigballofwax.co.nz --- Comment #13 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 3.8.x will be in 3.8.6 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org