[perl-Tk] Fix creating a window with perl 5.20 and freetype detection

Petr Pisar ppisar at fedoraproject.org
Fri Sep 12 13:14:52 UTC 2014


commit ac137c122917fa3ca7e7c5be5f8e2e05d5945ffe
Author: Petr Písař <ppisar at redhat.com>
Date:   Fri Sep 12 14:03:39 2014 +0200

    Fix creating a window with perl 5.20 and freetype detection

 ...4.032-fix-race-condition-in-errordialog.t.patch |   72 ++++++++++++++++++++
 ...also-for-usr-include-freetype2-freetype.h.patch |   40 +++++++++++
 ...s-if-Tk-MainWindow-Create-was-called-with.patch |   33 +++++++++
 ...ase-for-Tk-MainWindow-Create-without-args.patch |   39 +++++++++++
 ...4.032-travis-ci-test-5.20-instead-of-5.19.patch |   29 ++++++++
 ...-update-comment-about-freetype.h-location.patch |   35 ++++++++++
 perl-Tk-freetype25.patch                           |   19 -----
 perl-Tk.spec                                       |   28 +++++++-
 8 files changed, 273 insertions(+), 22 deletions(-)
---
diff --git a/Tk-804.032-fix-race-condition-in-errordialog.t.patch b/Tk-804.032-fix-race-condition-in-errordialog.t.patch
new file mode 100644
index 0000000..5b65eab
--- /dev/null
+++ b/Tk-804.032-fix-race-condition-in-errordialog.t.patch
@@ -0,0 +1,72 @@
+From 04794000cf849e0c03a9e056222fb4758a55b04b Mon Sep 17 00:00:00 2001
+From: Slaven Rezic <slaven at rezic.de>
+Date: Sun, 27 Apr 2014 21:06:21 +0200
+Subject: [PATCH 06/10] fix race condition in errordialog.t
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Test used to fail if the afterIdle callback with the die() was
+executed after the checking callback. This could happen on slow (e.g.
+remote) X11 connections.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ t/errordialog.t | 33 +++++++++++++++++++--------------
+ 1 file changed, 19 insertions(+), 14 deletions(-)
+
+diff --git a/t/errordialog.t b/t/errordialog.t
+index 3036e5b..ffd1b71 100755
+--- a/t/errordialog.t
++++ b/t/errordialog.t
+@@ -27,21 +27,13 @@ use_ok 'Tk::ErrorDialog';
+ my $mw = tkinit;
+ $mw->geometry("+10+10");
+ 
+-my $errmsg = "Intentional error.";
+-$mw->afterIdle(sub { die "$errmsg\n" });
+-
+ my $ed;
+-$mw->after(100, sub {
+-	       my $dialog = search_error_dialog($mw);
+-	       isa_ok($dialog, "Tk::Dialog", "dialog");
+-	       $ed = $dialog;
+-	       my $error_stacktrace_toplevel = search_error_stacktrace_toplevel($mw);
+-	       isa_ok($error_stacktrace_toplevel, 'Tk::ErrorDialog', 'Found stacktrace window');
+-	       is($error_stacktrace_toplevel->state, 'withdrawn', 'Stacktrace not visible');
+-	       $error_stacktrace_toplevel->geometry('+0+0'); # for WMs with interactive placement
+-	       $dialog->SelectButton('Stack trace');
+-	       second_error();
+-	   });
++
++my $errmsg = "Intentional error.";
++$mw->afterIdle(sub {
++		   $mw->after(100, \&first_error);
++		   die "$errmsg\n";
++	       });
+ 
+ $mw->after(20*1000, sub {
+ 	       if (Tk::Exists($mw)) {
+@@ -51,6 +43,19 @@ $mw->after(20*1000, sub {
+ 	   });
+ MainLoop;
+ 
++# fills $ed
++sub first_error {
++    my $dialog = search_error_dialog($mw);
++    isa_ok($dialog, "Tk::Dialog", "dialog");
++    $ed = $dialog;
++    my $error_stacktrace_toplevel = search_error_stacktrace_toplevel($mw);
++    isa_ok($error_stacktrace_toplevel, 'Tk::ErrorDialog', 'Found stacktrace window');
++    is($error_stacktrace_toplevel->state, 'withdrawn', 'Stacktrace not visible');
++    $error_stacktrace_toplevel->geometry('+0+0'); # for WMs with interactive placement
++    $dialog->SelectButton('Stack trace');
++    second_error();
++}
++
+ sub second_error {
+     $mw->afterIdle(sub { die "$errmsg\n" });
+     $mw->after(100, sub {
+-- 
+1.9.3
+
diff --git a/Tk-804.032-look-also-for-usr-include-freetype2-freetype.h.patch b/Tk-804.032-look-also-for-usr-include-freetype2-freetype.h.patch
new file mode 100644
index 0000000..85199a2
--- /dev/null
+++ b/Tk-804.032-look-also-for-usr-include-freetype2-freetype.h.patch
@@ -0,0 +1,40 @@
+From 1ca4589ef5a87999ec564081900bc8fdaed83c74 Mon Sep 17 00:00:00 2001
+From: Slaven Rezic <slaven at rezic.de>
+Date: Sun, 2 Mar 2014 12:10:31 +0100
+Subject: [PATCH 01/10] look also for /usr/include/freetype2/freetype.h
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In some freetype installations (e.g. Debian/jessie) the intermediate
+"freetype" directory may be missing in the include path.
+
+This should fix
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740207
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ myConfig | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/myConfig b/myConfig
+index 02d2ee5..3ca8144 100755
+--- a/myConfig
++++ b/myConfig
+@@ -147,7 +147,12 @@ sub Ift
+ {
+  foreach (map { "$_/freetype2" } @_)
+   {
+-   if (-d $_ && -d "$_/freetype" && -r "$_/freetype/freetype.h")
++   if (-r "$_/freetype.h") # location in Debian (since jessie)
++    {
++     print "Using -I$_ to find $_/freetype/freetype.h\n";
++     return "-I$_";
++    }
++   if (-r "$_/freetype/freetype.h") # location in FreeBSD (up to version 10.0) and Debian (up to wheezy)
+     {
+      print "Using -I$_ to find $_/freetype/freetype.h\n";
+      return "-I$_";
+-- 
+1.9.3
+
diff --git a/Tk-804.032-no-segfaults-if-Tk-MainWindow-Create-was-called-with.patch b/Tk-804.032-no-segfaults-if-Tk-MainWindow-Create-was-called-with.patch
new file mode 100644
index 0000000..d81742b
--- /dev/null
+++ b/Tk-804.032-no-segfaults-if-Tk-MainWindow-Create-was-called-with.patch
@@ -0,0 +1,33 @@
+From ba3a92a779f7adcf655b7e45b40ee5b0cb79bc8b Mon Sep 17 00:00:00 2001
+From: Slaven Rezic <slaven at rezic.de>
+Date: Fri, 14 Mar 2014 16:00:05 +0100
+Subject: [PATCH 02/10] no segfaults if Tk::MainWindow::Create was called
+ without args
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+However, this case never happened in real life, as this function was
+not supposed to be used directly anyway.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ tkGlue.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tkGlue.c b/tkGlue.c
+index 57f0bca..ae595bf 100644
+--- a/tkGlue.c
++++ b/tkGlue.c
+@@ -2370,7 +2370,7 @@ XS(XS_Tk__MainWindow_Create)
+  STRLEN na;
+  Tcl_Interp *interp = Tcl_CreateInterp();
+  SV **args = &ST(0);
+- char *appName = SvPV(ST(1),na);
++ char *appName = items >= 1 ? SvPV(ST(1),na) : "";
+  int offset = args - sp;
+  int code;
+  if (!initialized)
+-- 
+1.9.3
+
diff --git a/Tk-804.032-test-case-for-Tk-MainWindow-Create-without-args.patch b/Tk-804.032-test-case-for-Tk-MainWindow-Create-without-args.patch
new file mode 100644
index 0000000..c63ee2b
--- /dev/null
+++ b/Tk-804.032-test-case-for-Tk-MainWindow-Create-without-args.patch
@@ -0,0 +1,39 @@
+From 567210e099deb8b3c77e8d24161563f8bdec4a08 Mon Sep 17 00:00:00 2001
+From: Slaven Rezic <slaven at rezic.de>
+Date: Fri, 14 Mar 2014 16:05:09 +0100
+Subject: [PATCH 03/10] test case for Tk::MainWindow::Create without args
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ t/create.t | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/t/create.t b/t/create.t
+index 8843acc..a367530 100644
+--- a/t/create.t
++++ b/t/create.t
+@@ -80,7 +80,7 @@ BEGIN
+ 			    ($^O eq 'cygwin' and defined($Tk::platform)
+ 					     and $Tk::platform eq 'MSWin32'));
+ 
+-   plan test => (15*@class+3);
++   plan test => (15*@class+4);
+ 
+   };
+ 
+@@ -93,6 +93,9 @@ ok($@, "", "can't create MainWindow");
+ ok(Tk::Exists($mw), 1, "MainWindow creation failed");
+ eval { $mw->geometry('+10+10'); };  # This works for mwm and interactivePlacement
+ 
++eval { Tk::MainWindow::Create() };
++ok($@ =~ qr{wrong # args: should be .*Tk::MainWindow::Create pathName}, 1, "no segfault for Tk::MainWindow::Create without args");
++
+ my $w;
+ foreach my $class (@class)
+   {
+-- 
+1.9.3
+
diff --git a/Tk-804.032-travis-ci-test-5.20-instead-of-5.19.patch b/Tk-804.032-travis-ci-test-5.20-instead-of-5.19.patch
new file mode 100644
index 0000000..86d34ba
--- /dev/null
+++ b/Tk-804.032-travis-ci-test-5.20-instead-of-5.19.patch
@@ -0,0 +1,29 @@
+From 823f367d5e0952cead89646e0c7b7278a5e633b6 Mon Sep 17 00:00:00 2001
+From: Slaven Rezic <slaven at rezic.de>
+Date: Fri, 8 Aug 2014 08:56:51 +0200
+Subject: [PATCH 10/10] travis-ci: test 5.20 instead of 5.19
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ .travis.yml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/.travis.yml b/.travis.yml
+index 8d4e90c..3cdb98f 100644
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -15,7 +15,7 @@ before_install:
+  - (sleep 10; env DISPLAY=:123 $WINDOW_MANAGER) &
+ matrix:
+  include:
+-  - perl: "5.19"
++  - perl: "5.20"
+     env: DISPLAY=:123 WINDOW_MANAGER=twm
+ ## t/fbox.t fails, not reproducible on a freebsd system
+ #  - perl: "5.18"
+-- 
+1.9.3
+
diff --git a/Tk-804.032-update-comment-about-freetype.h-location.patch b/Tk-804.032-update-comment-about-freetype.h-location.patch
new file mode 100644
index 0000000..89b14cd
--- /dev/null
+++ b/Tk-804.032-update-comment-about-freetype.h-location.patch
@@ -0,0 +1,35 @@
+From e938fd3c94cd6f91fed4eb8aa217ec855dd4f00b Mon Sep 17 00:00:00 2001
+From: Slaven Rezic <slaven at rezic.de>
+Date: Sun, 27 Apr 2014 20:50:58 +0200
+Subject: [PATCH 05/10] update comment about freetype.h location
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ myConfig | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/myConfig b/myConfig
+index 3ca8144..a498b3a 100755
+--- a/myConfig
++++ b/myConfig
+@@ -147,12 +147,12 @@ sub Ift
+ {
+  foreach (map { "$_/freetype2" } @_)
+   {
+-   if (-r "$_/freetype.h") # location in Debian (since jessie)
++   if (-r "$_/freetype.h") # location in Debian (since jessie) and in newer versions of the FreeBSD port
+     {
+      print "Using -I$_ to find $_/freetype/freetype.h\n";
+      return "-I$_";
+     }
+-   if (-r "$_/freetype/freetype.h") # location in FreeBSD (up to version 10.0) and Debian (up to wheezy)
++   if (-r "$_/freetype/freetype.h") # location in FreeBSD (older versions of freetype2 port) and Debian (up to wheezy)
+     {
+      print "Using -I$_ to find $_/freetype/freetype.h\n";
+      return "-I$_";
+-- 
+1.9.3
+
diff --git a/perl-Tk.spec b/perl-Tk.spec
index c711ef5..8fcfd96 100644
--- a/perl-Tk.spec
+++ b/perl-Tk.spec
@@ -4,7 +4,7 @@
 Name:           perl-Tk
 # devel version fix for perl 5.14: 
 Version:        804.032
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Perl Graphical User Interface ToolKit
 
 Group:          Development/Libraries
@@ -16,11 +16,21 @@ Patch0:         perl-Tk-widget.patch
 Patch1:         perl-Tk-debian.patch.gz
 # fix segfaults as in #235666 because of broken cashing code
 Patch2:         perl-Tk-seg.patch
-# Fix freetype detection with 2.5
-Patch4:         perl-Tk-freetype25.patch
+# Fix freetype detection with 2.5, CPAN RT#98480
+Patch3:         Tk-804.032-look-also-for-usr-include-freetype2-freetype.h.patch
+# Fix creating a window with perl 5.20, bug #1141117, CPAN RT#96280
+Patch4:         Tk-804.032-no-segfaults-if-Tk-MainWindow-Create-was-called-with.patch
+# Fix creating a window with perl 5.20, bug #1141117, CPAN RT#96280
+Patch5:         Tk-804.032-test-case-for-Tk-MainWindow-Create-without-args.patch
+# Fix freetype detection with 2.5, CPAN RT#98480
+Patch6:         Tk-804.032-update-comment-about-freetype.h-location.patch
+# Fix race in tests
+Patch7:         Tk-804.032-fix-race-condition-in-errordialog.t.patch
+
 
 # Versions before this have Unicode issues
 BuildRequires:  perl-devel >= 3:5.8.3
+BuildRequires:  freetype-devel
 BuildRequires:  libjpeg-devel
 BuildRequires:  libpng-devel
 BuildRequires:  libX11-devel
@@ -79,7 +89,15 @@ chmod -x pod/Popup.pod Tixish/lib/Tk/balArrow.xbm
 # patch to fix #235666 ... seems like caching code is broken
 %patch2 -p1 -b .seg
 # freetype-2.5 detection
+%patch3 -p1
+# perl 5.20
 %patch4 -p1
+# perl 5.20
+%patch5 -p1
+# freetype-2.5 detection
+%patch6 -p1
+# test race
+%patch7 -p1
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor X11LIB=%{_libdir} XFT=1
@@ -126,6 +144,10 @@ find __demos/ -type f -exec chmod -x {} \;
 
 
 %changelog
+* Fri Sep 12 2014 Petr Pisar <ppisar at redhat.com> - 804.032-4
+- Fix freetype detection
+- Fix creating a window with perl 5.20 (bug #1141117)
+
 * Tue Aug 26 2014 Jitka Plesnikova <jplesnik at redhat.com> - 804.032-3
 - Perl 5.20 rebuild
 



More information about the perl-devel mailing list