Control: tag -1 patch

On Fri, Nov 24, 2017 at 10:56:44PM +0100, gregor herrmann wrote:
> Package: libdbix-class-schema-loader-perl
> Version: 0.07047-1
> Severity: serious
> Tags: upstream
> Justification: fails to build from source (but built successfully in the past)
> Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=123681

> As first seen on ci.debian.net [0], libdbix-class-schema-loader-perl's
> test suite fails since recent changes in prerequsites. The same
> happens during build which leads to a FTBFS bug:
> 
> DBIx::Class::ResultSource::schema(): Unable to perform storage-dependent 
> operations with a detached result source (source 'Bar' is not associated with 
> a schema). You need to use $schema->thaw() or manually set 
> $DBIx::Class::ResultSourceHandle::thaw_schema while thawing. at 
> t/20invocations.t line 18

As discussed in the upstream bug, this is an intentional change in
Hash::Merge behaviour wrt. cloning. The attached patch seems to make it
work again by disabling the cloning, but Ilmari (the upstream author)
said a month ago he's unsure if it's the right thing to do.

Copying Ilmari: any news here? There's some pressure to fix this on the
Debian side, do you think the fix/workaround (->set_clone_behaviour(0))
is at least an acceptable temporary solution?

Thanks for your work,
-- 
Niko
>From 421f0c87f50862786b98934575d3f73a02119181 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Fri, 22 Dec 2017 19:40:14 +0200
Subject: [PATCH] Disable cloning when merging hashes

Newer versions of Hash::Merge changed their cloning
behaviour, causing corruption of DBI handles.

Bug: https://rt.cpan.org/Public/Bug/Display.html?id=123681
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882618
---
 lib/DBIx/Class/Schema/Loader.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm
index d100408..1f879cf 100644
--- a/lib/DBIx/Class/Schema/Loader.pm
+++ b/lib/DBIx/Class/Schema/Loader.pm
@@ -10,7 +10,7 @@ use Scalar::Util 'weaken';
 use Sub::Util 'set_subname';
 use DBIx::Class::Schema::Loader::Utils 'array_eq';
 use Try::Tiny;
-use Hash::Merge 'merge';
+use Hash::Merge;
 use namespace::clean;
 
 # Always remember to do all digits for the version even if they're 0
@@ -232,10 +232,13 @@ sub _merge_state_from {
 
     $self->_copy_state_from($from);
 
-    $self->class_mappings(merge($orig_class_mappings, $self->class_mappings))
+    my $merger = Hash::Merge->new;
+    $merger->set_clone_behavior(0);
+
+    $self->class_mappings($merger->merge($orig_class_mappings, $self->class_mappings))
         if $orig_class_mappings;
 
-    $self->source_registrations(merge($orig_source_registrations, $self->source_registrations))
+    $self->source_registrations($merger->merge($orig_source_registrations, $self->source_registrations))
         if $orig_source_registrations;
 }
 
-- 
2.15.1

Reply via email to