[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#767563: unblock: qt4-perl/4.8.4-1.2



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package qt4-perl

Fix for RC bug #765681

Explanation for easy patch navigation:

There are three patches added in this upload to solve the bug:

qtcore4.pmupdate.diff updates the file qtcore/lib/QtCore.pm to the current
upstream content.  The changes end up being related to the bug.

The second hunk of the patch (+@@ -1417,9 +1420,9 @@) solves the observable
QtCore.pm problem described in #765681:

defined(@array) is deprecated at /usr/lib/x86_64-linux-gnu/perl5/5.20/QtCore4.pm line 1420.
        (Maybe you should just omit the defined()?)
defined(@array) is deprecated at /usr/lib/x86_64-linux-gnu/perl5/5.20/QtCore4.pm line 1421.
        (Maybe you should just omit the defined()?)
defined(@array) is deprecated at /usr/lib/x86_64-linux-gnu/perl5/5.20/QtCore4.pm line 1422.
        (Maybe you should just omit the defined()?)

This alone is enough to cause a failure.  The other hunks of the patch resolve
an overloading problem that appears once the other issues are resolved
(mentioned in the KDE bug:

https://bugs.kde.org/show_bug.cgi?id=340518#c3

Subroutine Qt::GlobalSpace::_UTOLOAD redefined at /usr/lib/i386-linux-gnu/perl5/5.20/QtCore4.pm line 1304.
Subroutine Qt::GlobalSpace::_UTOLOAD redefined at /usr/lib/i386-linux-gnu/perl5/5.20/QtCore4.pm line 1304.
Subroutine Qt::Widget::_UTOLOAD redefined at /usr/lib/i386-linux-gnu/perl5/5.20/QtCore4.pm line 1304.
Subroutine Qt::Widget::_UTOLOAD redefined at /usr/lib/i386-linux-gnu/perl5/5.20/QtCore4.pm line 1304.

debian/patches/perl5.20.diff from Ubuntu (cjwatson) resolves the other
observable issue described in the Debian bug:

"SvREFCNT_inc" is not exported by the Devel::Peek module
Can't continue after import errors at /usr/lib/x86_64-linux-gnu/perl5/5.20/QtGui4.pm line 25.
BEGIN failed--compilation aborted at /usr/lib/x86_64-linux-gnu/perl5/5.20/QtGui4.pm line 25.

Finally, Red Hat identified some additional incompatibility (see the referenced
Red Hat bug in the patch for details that are solved by backporting the
upstream commit in debian/patches/additionalperl5.20.diff.

It took a bit of stitching together, but the test case provided in the bug now
works correctly.

unblock qt4-perl/4.8.4-1.2
diff -Nru qt4-perl-4.8.4/debian/changelog qt4-perl-4.8.4/debian/changelog
--- qt4-perl-4.8.4/debian/changelog	2014-08-04 08:20:09.000000000 -0400
+++ qt4-perl-4.8.4/debian/changelog	2014-10-31 22:54:49.000000000 -0400
@@ -1,3 +1,15 @@
+qt4-perl (4.8.4-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix perl 5.20 incompatiblities (Closes: #765681)
+    - Add debian/patches/qtcore4.pmupdate.diff to update QtCore.pm to current
+      upstream for perl 5.18 compatibility
+    - Add debian/patches/perl5.20.diff from Ubuntu for basic perl 5.20 compat
+    - Add debian/patches/additionalperl5.20.diff from upstream to resolve the
+      final issue
+
+ -- Scott Kitterman <scott@kitterman.com>  Fri, 31 Oct 2014 02:41:03 -0400
+
 qt4-perl (4.8.4-1.1) unstable; urgency=medium
 
   [ gregor herrmann ]
diff -Nru qt4-perl-4.8.4/debian/patches/additionalperl5.20.diff qt4-perl-4.8.4/debian/patches/additionalperl5.20.diff
--- qt4-perl-4.8.4/debian/patches/additionalperl5.20.diff	1969-12-31 19:00:00.000000000 -0500
+++ qt4-perl-4.8.4/debian/patches/additionalperl5.20.diff	2014-10-31 22:20:32.000000000 -0400
@@ -0,0 +1,33 @@
+commit 1b665848e178301344386717c658386d160d222a
+Author: Chris Burel <chrisburel@gmail.com>
+Date:   Fri Oct 31 11:23:18 2014 -0700
+
+    Use a copy of the Qt::AutoLoad::AUTOLOAD variable.
+    
+    This appears to be a change in Perl's behavior.  The way the operator
+    overloading in PerlQt works is that it first tries to find an operator method
+    on the class itself, and then next it tries to find one in the so-called
+    QGlobalSpace, which is a place defined by the smoke library for global Qt
+    functions.  Perl passes the underlying XS code the full package and function
+    being called, which PerlQt splits into 2 strings, one for the package name, and
+    one for the method name.  PerlQt null-terminates the package name string, and
+    in previous versions of Perl, this modification did not affect the source
+    $AUTOLOAD variable.  In Perl 5.20.0, it does update the Perl variable, and then
+    causes confusion down the line.
+    
+    https://bugzilla.redhat.com/show_bug.cgi?id=1136340
+    https://bugs.kde.org/show_bug.cgi?id=340518
+
+Index: qt4-perl-4.8.4/qtcore/src/util.cpp
+===================================================================
+--- qt4-perl-4.8.4.orig/qtcore/src/util.cpp	2014-10-31 22:20:27.528500094 -0400
++++ qt4-perl-4.8.4/qtcore/src/util.cpp	2014-10-31 22:20:27.524500094 -0400
+@@ -1944,7 +1944,7 @@
+     PERL_SET_CONTEXT(PL_curinterp);
+     // Figure out which package and method is being called, based on the
+     // autoload variable
+-    SV* autoload = get_sv( "Qt::AutoLoad::AUTOLOAD", TRUE );
++    SV* autoload = sv_mortalcopy( get_sv( "Qt::AutoLoad::AUTOLOAD", TRUE ) );
+     char* package = SvPV_nolen( autoload );
+     char* methodname = 0;
+     // Splits off the method name from the package
diff -Nru qt4-perl-4.8.4/debian/patches/perl5.20.diff qt4-perl-4.8.4/debian/patches/perl5.20.diff
--- qt4-perl-4.8.4/debian/patches/perl5.20.diff	1969-12-31 19:00:00.000000000 -0500
+++ qt4-perl-4.8.4/debian/patches/perl5.20.diff	2014-10-31 22:17:10.000000000 -0400
@@ -0,0 +1,46 @@
+Description: Port to Perl 5.20
+ Devel::Peek in Perl 5.20 no longer exports SvREFCNT_inc.  Put a copy in
+ QtGui4::_internal instead.
+Author: Colin Watson <cjwatson@debian.org>
+Forwarded: yes
+Last-Update: 2014-10-31
+
+Index: b/qtgui/lib/QtGui4.pm
+===================================================================
+--- a/qtgui/lib/QtGui4.pm
++++ b/qtgui/lib/QtGui4.pm
+@@ -22,7 +22,6 @@
+ 
+ use QtCore4;
+ use base qw(Qt::_internal);
+-use Devel::Peek qw( SvREFCNT_inc );
+ 
+ sub init {
+     @Qt::_internal::vectorTypes{qw(Qt::Polygon Qt::PolygonF Qt::ItemSelection)}
+@@ -76,7 +75,7 @@
+ }
+ 
+ sub Qt::UndoCommand::ON_DESTROY {
+-    Devel::Peek::SvREFCNT_inc( Qt::this() );
++    QtGui4::_internal->SvREFCNT_inc( Qt::this() );
+     # XXX is there a better solution here?
+     return 1;
+ }
+Index: b/qtgui/src/QtGui4.xs
+===================================================================
+--- a/qtgui/src/QtGui4.xs
++++ b/qtgui/src/QtGui4.xs
+@@ -93,6 +93,13 @@
+     OUTPUT:
+         RETVAL
+ 
++SV*
++SvREFCNT_inc(sv)
++        SV* sv
++    PPCODE:
++        RETVAL = SvREFCNT_inc(sv); 
++        PUSHs(RETVAL);
++
+ #// The build system with cmake and mingw relies on the visibility being set for
+ #// a dll to export that symbol.  So we need to redefine XSPROTO so that we can
+ #// export the boot method.
diff -Nru qt4-perl-4.8.4/debian/patches/qtcore4.pmupdate.diff qt4-perl-4.8.4/debian/patches/qtcore4.pmupdate.diff
--- qt4-perl-4.8.4/debian/patches/qtcore4.pmupdate.diff	1969-12-31 19:00:00.000000000 -0500
+++ qt4-perl-4.8.4/debian/patches/qtcore4.pmupdate.diff	2014-10-31 22:23:00.000000000 -0400
@@ -0,0 +1,177 @@
+Description: Update qtcore/lib/QtCore4.pm to 4.14.1 for perl 5.20 compat
+ As described both the the Debian and KDE bugs, there are multiple bad things
+ that happen with 4.8.4 is run with perl 5.20 due to QtCore4.pm being out of
+ date (there are issues with 4.14.1 also, but those are addressed in other
+ patches).  This patch matches exactly the upstream changes and each change
+ appears tied to issues with 5.20 and resolving #765681
+Origin: upstream
+Bug: https://bugs.kde.org/show_bug.cgi?id=340518
+Bug-Debian: http://bugs.debian.org/765681
+Forwarded: not-needed
+Reviewed-By: Scott Kitterman <scott@kitterman.com>
+Last-Update: 2014-10-31
+
+Index: qt4-perl-4.8.4/qtcore/lib/QtCore4.pm
+===================================================================
+--- qt4-perl-4.8.4.orig/qtcore/lib/QtCore4.pm	2014-10-31 22:22:53.160505760 -0400
++++ qt4-perl-4.8.4/qtcore/lib/QtCore4.pm	2014-10-31 22:22:53.152505759 -0400
+@@ -1301,12 +1301,15 @@
+ 
+     foreach my $sp ('', ' ') {
+         my $where = $sp . $perlClassName;
+-        installautoload($where);
+-        # Putting this in one package gives XS_AUTOLOAD one spot to look for
+-        # the autoload variable
+-        package Qt::AutoLoad;
+-        my $autosub = \&{$where . '::_UTOLOAD'};
+-        Qt::_internal::installSub( $where.'::AUTOLOAD', sub{&$autosub} );
++
++        if (!exists &{$where . '::AUTOLOAD'}) {
++            installautoload($where);
++            # Putting this in one package gives XS_AUTOLOAD one spot to look for
++            # the autoload variable
++            package Qt::AutoLoad;
++            my $autosub = \&{$where . '::_UTOLOAD'};
++            Qt::_internal::installSub( $where.'::AUTOLOAD', sub{&$autosub} );
++        }
+     }
+ 
+     installSub("$perlClassName\::NEW", sub {
+@@ -1417,9 +1420,9 @@
+     my $signals = $meta->{signals};
+     my $slots = $meta->{slots};
+ 
+-    @{$classinfos} = () if !defined @{$classinfos};
+-    @{$signals} = () if !defined @{$signals};
+-    @{$slots} = () if !defined @{$slots};
++    @{$classinfos} = () if !defined $classinfos;
++    @{$signals} = () if !defined $signals;
++    @{$slots} = () if !defined $slots;
+ 
+     # Each entry in 'stringdata' corresponds to a string in the
+     # qt_meta_stringdata_<classname> structure.
+@@ -1646,6 +1649,8 @@
+ use strict;
+ use warnings;
+ 
++use Scalar::Util;
++
+ # Called in the DESTROY method for all QObjects to see if they still have a
+ # parent, and avoid deleting them if they do.
+ sub Qt::Object::ON_DESTROY {
+@@ -1805,67 +1810,91 @@
+ });
+ 
+ sub String {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::String';
++        }
+         return bless \shift, 'Qt::String';
+-    } else {
+-        return bless '', 'Qt::String';
+     }
++    return bless '', 'Qt::String';
+ }
+ 
+ sub CString {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::CString';
++        }
+         return bless \shift, 'Qt::CString';
+-    } else {
+-        return bless '', 'Qt::CString';
+     }
++    return bless '', 'Qt::CString';
+ }
+ 
+ sub Int {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::Int';
++        }
+         return bless \shift, 'Qt::Int';
+-    } else {
+-        return bless '', 'Qt::Int';
+     }
++    return bless '', 'Qt::Int';
+ }
+ 
+ sub Uint {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::Uint';
++        }
+         return bless \shift, 'Qt::Uint';
+-    } else {
+-        return bless '', 'Qt::Uint';
+     }
++    return bless '', 'Qt::Uint';
+ }
+ 
+ sub Bool {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::Bool';
++        }
+         return bless \shift, 'Qt::Bool';
+-    } else {
+-        return bless '', 'Qt::Bool';
+     }
++    return bless '', 'Qt::Bool';
+ }
+ 
+ sub Short {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::Short';
++        }
+         return bless \shift, 'Qt::Short';
+-    } else {
+-        return bless '', 'Qt::Short';
+     }
++    return bless '', 'Qt::Short';
+ }
+ 
+ sub Ushort {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::Ushort';
++        }
+         return bless \shift, 'Qt::Ushort';
+-    } else {
+-        return bless '', 'Qt::Ushort';
+     }
++    return bless '', 'Qt::Ushort';
+ }
+ 
+ sub Uchar {
+-    if ( @_ ) {
++    if ( scalar @_ ) {
++        if ( Scalar::Util::readonly( $_[0] ) ) {
++            my $val = shift;
++            return bless \$val, 'Qt::Uchar';
++        }
+         return bless \shift, 'Qt::Uchar';
+-    } else {
+-        return bless '', 'Qt::Uchar';
+     }
++    return bless '', 'Qt::Uchar';
+ }
+ 
+ 1;
diff -Nru qt4-perl-4.8.4/debian/patches/series qt4-perl-4.8.4/debian/patches/series
--- qt4-perl-4.8.4/debian/patches/series	2012-06-20 17:42:59.000000000 -0400
+++ qt4-perl-4.8.4/debian/patches/series	2014-10-31 22:54:59.000000000 -0400
@@ -1 +1,4 @@
 disable_tests
+qtcore4.pmupdate.diff
+perl5.20.diff
+additionalperl5.20.diff

Reply to: