Debian Bug report logs - #125391
xview: Missing prototypes

version graph

Package: xview; Maintainer for xview is Blars Blarson <blarson@debian.org>;

Reported by: John R.Daily <jdaily@progeny.com>

Date: Mon, 17 Dec 2001 23:48:07 UTC

Severity: normal

Tags: help, patch

Fixed in version xview/3.2p1.4-17

Done: Martin Buck <mbuck@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Martin Buck <mbuck@debian.org>:
Bug#125391; Package xview. Full text and rfc822 format available.

Acknowledgement sent to John R.Daily <jdaily@progeny.com>:
New Bug report received and forwarded. Copy sent to Martin Buck <mbuck@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: John R.Daily <jdaily@progeny.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: xview: Missing prototypes
Date: Mon, 17 Dec 2001 18:47:11 -0500
Package: xview
Version: N/A; reported 2001-12-17
Severity: normal
Tags: patch

On the IA-64, it is dangerous to have unprototyped functions that
return longs, doubles, or pointers, because the compiler assumes
that any function without a previous declaration returns an int
(which is 32 bits, as opposed to 64 for the other data types
mentioned above).

Here is a patch that makes prototypes available for all functions
that I could find in xview that return 64-bit values.

Note that I removed the #ifdef SYSV in cmdstream.c so that
string.h is pulled in for Linux. I would think that by this
point in time all modern C compilers/system C libraries
define string.h.


diff -aur xview.orig/clients/olvwm-4.1/cmdstream.c xview-3.2p1.4/clients/olvwm-4.1/cmdstream.c
--- xview.orig/clients/olvwm-4.1/cmdstream.c	Thu Jan 13 16:36:03 1994
+++ xview-3.2p1.4/clients/olvwm-4.1/cmdstream.c	Thu Dec 13 14:55:55 2001
@@ -16,11 +16,7 @@
  * ---------------------------------------------------------------------*/
 
 #include <stdio.h>
-#ifdef SYSV
 #include <string.h>
-#else
-#include <strings.h>
-#endif
 #include "cmdstream.h"
 #include "mem.h"
 
diff -aur xview.orig/clients/olvwm-4.1/gif.c xview-3.2p1.4/clients/olvwm-4.1/gif.c
--- xview.orig/clients/olvwm-4.1/gif.c	Thu Jan 13 16:36:06 1994
+++ xview-3.2p1.4/clients/olvwm-4.1/gif.c	Thu Dec 13 14:58:09 2001
@@ -10,6 +10,7 @@
 
 
 #include <stdio.h>
+#include <string.h>
 #include <X11/X.h>
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
diff -aur xview.orig/clients/olvwm-4.1/images.c xview-3.2p1.4/clients/olvwm-4.1/images.c
--- xview.orig/clients/olvwm-4.1/images.c	Sun Nov 10 09:14:04 1996
+++ xview-3.2p1.4/clients/olvwm-4.1/images.c	Thu Dec 13 14:58:58 2001
@@ -22,6 +22,7 @@
 #include "globals.h"
 #include "win.h"
 #include "menu.h"
+#include "mem.h"
 
 /*
  *      Frame/icon menu action procs
diff -aur xview.orig/clients/olvwm-4.1/kbdfuncs.c xview-3.2p1.4/clients/olvwm-4.1/kbdfuncs.c
--- xview.orig/clients/olvwm-4.1/kbdfuncs.c	Thu Jan 13 16:36:08 1994
+++ xview-3.2p1.4/clients/olvwm-4.1/kbdfuncs.c	Thu Dec 13 15:00:49 2001
@@ -42,6 +42,16 @@
 extern Client *ClientRaiseTransients();
 extern void ClientSetCurrent();
 
+/*
+ * Added to keep the compiler from assuming that all functions return
+ * ints. This is a very dangerous assumption, particularly on the IA-64
+ * platform, where pointers are not only longer than ints, but use the
+ * high-order bits which would be lost without an appropriate declaration.
+ *
+ * These really should be in a separate .h file.
+ */
+WinGeneric * lookupWindow(XEvent *event);
+
 /* ===== private functions ================================================ */
 
 
diff -aur xview.orig/lib/libxview/base/drawable.c xview-3.2p1.4/lib/libxview/base/drawable.c
--- xview.orig/lib/libxview/base/drawable.c	Tue Jun 29 00:14:41 1993
+++ xview-3.2p1.4/lib/libxview/base/drawable.c	Thu Dec 13 14:40:30 2001
@@ -15,6 +15,16 @@
 #include <xview/notify.h>
 #undef _NOTIFY_MIN_SYMBOLS
 
+/*
+ * Added to keep the compiler from assuming that all functions return
+ * ints. This is a very dangerous assumption, particularly on the IA-64
+ * platform, where pointers are not only longer than ints, but use the
+ * high-order bits which would be lost without an appropriate declaration.
+ *
+ * These really should be in a separate .h file.
+ */
+Xv_private      GC window_private_gc(Xv_opaque win_public);
+
 const char *xv_draw_info_str = "drawable_info";
 const char *xv_notptr_str = "not a pointer";
 
diff -aur xview.orig/lib/libxview/base/generic.c xview-3.2p1.4/lib/libxview/base/generic.c
--- xview.orig/lib/libxview/base/generic.c	Thu Dec 13 15:18:33 2001
+++ xview-3.2p1.4/lib/libxview/base/generic.c	Thu Dec 13 14:08:26 2001
@@ -49,6 +49,18 @@
 static Generic_node *find_node();
 static void	     delete_node();
 
+/*
+ * Added to keep the compiler from assuming that all functions return
+ * ints. This is a very dangerous assumption, particularly on the IA-64
+ * platform, where pointers are not only longer than ints, but use the
+ * high-order bits which would be lost without an appropriate declaration.
+ *
+ * These really should be in a separate .h file.
+ */
+Xv_private XrmQuarkList db_qlist_from_name(char *name,
+                                           XrmQuarkList parent_quarks);
+Xv_private Xv_opaque db_name_from_qlist(XrmQuarkList qlist);
+
 
 /* ------------------------------------------------------------------------ */
 
diff -aur xview.orig/lib/libxview/canvas/cnvs_set.c xview-3.2p1.4/lib/libxview/canvas/cnvs_set.c
--- xview.orig/lib/libxview/canvas/cnvs_set.c	Tue Jun 29 00:14:47 1993
+++ xview-3.2p1.4/lib/libxview/canvas/cnvs_set.c	Thu Dec 13 14:12:31 2001
@@ -20,6 +20,17 @@
 static void     canvas_set_bit_gravity();
 static void     canvas_append_paint_attrs();
 
+/*
+ * Added to keep the compiler from assuming that all functions return
+ * ints. This is a very dangerous assumption, particularly on the IA-64
+ * platform, where pointers are not only longer than ints, but use the
+ * high-order bits which would be lost without an appropriate declaration.
+ *
+ * These really should be in a separate .h file.
+ */
+Attr_avlist attr_copy_avlist(register Attr_avlist dest,
+                             register Attr_avlist avlist);
+
 
 Pkg_private Xv_opaque
 canvas_set_avlist(canvas_public, avlist)
diff -aur xview.orig/lib/libxview/dnd/dnd.c xview-3.2p1.4/lib/libxview/dnd/dnd.c
--- xview.orig/lib/libxview/dnd/dnd.c	Tue Jun 29 00:15:57 1993
+++ xview-3.2p1.4/lib/libxview/dnd/dnd.c	Thu Dec 13 14:20:18 2001
@@ -39,6 +39,20 @@
 extern int  DndFindSite();
 extern XID  DndGetCursor();
 
+/*
+ * Added to keep the compiler from assuming that all functions return
+ * ints. This is a very dangerous assumption, particularly on the IA-64
+ * platform, where pointers are not only longer than ints, but use the
+ * high-order bits which would be lost without an appropriate declaration.
+ *
+ * These really should be in a separate .h file.
+ */
+Xv_object xview_x_input_readevent(Display *display, register Event *event,
+                                  Xv_object req_window, int block, int type,
+                                  unsigned int xevent_mask, XEvent *rep);
+Xv_private Xv_object win_data(Display *display, XID xid);
+
+
 Xv_public int
 dnd_send_drop(dnd_public)
     Xv_object	 dnd_public;

-- System Information
Debian Release: 3.0
Architecture: ia64
Kernel: Linux butthead.progeny.com 2.4.9-itanium-smp #1 SMP Mon Sep 17 20:48:35 MDT 2001 ia64
Locale: LANG=en_US, LC_CTYPE=en_US




Information forwarded to debian-bugs-dist@lists.debian.org, Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org:
Bug#125391; Package xview. Full text and rfc822 format available.

Acknowledgement sent to Martin Buck <m@rtin-buck.de>:
Extra info received and forwarded to list. Copy sent to Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org. Full text and rfc822 format available.

Message #10 received at 125391@bugs.debian.org (full text, mbox):

From: Martin Buck <m@rtin-buck.de>
To: "John R . Daily" <jdaily@progeny.com>, 125391@bugs.debian.org
Subject: Re: Bug#125391: xview: Missing prototypes
Date: Wed, 13 Feb 2002 22:47:48 +0100
On Mon, Dec 17, 2001 at 06:47:11PM -0500, John R . Daily wrote:
> On the IA-64, it is dangerous to have unprototyped functions that
> return longs, doubles, or pointers, because the compiler assumes
> that any function without a previous declaration returns an int
> (which is 32 bits, as opposed to 64 for the other data types
> mentioned above).

I wonder why this hasn't caused problems on Alpha so far. Pointers and
longs are 64 bits there as well and the high-order bits are required for
heap memory...

BTW, do you have a test case or a program that behaves incorrectly on IA-64
so I can test the new XView before I upload it?

> Here is a patch that makes prototypes available for all functions
> that I could find in xview that return 64-bit values.

How did you find out where to add prototypes? For example, you added a
prototype for win_data() to dnd.c, but win_data() is also called in lots of
other places without a prototype in scope. I guess this needs more work :-(

Martin



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org:
Bug#125391; Package xview. Full text and rfc822 format available.

Acknowledgement sent to Martin Buck <m@rtin-buck.de>:
Extra info received and forwarded to list. Copy sent to Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org. Full text and rfc822 format available.

Message #15 received at 125391@bugs.debian.org (full text, mbox):

From: Martin Buck <m@rtin-buck.de>
To: "John R. Daily" <jdaily@progeny.com>, 125391@bugs.debian.org, control@bugs.debian.org
Subject: Re: Bug#125391: xview: Missing prototypes
Date: Fri, 15 Feb 2002 00:42:05 +0100
tags 125391 + help
thanks

On Thu, Feb 14, 2002 at 08:43:24AM -0500, John R. Daily wrote:
> > How did you find out where to add prototypes? For example, you added a
> > prototype for win_data() to dnd.c, but win_data() is also called in lots of
> > other places without a prototype in scope. I guess this needs more work :-(
> 
> I don't know that xview behaves badly on IA-64. It was one of
> many applications with implicit declaration warnings when
> -Wimplicit was added to the gcc spec file, and I used those
> warnings to track down the "dangerous" function calls.
> 
> Either I missed some warnings,

Looks like. I just did a test on IA-64 and that resulted in 2271 "implicit
declaration" warnings. :-(
Of course, not all of them do cause problems, but a lot of them will. And
guess what, none of the applications from xview-clients run, they all die
with a segfault.

Unless I find a way to automatically generate prototypes for all affected
functions, I fear I have to declare XView broken and unfixable on IA-64.
:-(

Martin



Tags added: help Request was from Martin Buck <m@rtin-buck.de> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org:
Bug#125391; Package xview. Full text and rfc822 format available.

Acknowledgement sent to "John R. Daily" <jdaily@progeny.com>:
Extra info received and forwarded to list. Copy sent to Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org. Full text and rfc822 format available.

Message #22 received at 125391@bugs.debian.org (full text, mbox):

From: "John R. Daily" <jdaily@progeny.com>
To: Martin Buck <m@rtin-buck.de>
Cc: 125391@bugs.debian.org
Subject: Re: Bug#125391: xview: Missing prototypes
Date: Thu, 14 Feb 2002 21:29:36 -0500
> Looks like. I just did a test on IA-64 and that resulted in 2271 "implicit
> declaration" warnings. :-(
> Of course, not all of them do cause problems, but a lot of them will. And
> guess what, none of the applications from xview-clients run, they all die
> with a segfault.
> 
> Unless I find a way to automatically generate prototypes for all affected
> functions, I fear I have to declare XView broken and unfixable on IA-64.
> :-(

Keep in mind that only those functions that return pointers are
of real concern. For all packages, I worked my way through the
list of functions and tried to identify the ones that did so.

Looking at the 731 functions that aren't prototyped, most of them
look like GUI operations that wouldn't return pointers.

I assume you've tried my patch, and things still crash? Compiling
with -g and without stripping or optimization would at least give
you some useful backtraces to identify functions that I missed
that are still causing problems.

I found that with emacs' compile mode and etags, hunting down all
731 functions to look for pointer return values didn't take all
that long, although obviously I missed some.

--
John R. Daily                                        jdaily@progeny.com
Projects Manager                                  Progeny Linux Systems
                 Master of the ephemeral epiphany






Information forwarded to debian-bugs-dist@lists.debian.org, Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org:
Bug#125391; Package xview. Full text and rfc822 format available.

Acknowledgement sent to Martin Buck <m@rtin-buck.de>:
Extra info received and forwarded to list. Copy sent to Martin Buck <mbuck@debian.org>, xview@packages.qa.debian.org. Full text and rfc822 format available.

Message #27 received at 125391@bugs.debian.org (full text, mbox):

From: Martin Buck <m@rtin-buck.de>
To: "John R. Daily" <jdaily@progeny.com>, 125391@bugs.debian.org
Subject: Re: Bug#125391: xview: Missing prototypes
Date: Fri, 15 Feb 2002 23:44:26 +0100
On Thu, Feb 14, 2002 at 09:29:36PM -0500, John R. Daily wrote:
> Keep in mind that only those functions that return pointers are
> of real concern.

And the ones returning longs. Unfortunately, Xv_opaque is an unsigned long
and that's about the most fundamental data type in XView. It's used to
store and pass around pointers, numbers, bitfields - basically everything
you can think of. :-(

> I assume you've tried my patch, and things still crash?

Yes, doesn't make a difference.

> Compiling
> with -g and without stripping or optimization would at least give
> you some useful backtraces to identify functions that I missed
> that are still causing problems.

That will be the next step, but debugging XView is no fun - trust me, I've
done that far too often. stdarg.h sucks. ;-)

Martin



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Buck <mbuck@debian.org>:
Bug#125391; Package xview. Full text and rfc822 format available.

Acknowledgement sent to Martin Buck <m@rtin-buck.de>:
Extra info received and forwarded to list. Copy sent to Martin Buck <mbuck@debian.org>. Full text and rfc822 format available.

Message #32 received at 125391@bugs.debian.org (full text, mbox):

From: Martin Buck <m@rtin-buck.de>
To: 125391@bugs.debian.org
Cc: "John R. Daily" <jdaily@progeny.com>
Subject: Re: Bug#125391: xview: Missing prototypes
Date: Thu, 6 Nov 2003 00:52:41 +0100
[Message part 1 (text/plain, inline)]
On Fri, Feb 15, 2002 at 11:44:26PM +0100, Martin Buck wrote:
> That will be the next step, but debugging XView is no fun - trust me, I've
> done that far too often. stdarg.h sucks. ;-)

Just a quick update on this after a looooong time: I'm about to close this
bug by exluding ia64 from the list of architectures where it should be
built. I would say it's impossible to make it work on ia64 without a huge
effort. :-(

Attached to this email is a patch containing the changes I've made so far.
In case somebody is crazy enough to put more effort into XView/ia64 in the
future, they can be used as a starting point. The changes fix some of the
problems, but unfortunately, the remaining ones are much more difficult.

The patch contains:
* Prototypes for functions returning 64 bit quantities
* An attempt to fix the problems in the stdarg-to-avlist conversion
* Some debug printfs

The major problem with XView on ia64 is ia64's handling of 64 bit values in
stdarg-functions. If you pass a 32 bit value to a stdarg-function, it will
be passed in a 64 bit slot, but the upper 32 bits are undefined. If the
stdarg-function expects a 64 bit value, it will get garbage. Since about
everything in XView uses stdarg and XView assumes in lots of places that
sizeof(int) = sizeof(long) = sizeof(void *), this causes problems.

I fixed the stdarg-to-avlist conversion function in attr/attr.c by trying
to find out which attribute types should be 32 and which ones should be 64
bit values. I'm always reading unsigned longs using va_arg, but I set the
upper 32 bits to 0 for 32 bit values. After implementing all these changes,
I noticed that some attributes are declared as int but are really pointers.
And others are declared as Xv_opaque (unsigned long) but are only 32 bit
values, so my fix can't cope with them. And checking/changing all the
attribute declarations is way too much work and would probably cause lots
of compatibility problems.

A simple fix could be to add an option to gcc that tells it to ignore the
ia64 ABI and to always initialize the upper 32 bits of stdarg-arguments to
0. If somebody is really interested in getting XView for ia64, this is
probably the easiest solution.

Martin
[ia64-20031106.diff (text/plain, attachment)]

Reply sent to Martin Buck <mbuck@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to John R.Daily <jdaily@progeny.com>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #37 received at 125391-close@bugs.debian.org (full text, mbox):

From: Martin Buck <mbuck@debian.org>
To: 125391-close@bugs.debian.org
Subject: Bug#125391: fixed in xview 3.2p1.4-17
Date: Fri, 07 Nov 2003 18:02:24 -0500
Source: xview
Source-Version: 3.2p1.4-17

We believe that the bug you reported is fixed in the latest version of
xview, which is due to be installed in the Debian FTP archive:

olvwm_4.4.3.2p1.4-17_i386.deb
  to pool/main/x/xview/olvwm_4.4.3.2p1.4-17_i386.deb
olwm_3.2p1.4-17_i386.deb
  to pool/main/x/xview/olwm_3.2p1.4-17_i386.deb
xview-clients_3.2p1.4-17_i386.deb
  to pool/main/x/xview/xview-clients_3.2p1.4-17_i386.deb
xview-examples_3.2p1.4-17_i386.deb
  to pool/main/x/xview/xview-examples_3.2p1.4-17_i386.deb
xview_3.2p1.4-17.diff.gz
  to pool/main/x/xview/xview_3.2p1.4-17.diff.gz
xview_3.2p1.4-17.dsc
  to pool/main/x/xview/xview_3.2p1.4-17.dsc
xviewg-dev_3.2p1.4-17_i386.deb
  to pool/main/x/xview/xviewg-dev_3.2p1.4-17_i386.deb
xviewg_3.2p1.4-17_i386.deb
  to pool/main/x/xview/xviewg_3.2p1.4-17_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 125391@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Buck <mbuck@debian.org> (supplier of updated xview package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Thu,  6 Nov 2003 00:55:00 +0100
Source: xview
Binary: xview-examples xview-clients olvwm olwm xviewg-dev xviewg
Architecture: source i386
Version: 3.2p1.4-17
Distribution: unstable
Urgency: low
Maintainer: Martin Buck <mbuck@debian.org>
Changed-By: Martin Buck <mbuck@debian.org>
Description: 
 olvwm      - OpenLook virtual window manager
 olwm       - Open Look Window Manager
 xview-clients - XView client programs
 xview-examples - XView contrib programs
 xviewg     - XView shared libraries [libc6]
 xviewg-dev - XView development tools [libc6]
Closes: 125391 167054 190834
Changes: 
 xview (3.2p1.4-17) unstable; urgency=low
 .
   * Removed now nonexistent xtoolplaces from Suggests: line of xview-clients.
     Closes: #190834
   * Changed /**/ in Imakefiles to XCOMM for compatibility with some
     cpp/imake versions
   * Added missing semicolons in olvwmrc.y for compatibility with some
     flex versions. Closes: #167054
   * Don't try to build on ia64 since XView is completely broken there and it's
     close to impossible to make it work. Closes: #125391
   * Fixed spelling error in copyright
   * Don't run ldconfig in 'postrm purge"
Files: 
 7c6fd7e283656aa7172a771c9958d605 722 x11 optional xview_3.2p1.4-17.dsc
 c7e2d1196bc5bcc82c834497dc42acb2 72679 x11 optional xview_3.2p1.4-17.diff.gz
 9b6c3ac72e9264e2abdf12c958190b44 687218 x11 optional xviewg_3.2p1.4-17_i386.deb
 e95587b6cd8c393b6d50265c286004ab 980640 x11 optional xviewg-dev_3.2p1.4-17_i386.deb
 97c7ac7c50cb0cfbcd245e85082dccd1 66636 x11 optional xview-clients_3.2p1.4-17_i386.deb
 f54d7d2db60928e4476c401e964823e0 226114 x11 optional xview-examples_3.2p1.4-17_i386.deb
 6f9c36b11d819905206f90148ff57786 136778 x11 optional olwm_3.2p1.4-17_i386.deb
 e93ad2f32e2ca2d83e6fed576bc6fc65 196660 x11 optional olvwm_4.4.3.2p1.4-17_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/rBE/5na4Z/jVQlkRAv+iAJ9OuSqHvUV89D3v7RNsEy0I/8xMmgCfabI8
CNF59XiNvBI2CMVkktYGbXQ=
=h2qu
-----END PGP SIGNATURE-----




Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 11:58:31 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.