Bug 2435 - corrupt MARC record can abort import batch commit
Summary: corrupt MARC record can abort import batch commit
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic record staging/import (show other bugs)
Version: master
Hardware: PC All
: P3 major (vote)
Assignee: Galen Charlton
QA Contact: Bugs List
: 2810 (view as bug list)
Depends on:
Reported: 2008-07-30 01:36 UTC by Galen Charlton
Modified: 2014-12-07 20:02 UTC (History)
3 users (show)

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

file that triggers the bug (1.03 KB, application/octet-stream)
2008-07-30 13:37 UTC, Chris Cormack

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 00:51:09 UTC

---- Reported by gmcharlt@gmail.com 2008-07-30 13:36:16 ----

A MARC record that is corrupt because it has non-UTF8 control characters in the leader can be successfully staged, but a commit operation (e.g., commit_biblios_file.pl) can fail because the MARCXML generated by the staging operation is invalid.

The error message associated with the crash is:

substr outside of string at /usr/local/share/perl/5.8.8/MARC/Record.pm line 554.

This is a multi-part bug:

[1] MARC::File::XML should not emit a UTF-8 MARC record that isn't actually valid UTF-8.
[2] This kind of record corruption should be detected during staging.
[3] $marc->warnings() should be checked; if it includes a warn that the leader is not of the correct length, the record should be considered corrupt.

---- Additional Comments From gmcharlt@gmail.com 2008-07-30 13:37:42 ----

Created an attachment
file that triggers the bug

To reproduce the bug with this file:

stage_biblios_file.pl --file bad.mrc
commit_biblios --batch-number foo

---- Additional Comments From jmf@liblime.com 2008-08-09 17:27:17 ----

Bumping up to 3.2

--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 00:51 UTC  ---

This bug was previously known as _bug_ 2435 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=2435
Imported an attachment (id=671)

Actual time not defined. Setting to 0.0
CC member arm@hanover.ca does not have an account here
CC member michele.maenpaa@liblime.com does not have an account here
CC member rch@liblime.com does not have an account here
The original submitter of attachment 671 [details] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.

Comment 1 Katrin Fischer 2011-04-25 10:14:41 UTC
Another very old bug - can someone test and confirm if this is fixed or needs a patch?
Comment 2 Katrin Fischer 2012-04-02 21:41:08 UTC
*** Bug 2810 has been marked as a duplicate of this bug. ***
Comment 3 Liz Rea 2012-05-02 15:53:36 UTC
This does not happen anymore as of koha 3.8 (or at least, this file does not cause issues anymore).