Bugzilla – Attachment 32557 Details for
Bug 13082
tools/export.pl fix to forbid adding of all invalid records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-Bug-13082-fix-to-prevent-adding-of-invalid-records-i.patch (text/plain), 1.72 KB, created by
Stéphane Delaune
on 2014-10-21 16:12:59 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Stéphane Delaune
Created:
2014-10-21 16:12:59 UTC
Size:
1.72 KB
patch
obsolete
>From f294a3c40f04b4d9c44a6365992c4c18ae91beb4 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?St=C3=A9phane=20Delaune?= <stephane.delaune@biblibre.com> >Date: Tue, 21 Oct 2014 18:05:18 +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 | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/tools/export.pl b/tools/export.pl >index 8a5c2a5..1cc9ff8 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -416,9 +416,10 @@ 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)"; >+ my $errorcount_on_decode = eval { scalar(MARC::File::USMARC->decode( $record->as_usmarc )->warnings()) }; >+ if ($errorcount_on_decode or $@){ >+ warn $@ if $@; >+ warn "record (number $recordid) is invalid and therefore not exported because its reopening generates warnings above"; > next; > } > print $record->as_usmarc(); >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13082
:
32332
|
32557
|
32715
|
32718