[Bug 43029] New: Guard maintenance scripts against biblios with corrupt metadata
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029 Bug ID: 43029 Summary: Guard maintenance scripts against biblios with corrupt metadata Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Depends on: 35104 Target Milestone: --- Bug 35104 makes Koha::Biblio::Metadata->record()/store() throw Koha::Exceptions::Metadata::Invalid for a record whose MARCXML cannot be decoded. misc/maintenance/sanitize_records.pl and misc/maintenance/touch_all_biblios.pl both read a biblio's metadata record and unconditionally re-save it across every biblio in the database, so a single already-corrupt record (which could exist from before bug 35104, or from a source outside Koha's own validation) would abort the whole run. This patch wraps the read (and, for touch_all_biblios.pl, the resulting ModBiblio) so one such biblio is skipped and reported rather than aborting the whole maintenance run. Depends on bug 35104. Test plan: 1. Apply this patch on top of bug 35104. 2. Create a biblio with metadata that is already corrupt, bypassing Koha::Biblio::Metadata's validation (e.g. write invalid MARCXML directly to the biblio_metadata row via the DBIC schema result, not through ->store()), alongside several normal biblios. 3. Run misc/maintenance/sanitize_records.pl --verbose across all biblios. Confirm the corrupt one is skipped with a clear "ERROR: Invalid record" message and the script completes for every other biblio without dying. 4. Run misc/maintenance/touch_all_biblios.pl similarly. Confirm the corrupt record is counted/logged as an error and the other records are still touched successfully. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35104 [Bug 35104] We should warn when attempting to save MARC records that contain characters invalid in XML -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 201709 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201709&action=edit Bug 43029: Guard maintenance scripts against biblios with corrupt metadata sanitize_records.pl and touch_all_biblios.pl both read a biblio's metadata record and unconditionally re-save it. Since Koha::Biblio::Metadata->record()/store() can now throw Koha::Exceptions::Metadata::Invalid for a record that was already corrupt before bug 35104 existed, wrap the read (and, for touch_all_biblios.pl, the resulting ModBiblio) so one such biblio is skipped and reported rather than aborting the whole maintenance run. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #201709|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 201735 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201735&action=edit Bug 43029: Guard maintenance scripts against biblios with corrupt metadata sanitize_records.pl and touch_all_biblios.pl both read a biblio's metadata record and unconditionally re-save it. Since Koha::Biblio::Metadata->record()/store() can now throw Koha::Exceptions::Metadata::Invalid for a record that was already corrupt before bug 35104 existed, wrap the read (and, for touch_all_biblios.pl, the resulting ModBiblio) so one such biblio is skipped and reported rather than aborting the whole maintenance run. Signed-off-by: Baptiste Bayche <baptiste.bayche@inlibro.com> Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> Sponsored-by: OpenFifth -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org