From af34d8157dc54c27fe9cdea35196ccd548df4812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Delaune?= <stephane.delaune@biblibre.com> Date: Wed, 15 Oct 2014 15:08:49 +0200 Subject: [PATCH] Bug 13082: fix to prevent adding of invalid records in marc file Test: 1. Edit record, add 100.000 chars text to 500a 2. xml export produce the record, 3. mrc export do not produce the record, warning on log export.pl: Record length of 111000 is larger than the MARC spec allows (99999 bytes). at /usr/share/perl5/MARC/File/USMARC.pm line 314. record (number 139489) is invalid and therefore not exported because its reopening generates warnings above at... --- tools/export.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/export.pl b/tools/export.pl index 8a5c2a5..3ed965c 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -416,9 +416,8 @@ if ( $op eq "export" ) { print "\n"; } else { - my (@result_build_tag) = MARC::File::USMARC::_build_tag_directory($record); - if ($result_build_tag[2] > 99999) { - warn "record (number $recordid) length ".$result_build_tag[2]." is larger than the MARC spec allows (99999 bytes)"; + if (scalar(MARC::File::USMARC->decode( $record->as_usmarc )->warnings())){ + warn "record (number $recordid) is invalid and therefore not exported because its reopening generates warnings above"; next; } print $record->as_usmarc(); -- 1.9.1