Bugzilla – Attachment 3375 Details for
Bug 5914
BuildUnimarcHierarchies can go into an infinite loop in certain conditions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-5914-BuildUnimarcHierarchies-Fixing-infinite-loo.patch (text/plain), 2.16 KB, created by
Chris Cormack
on 2011-03-21 02:53:20 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-03-21 02:53:20 UTC
Size:
2.16 KB
patch
obsolete
>From 3581021997bc8965af807738c47d5fd27f2fd97f Mon Sep 17 00:00:00 2001 >From: Henri-Damien LAURENT <henridamien.laurent@biblibre.com> >Date: Wed, 7 Apr 2010 15:15:59 +0200 >Subject: [PATCH] Bug 5914 : BuildUnimarcHierarchies : Fixing infinite loop > >When referenced authority in 5XX$3 would be the same as the current authid, the script would get into infinite loop >--- > C4/AuthoritiesMarc.pm | 45 +++++++++++++++++++++++---------------------- > 1 files changed, 23 insertions(+), 22 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index f3cc948..c23196c 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1128,28 +1128,29 @@ sub BuildUnimarcHierarchies{ > } else { > my $record = GetAuthority($authid); > my $found; >- if ($record){ >- foreach my $field ($record->field('550')){ >- if ($field->subfield('5') && $field->subfield('5') eq 'g'){ >- my $parentrecord = GetAuthority($field->subfield('3')); >- my $localresult=$hierarchies; >- my $trees; >- $trees = BuildUnimarcHierarchies($field->subfield('3')); >- my @trees; >- if ($trees=~/;/){ >- @trees = split(/;/,$trees); >- } else { >- push @trees, $trees; >- } >- foreach (@trees){ >- $_.= ",$authid"; >- } >- @globalresult = (@globalresult,@trees); >- $found=1; >- } >- $hierarchies=join(";",@globalresult); >- } >- } >+ return unless $record; >+ foreach my $field ($record->field('5..')){ >+ if ($field->subfield('5') && $field->subfield('5') eq 'g'){ >+ my $subfauthid=_get_authid_subfield($field); >+ next if ($subfauthid eq $authid); >+ my $parentrecord = GetAuthority($subfauthid); >+ my $localresult=$hierarchies; >+ my $trees; >+ $trees = BuildUnimarcHierarchies($subfauthid); >+ my @trees; >+ if ($trees=~/;/){ >+ @trees = split(/;/,$trees); >+ } else { >+ push @trees, $trees; >+ } >+ foreach (@trees){ >+ $_.= ",$authid"; >+ } >+ @globalresult = (@globalresult,@trees); >+ $found=1; >+ } >+ $hierarchies=join(";",@globalresult); >+ } > #Unless there is no ancestor, I am alone. > $hierarchies="$authid" unless ($hierarchies); > } >-- >1.7.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 5914
:
3375
|
3389
|
3637
|
3651