From a846019d80e46a4fad8c3b47606e2f61e4e9b36a Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 24 Oct 2025 15:50:35 +0000 Subject: [PATCH] Bug 41097: Don't use original record twice This patch prevents us from passing the same record twice into the choose subs to avoid a situation where the original record is not chosen as the one to keep and we try to merge/delete the same record twice To test: 1 - Run the script on a test system that you can reset perl misc/maintenance/dedup_authorities.pl -v -v --confirm -a="PERSO_NAME" 2 - Note duplication of entries in the output like: Merging 1660,1662 into 1660. Updated 0 biblios Deleting 1662 Merge done. 3 - Note how many records are merged 4 - Run again to confirm nothing is merged, i.e. the script removed the dupes 5 - Reset your DB 6 - Apply patch 7 - Run the script again 8 - Note entries no longer have duplicated ids: Merging 1662 into 1660. 9 - Note the same number of records are merged 10 - Run again and confirm nothing is merged 11 - Sign off! --- misc/maintenance/dedup_authorities.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/maintenance/dedup_authorities.pl b/misc/maintenance/dedup_authorities.pl index 67cfb5d3174..c4924e749d9 100755 --- a/misc/maintenance/dedup_authorities.pl +++ b/misc/maintenance/dedup_authorities.pl @@ -324,7 +324,7 @@ sub _choose_records { map [ _get_id($_), $choose_subs[0] ? $choose_subs[0]->($_) : 0, $choose_subs[1] ? $choose_subs[1]->($_) : 0, - $choose_subs[2] ? $choose_subs[2]->($_) : 0 ] => ( $records[0], @candidate_auths ); + $choose_subs[2] ? $choose_subs[2]->($_) : 0 ] => (@candidate_auths); return @candidate_authids; } -- 2.39.5