Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 328137 - sys-apps/lcdtest segfaults when trying to initialize font
Summary: sys-apps/lcdtest segfaults when trying to initialize font
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Tony Vroon (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-13 17:55 UTC by Karl Hakimian
Modified: 2013-04-21 10:04 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to make help_font.c work with SDL. (hf.patch,76.44 KB, patch)
2010-07-13 18:27 UTC, Karl Hakimian
Details | Diff
lcdtest-1.18.ebuild (lcdtest-1.18.ebuild,929 bytes, text/plain)
2010-08-31 14:43 UTC, Gavin Pryke
Details
lcdtest-1.18-SConscript.patch (lcdtest-1.18-SConscript.patch,1.09 KB, patch)
2010-08-31 14:44 UTC, Gavin Pryke
Details | Diff
lcdtest-1.18-font-path.patch (lcdtest-1.18-font-path.patch,382 bytes, patch)
2010-08-31 14:44 UTC, Gavin Pryke
Details | Diff
lcdtest-1.18.ebuild (lcdtest-1.18.ebuild,957 bytes, text/plain)
2010-08-31 15:25 UTC, Gavin Pryke
Details
lcdtest-1.18.ebuild (lcdtest-1.18.ebuild,954 bytes, text/plain)
2010-08-31 16:33 UTC, Gavin Pryke
Details
lcdtest-1.18.ebuild (lcdtest-1.18.ebuild,927 bytes, text/plain)
2010-12-16 13:44 UTC, Gavin Pryke
Details
lcdtest-1.18.ebuild ported to eapi5 (lcdtest-1.18.ebuild,941 bytes, text/plain)
2013-04-17 12:07 UTC, Nikoli
Details
lcdtest-1.18.ebuild (lcdtest-1.18.ebuild,962 bytes, text/plain)
2013-04-17 12:43 UTC, Nikoli
Details
lcdtest-1.18.ebuild (lcdtest-1.18.ebuild,964 bytes, text/plain)
2013-04-17 13:36 UTC, Tony Vroon (RETIRED)
Details
1.18-build-system.patch (1.18-build-system.patch,1.99 KB, patch)
2013-04-17 13:37 UTC, Tony Vroon (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Hakimian 2010-07-13 17:55:28 UTC
After recent font upgrades on my system, lcdtest segfaults on starting. A system with a working lcdtest stayed working after the font upgrades until I re-emerged lcdtest. At that point, it segfaulted on startup.

Reproducible: Always

Steps to Reproduce:
1. Start with an up to date stable system
2. emerge lcdtest
3. run lcdtest

Actual Results:  
Segmentation fault

Expected Results:  
Should run lcdtest

I re-compiled lcdtest with debugging. The segfault is associated with fonts.

anduril src # gdb lcdtest
GNU gdb (Gentoo 7.0.1 p1) 7.0.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /var/tmp/portage/sys-apps/lcdtest-1.08-r1/work/lcdtest-1.08/src/lcdtest...done.
(gdb) r
Starting program: /var/tmp/portage/sys-apps/lcdtest-1.08-r1/work/lcdtest-1.08/src/lcdtest 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000402ea7 in SFont_Write (Surface=0x649360, Font=0x0, x=0, y=0, text=0x4032d0 "press / or ? for help") at SFont.c:121
121         srcrect.h = dstrect.h = Font->Surface->h - 1;
(gdb) bt
#0  0x0000000000402ea7 in SFont_Write (Surface=0x649360, Font=0x0, x=0, y=0, text=0x4032d0 "press / or ? for help") at SFont.c:121
#1  0x00000000004013e6 in create_help_image (message=0x60d120, width=230, height=30) at lcdtest.c:147
#2  0x000000000040283d in main (argc=1, argv=0x7fffffffdfc8) at lcdtest.c:676
(gdb) l
116             return;
117
118         // these values won't change in the loop
119         srcrect.y = 1;
120         dstrect.y = y;
121         srcrect.h = dstrect.h = Font->Surface->h - 1;
122
123         for(c = text; *c != '\0' && x <= Surface->w ; c++) {
124             charoffset = ((int) (*c - 33)) * 2 + 1;
125             // skip spaces and nonprintable characters
(gdb)
Comment 1 Karl Hakimian 2010-07-13 18:10:53 UTC
Looks like the problem start with loading the XPM file. I added a statement to print the error.

IMG_ReadXPMFromArray: colour parse error
Comment 2 Karl Hakimian 2010-07-13 18:26:22 UTC
Looks like the issue is help_font.c and SDL. SDL does not like the file. I loaded it in xv and re-saved it and things work fine. I will attach a patch that will make the new help_font.c file.
Comment 3 Karl Hakimian 2010-07-13 18:27:00 UTC
Created attachment 238633 [details, diff]
Patch to make help_font.c work with SDL.
Comment 4 Karl Hakimian 2010-07-13 18:56:02 UTC
Digging in deeper, I see that this patch does not help since the xpm is built on the fly. Looks like netpbm is producing a file that SDL does not like. I re-emerge netpbm and that did not help. Still looking for a good fix.
Comment 5 Karl Hakimian 2010-07-13 19:03:00 UTC
A file created by imagemagick instead of netpbm works fine. If having imagemagick as a dependency is not desirable, maybe producing a good file and simply copying it in is what should be done.
Comment 6 rafnov 2010-08-12 09:46:10 UTC
I can confirm that segfault on x86 too.
Comment 7 Gavin Pryke 2010-08-31 14:42:34 UTC
I came across this just now so I have bumped lcdtest to 1.18 in my overlay and converted the ebuild to use scons. It includes 2 patches, one for the SConscript file for obeying CC/LDFLAGS and another to find the correct path of LiberationMono-Regular.ttf. I'm not sure this is the correct thing to do but at least the package works for me now. I omitted the 1.08-help-option.patch as I'm not sure what that fixes, that may be needed too.
Attached files follow.
Thanks.
Comment 8 Gavin Pryke 2010-08-31 14:43:54 UTC
Created attachment 245489 [details]
lcdtest-1.18.ebuild
Comment 9 Gavin Pryke 2010-08-31 14:44:28 UTC
Created attachment 245490 [details, diff]
lcdtest-1.18-SConscript.patch
Comment 10 Gavin Pryke 2010-08-31 14:44:48 UTC
Created attachment 245492 [details, diff]
lcdtest-1.18-font-path.patch
Comment 11 Gavin Pryke 2010-08-31 15:25:50 UTC
Created attachment 245496 [details]
lcdtest-1.18.ebuild

I forgot the media-libs/sdl-ttf dependency. Sorry for the noise.
Comment 12 Gavin Pryke 2010-08-31 16:33:59 UTC
Created attachment 245500 [details]
lcdtest-1.18.ebuild

edited dependencies again, I hope it's better this time...
Comment 13 Kevin Williams 2010-11-17 19:23:29 UTC
Confirm that the proposed ebuild lcdtest-1.18 and two patches have resolved the segfault issue for me on x86_64.
Comment 14 David Fellows 2010-12-07 03:34:18 UTC
I can confirm a)that 1.08 segfaults on startup on amd64 and
              b)the proposed 1.18 ebuild plus the two patches works as expected on amd64.
Comment 15 Gavin Pryke 2010-12-07 13:55:15 UTC
Thanks for the reports.

I think the font path patch should maybe use sed instead, also the ebuild could make use of the scons eclass which it does not at the moment.

A bit pressed for time right now as I'm about to go for surgery in a few hours, all going well I will take a look and clean it up when I get some time.

Thanks again.
Comment 16 Gavin Pryke 2010-12-16 13:43:18 UTC
Updated ebuild.

Changes:
bump to EAPI=2 as the sdl deps use it anyway
remove font path patch and sed the source from inside the ebuild instead
make use of scons-utils.eclass
cleanup deps and ebuild according to EAPI change and the use of scons eclass

Files follow, thanks.
Comment 17 Gavin Pryke 2010-12-16 13:44:47 UTC
Created attachment 257320 [details]
lcdtest-1.18.ebuild
Comment 18 Tony Vroon (RETIRED) gentoo-dev 2011-02-06 19:25:46 UTC
This package is now removed from portage, as per the e-mail sent to gentoo-dev. Unfortunately I was unable to solicit interest from other developers.
Comment 19 Nikoli 2013-04-17 12:07:41 UTC
Created attachment 345766 [details]
lcdtest-1.18.ebuild ported to eapi5

Reworked and ported to EAPI5, works fine here. Tool is useful, want to proxy maintain.
Comment 20 Tony Vroon (RETIRED) gentoo-dev 2013-04-17 12:13:26 UTC
Thank you Nikoli. Could you "inherit base" and use "base_src_prepare" and the PATCHES variable instead of using epatch. I am happy to proxy this for you.
Comment 21 Nikoli 2013-04-17 12:43:55 UTC
Created attachment 345778 [details]
lcdtest-1.18.ebuild
Comment 22 Tony Vroon (RETIRED) gentoo-dev 2013-04-17 13:11:08 UTC
Thank you. And can we follow this advice without ill effect?
scons: warning: The build_dir keyword has been deprecated; use the variant_dir keyword instead.
File "/var/tmp/portage/sys-apps/lcdtest-1.18/work/lcdtest-1.18/SConstruct", line 127, in <module>

scons: warning: The build_dir keyword has been deprecated; use the variant_dir keyword instead.
File "/var/tmp/portage/sys-apps/lcdtest-1.18/work/lcdtest-1.18/SConstruct", line 141, in <module>
Comment 23 Tony Vroon (RETIRED) gentoo-dev 2013-04-17 13:36:56 UTC
Created attachment 345780 [details]
lcdtest-1.18.ebuild
Comment 24 Tony Vroon (RETIRED) gentoo-dev 2013-04-17 13:37:13 UTC
Created attachment 345782 [details, diff]
1.18-build-system.patch
Comment 25 Tony Vroon (RETIRED) gentoo-dev 2013-04-17 13:41:17 UTC
+*lcdtest-1.18 (17 Apr 2013)
+
+  17 Apr 2013; Tony Vroon <chainsaw@gentoo.org> +files/1.18-build-system.patch,
+  +lcdtest-1.18.ebuild, +metadata.xml:
+  Reintroduction of a previously removed package. Ebuild by Gavin Pryke &
+  Nikoli; closes bug #328137.

Many thanks to you both. Nikoli, as requested you are in metadata.xml as a proxy maintainer. Any further improvements should now be filed as new bugs please.
Comment 26 Nikoli 2013-04-17 19:56:51 UTC
Strange, after emerge --sync my portage tree does not have lcdtest:
# emerge --info|grep Timestamp
Timestamp of tree: Wed, 17 Apr 2013 19:15:01 +0000

But http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/lcdtest/ tells 'Wed Apr 17 13:41:48 2013 UTC'

Any idea?
Comment 27 Nikoli 2013-04-18 05:23:25 UTC
Now after 'emerge --sync' my portage tree has lcdtest, still do not know why such delay happened.