Bug#351559: (fwd) Re: Bug#348513: Perl-tk segfault with texdoctk
forwarded 351559 Thomas Ruedas <tr@geol.ku.dk>
stop
Dear Thomas,
I hope the address is OK.
A user of texdoctk experienced a seg fault, when using it. The bug
was tracked doen by Niko Tyni to the patch below. Thanks to Niko!
The whole story seems to split off into three bugs:
1. texdoctk trys to use xwininfo, to determine the display
resolution, which is not always present on a Debian system (1.
bug, goes to the teTeX packager)
2. If xwininfo is not there, it uses buggy code to do that (patch
below). It seems to use the variable $deffont, without making sure
it is defined (as far as I understand - beat me if I'm wrong).
3. perl-tk does not throw an exception, but simply segfaults, when
hitting the buggy code (this bug goes to perl-tk).
Please evaluate the code in question and consider to apply it to
texdoctk.
Kind Regards,
Hilmar Preuße
----- Forwarded message from Niko Tyni <ntyni@iki.fi> -----
From: Niko Tyni <ntyni@iki.fi>
To: 348513@bugs.debian.org
Subject: Re: Bug#348513: Perl-tk segfault with texdoctk
Date: Sun, 5 Feb 2006 20:32:20 +0200
Message-ID: <20060205183220.GA1861@punk.it.helsinki.fi>
References: <20060119134502.GA24847@gmail.com> <86fynkw1co.fsf_-_@alhambra.kuesterei.ch> <[🔎] 20060202203036.GE2820@preusse> <[🔎] 86lkws8zr8.fsf@alhambra.kuesterei.ch> <[🔎] 20060203160839.GA3547@amellus.com> <[🔎] 86k6ccgz6a.fsf@alhambra.kuesterei.ch> <[🔎] 20060203170552.GQ3547@amellus.com> <[🔎] 861wykgx6h.fsf@alhambra.kuesterei.ch> <[🔎] 20060203181816.GR3547@amellus.com> <[🔎] 86zml82t1n.fsf@alhambra.kuesterei.ch>
User-Agent: Mutt/1.4.1i
On Fri, Feb 03, 2006 at 07:31:16PM +0100, Frank Küster wrote:
> > Anyone have any ideas on how to fix the segfault?
>
> That goes to the perl people.
Hi,
first of all, the segfault manifests when xbase-clients is not installed.
Specifically, texdoctk calls xwininfo to find out the display resolution.
It then uses this info to configure a Tk::Button object with a suitable
font. If xwininfo is not present, it falls back to
$Qbut->configure(-font=>$deffont);
(/usr/bin/texdoctk:1693) with $deffont undefined. The current version of
perl-tk segfaults here.
Even if there was no segfault, apparently texdoctk would benefit from
xwininfo being present, and thus tetex-bin should at least Suggest
xbase-clients. I'm cloning this as a minor bug against tetex-bin.
The correct perl-tk behaviour is to throw an exception:
font "" doesn't exist at /usr/lib/perl5/Tk/Widget.pm line 196.
This is what the sarge version of perl-tk (1:800.025-2) does. So, even
with a fixed perl-tk, texdoctk will exit with a fatal error when xwininfo
is not present. I'm cloning this as a normal bug against tetex-bin,
and including a suggested simple fix as the first attached patch.
Now for the perl-tk segfault. A minimal testcase for it is:
#!/usr/bin/perl
use Tk;
my $main = new MainWindow;
my $cmdframe = $main->Frame;
my $b = $cmdframe->Button(-font => undef);
This segfaults for at least the Button, Radiobutton and Text widgets.
After some gdb debugging, I came up with the second attached patch,
which seems to fix this and reverts to the sarge behaviour.
(patch has been taken oput be my, Hilmar)
Cheers,
--
Niko Tyni ntyni@iki.fi
--- /usr/bin/texdoctk 2006/02/05 17:08:01 1.1
+++ /usr/bin/texdoctk 2006/02/05 17:08:17
@@ -1690,7 +1690,7 @@
my @deffont=$Qbut->configure(-font);
# ensure readability on high-res screens (suggested by R.Kotucha)
$deffont='Helvetica -16 bold' if &x_resolution > 1200;
- $Qbut->configure(-font=>$deffont);
+ $Qbut->configure(-font=>$deffont) if $deffont;
$msgframe->Label(-text=>'FATAL ERROR',
-font=>$deffont)->pack(-side=>'top', -fill=>'x');
# get size of message text
----- End forwarded message -----
Reply to: