[ xdvi-Bugs-2868509 ] Crash on NetBSD/sparc64

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.tex.xdvi.devel
Message-ID <[email protected]>
Bugs item #2868509, was opened at 2009-09-28 02:26
Message generated for change (Comment added) made by stefanulrich
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=377580&aid=2868509&group_id=23164

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: X interface
Group: incorrect behaviour
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Holger Weiss (hweiss)
Assigned to: Stefan Ulrich (stefanulrich)
Summary: Crash on NetBSD/sparc64

Initial Comment:
On NetBSD/sparc64 5.0.1 (with XFree86 4.5.0 running on a remote NetBSD/i386
system), xdvik crashes with a bus error on startup.  I can reproduce this with
version 22.84.14 as shipped with TeX Live 2008, with version 22.84.16, and with
the current CVS code.  Here's the backtrace and the code in question (from CVS
HEAD):

------------------------------ &< ------------------------------

Program received signal SIGBUS, Bus error.
0x000000004166a18c in _XData32 () from /usr/X11R6/lib/libX11.so.6
(gdb) where
#0  0x000000004166a18c in _XData32 () from /usr/X11R6/lib/libX11.so.6
#1  0x0000000041690b04 in XChangeProperty () from /usr/X11R6/lib/libX11.so.6
#2  0x000000000017840c in run_dvi_file (
    filename=0x3586f0 "/usr/local/sw/texlive/2008/texmf-dist/doc/latex/bardiag/example/diagrams.dvi", data=0x358b08) at xdvi.c:3010
#3  0x000000000014bb38 in main (argc=2, argv=0xffffffffffffad78) at main.c:1277
(gdb) list xdvi.c:3000,3015
3000        /* Store window id for use by src_client_check().  */
3001        {
3002    #if !(defined(WORD64) || defined(LONG64))
3003            xuint32 data = XtWindow(globals.widgets.top_level);
3004            XChangeProperty(DISP, DefaultRootWindow(DISP),
3005                            atom_xdvi_windows(), atom_xdvi_windows(), 32,
3006                            PropModePrepend, (unsigned char *)&data, 1);
3007    #else
3008            unsigned char data[4];
3009            set_window_id(XtWindow(globals.widgets.top_level), data);
3010            XChangeProperty(DISP, DefaultRootWindow(DISP),
3011                            atom_xdvi_windows(), atom_xdvi_windows(), 32,
3012                            PropModePrepend, data, 1);
3013    #endif
3014            set_dvi_property();
3015        }

------------------------------ &< ------------------------------

The problem seems to be that (on SPARC) the value handed over to the
XChangeProperty() call must be 32-bit aligned in this case, which the
data array is not.  The attached patch fixes the issue for me.

(Apart from that, the comment which talks about src_client_check()
should probably be updated, as this function no longer exists.)

----------------------------------------------------------------------

>Comment By: Stefan Ulrich (stefanulrich)
Date: 2010-01-13 21:45

Message:
Applied fix to CVS version (22.84.17-CVS4)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=377580&aid=2868509&group_id=23164

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.