Bug 15266 - stage-marc-import.pl does not show warning messages on MARC error
Summary: stage-marc-import.pl does not show warning messages on MARC error
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic record staging/import (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-30 15:41 UTC by Barton Chittenden
Modified: 2023-08-28 19:49 UTC (History)
1 user (show)

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


Attachments
Example data -- a marc-utf8 file with errors (13.29 KB, text/plain)
2015-11-30 15:52 UTC, Barton Chittenden
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2015-11-30 15:41:27 UTC
If a marc file is imported which contains a MARC syntax error, the only message displayed is '1 records not staged because of MARC error'. There is no indication of where the error occurred, or what type of error occurred.
Comment 1 Barton Chittenden 2015-11-30 15:52:18 UTC
Created attachment 45231 [details]
Example data -- a marc-utf8 file with errors

The attached file throws the following message in intranet-error.log:

stage-marc-import.pl: Argument "1 15" isn't numeric in integer addition (+) at /usr/share/perl5/MARC/File/USMARC.pm line 166.

Inspecting that code, I see

156         # Check directory validity
157         ($tagno =~ /^[0-9A-Za-z]{3}$/)
158             or $marc->_warn( "Invalid tag in directory $location: \"$tagno\"" );
159 
160         ($len =~ /^\d{4}$/)
161             or $marc->_warn( "Invalid length in directory $location tag $tagno: \"$len\"" );
162 
163         ($offset =~ /^\d{5}$/)
164             or $marc->_warn( "Invalid offset in directory $location tag $tagno: \"$offset\"" );
165 
166         ($offset + $len <= $reclen)
167             or $marc->_warn( "Directory entry $location runs off the end of the record tag $tagno" );

The two elements in the addition in line 166 are $offset and $len. The argument "1 15" doesn't match the regular expression for either $len (^\d{4}$) nor $offset (^\d{5}$), so it should have triggered one of the $marc->_warn methods, but these warnings are not sent to intranet-error.log nor to the screen.