Bug 40326

Summary: MARC::Record throws fatal errors in many cases for bad leaders
Product: Koha Reporter: David Cook <dcook>
Component: Searching - ElasticsearchAssignee: David Cook <dcook>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38933
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 38913    
Bug Blocks:    

Description David Cook 2025-07-08 03:14:41 UTC
If you have a bad leader in your MARCXML, trying to generate USMARC from it can itself throw a fatal error:

my $usmarc_record = $record->as_usmarc();

substr outside of string at /usr/share/perl5/MARC/Record.pm line 570.
Something went wrong rebuilding indexes for kohadev
Comment 1 David Cook 2025-07-08 04:25:29 UTC
Renaming from '$record->as_usmarc() throws fatal errors for bad leaders' because there's actually a lot of  places where MARC::Record will throw fatal errors. For example '$record->encoding()'.