All of lore.kernel.org
 help / color / mirror / Atom feed
* script to check for guaranteed-to-crash-your-app warnings
@ 2004-01-06 21:41 David Mosberger
  2004-01-06 21:46 ` Randolph Chung
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Mosberger @ 2004-01-06 21:41 UTC (permalink / raw)
  To: linux-ia64

OK, as "threatened" this morning, I wrote the attached Python script
to scan the output of "gcc -Wall -O" for warnings that are almost
guaranteed to cause crashes on ia64.  This won't help much for apps
that are hopelessly 64-bit-dirty, but it will help those apps which
are basically 64-bit clean, save for some silly oversights (like
missing header-file includes).

I tested this with a made-up program and it caught all the cases I
tested.  Then I ran it on the output of an Evolution build (which was
already fixed to more or less work on ia64).  Even so, the script
found two additional problems:

$ check-implicit-pointer-functions < ./log
Function `strdup' implicitly converted to pointer at e-pilot-util.c:42
Function `e_path_to_physical' implicitly converted to pointer at mail-importer.c:98

I reviewed the log file manually and these look like the only real
(obvious) bugs, so for this particular example, there are neither
false positives nor false negatives (both are possible in theory, of
course).

Does Debian (and other distros) keep the log files of package builds?
If so, it would be interesting to run the script over those log files
and see what else crops up.

Enjoy,

	--david

PS: I'll submit a Debian bug report for the Evolution problems found
    above.

#!/usr/bin/env python

#
# Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
#	David Mosberger <davidm@hpl.hp.com>
#
# Scan standard input for GCC warning messages that are likely to
# source of real 64-bit problems.  In particular, see whether there
# are any implicitly declared functions whose return values are later
# intepreted as pointers.  Those are almost guaranteed to cause
# crashes.
#
import re
import sys

implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration "
                              + "of function `([^']*)'")
pointer_pattern = re.compile("([^:]*):(\d+): warning: "
                             + "(assignment"
                             + "|initialization"
                             + "|return"
                             + "|passing arg \d+ of `[^']*'"
                             + "|passing arg \d+ of pointer to function"
                             + ") makes pointer from integer without a cast")
while True:
    line = sys.stdin.readline()
    if line = '':
        break
    m = implicit_pattern.match(line)
    if m:
        last_implicit_filename = m.group(1)
        last_implicit_linenum = int(m.group(2))
        last_implicit_func = m.group(3)
    else:
    	m = pointer_pattern.match(line)
        if m:
            pointer_filename = m.group(1)
            pointer_linenum = int(m.group(2))
            if (last_implicit_filename = pointer_filename
                and last_implicit_linenum = pointer_linenum):
                print "Function `%s' implicitly converted to pointer at " \
                      "%s:%d" % (last_implicit_func, last_implicit_filename,
                                 last_implicit_linenum)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: script to check for guaranteed-to-crash-your-app warnings
  2004-01-06 21:41 script to check for guaranteed-to-crash-your-app warnings David Mosberger
@ 2004-01-06 21:46 ` Randolph Chung
  2004-01-07  1:46 ` David Mosberger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Randolph Chung @ 2004-01-06 21:46 UTC (permalink / raw)
  To: linux-ia64

> Does Debian (and other distros) keep the log files of package builds?
> If so, it would be interesting to run the script over those log files
> and see what else crops up.

see http://buildd.debian.org/

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: script to check for guaranteed-to-crash-your-app warnings
  2004-01-06 21:41 script to check for guaranteed-to-crash-your-app warnings David Mosberger
  2004-01-06 21:46 ` Randolph Chung
@ 2004-01-07  1:46 ` David Mosberger
  2004-01-07  1:56 ` David Mosberger
  2004-01-07  4:48 ` David Mosberger
  3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2004-01-07  1:46 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Tue, 6 Jan 2004 13:46:52 -0800, Randolph Chung <tausq@debian.org> said:

  >> Does Debian (and other distros) keep the log files of package
  >> builds?  If so, it would be interesting to run the script over
  >> those log files and see what else crops up.

  Randolph> see http://buildd.debian.org/

"They" don't make it easy, do they??

So here is what I did: I ran the attached debian-fetch-log script to
fetch as many build-log files as possible from the 1282 packages
listed in /var/lib/dpkg/available on my "unstable" machine.  That
netted 485 log files (see second attachement) on which I ran the
checker script:

 $ debian-fetch-log $(fgrep Package: /var/lib/dpkg/available | cut -f2 -d' ')
 $ for f in *.log; do echo checking $f...; \
	cat $f | ~/scripts/check-implicit-pointer-functions ; done
   :
 checking gnome-iconedit.log...
 Function `ie_model_get_pixel' implicitly converted to pointer at grid.c:417
 Function `ie_model_get_pixel' implicitly converted to pointer at mode.c:54
   :
 checking gnome-media.log...
 Function `device_from_name' implicitly converted to pointer at prefs.c:119
   :
 checking libgsm.log...
 Function `fdopen' implicitly converted to pointer at src/toast.c:510

I verified that gnome-iconedit can be crashed easily by selecting the
"color-picker" tool in the left bar and clicking on a icon-pixel.  I
didn't check gnome-memdia or libgsm, but I have high confidence that
the reported problems are indeed real bugs.

Anyone willing to help me get bug-reports/patches filed against these
packages?

Thanks,

	--david

<--- debian-fetch-log --><--- debian-fetch-log --><--- debian-fetch-log -->
#!/bin/sh
# fetch the log file for packages $*
tmpfile=$(mktemp)
for pkg in $*; do
    echo -n "Fetching log for package $pkg: "
    version=$(dpkg -s $pkg | grep '^Version: ' | cut -f2 -d' ')
    if [ -z "$version" ]; then
	echo "No version found"
	continue
    fi
    srcpkg=$(dpkg -s $pkg | grep '^Source: ' | cut -f2 -d' ')
    if [ -n "$srcpkg" ]; then
	pkg=$srcpkg
    fi
    socksify wget --quiet -O$tmpfile "http://buildd.debian.org/build.php?arch=ia64&pkg=$pkg"
    line=$(fgrep $version $tmpfile)
    vpattern=$(echo $version | sed 's,\(.\),[\1],g')
    uri=$(expr "$line" : ".*>$vpattern</a> (latest build at <a href=\"\([^\"]*\)\"")
    if [ -n "$uri" ]; then
	socksify lynx --dump "http://buildd.debian.org/$uri" > $pkg.log
	echo "OK"
    else
	echo "Failed"
    fi
done
rm -f $tmpfile

<-- checked package list -->
a2ps
a52dec
aalib
abiword
acl
adns
afio
alsa-lib
analog
anjuta
apmd
apt
aptitude
arts
asclock
aspell-en
aspell
at-spi
at
atk1.0
attr
audiofile
aumix
base-files
base-passwd
bc
biff
bigloo
bind9
binutils
bison
bluefish
bluez-libs
bluez-pin
bluez-sdp
bluez-utils
bonnie++
bonobo-activation
bonobo-conf
bonobo
bsd-finger
bsdmainutils
build-essential
byacc
bzip2
c2man
cdparanoia
cflow
console-tools
control-center
coreutils
cpio
cramfs
cron
csh
cupsys
curl
cutils
cvs
cxref
cyrus-sasl
cyrus-sasl2
dante
dash
db1-compat
db2
db4.0
db4.1
dbus
debianutils
devhelp
devscripts
dhcp
dia
dialog
dictd
diff
diffstat
docbook-to-man
dosfstools
doxygen
dpkg
e2fsprogs
ed
eel
eel2
eject
emacs21
enlightenment
enscript
esound
eterm
ethereal
etherwake
ethtool
evolution
exim
expat
expect
exuberant-ctags
fam
fbset
fdutils
file
findutils
flac
flex
fnlib
fontconfig
fortune-mod
freetype
freetype1
fribidi
ftnchek
fweb
gail
gal
gal2
gawk
gconf
gconf2
gdb
gdbm
gdbm173
gdk-pixbuf
gdkxft
gdm
gettext
gimp-print
gimp
gkrellm-gnome
gkrellm-radio
gkrellm-volume
gkrellm
gkrellmms
glade-2
gle
glib1.2
glib2.0
gmp
gnet1.1
gnome-alsamixer
gnome-applets
gnome-breakout
gnome-core
gnome-desktop
gnome-iconedit
gnome-libs
gnome-media
gnome-panel
gnome-pilot
gnome-print
gnome-session
gnome-terminal
gnome-themes
gnome-utils
gnome-vfs
gnome-vfs2
gnubiff
gnumeric
gnutls5
gnutls7
gperf
gpm
gqview
grep
groff
gs
gst-plugins
gstreamer
gtk+1.2
gtk+2.0
gtk-doc
gtk-industrial-engine
gtk-smooth-engine
gtk2-engines
gtkdiff
gtkhtml
gtkhtml3.0
gtksourceview
gtkspell
gtranslator
gucharmap
guile-1.6
guile-core
gv
heimdal
help2man
hermes1
host
hostname
html2text
ifupdown
imagemagick
imlib+png2
imlib
imlib2
indent
ipchains
iproute
iptables
ispell
jade
kbackup
kdebase
kdelibs
knews
koffice
krb4
krb5
lcms
less
lesstif1-1
libabz
libao
libapt-pkg-perl
libart-lgpl
libast1
libber
libbonobo
libbonoboui
libcap
libcapplet
libdbd-mysql-perl
libdbi-perl
libdebug
libdv
libdvbpsi
libdvbpsi2
libdvdplay
libdvdread
libedit
libelf
libgc
libgcrypt
libgcrypt7
libgd
libgd2
libgda2
libghttp
libglade
libglade2
libgnome
libgnomecanvas
libgnomedb
libgnomeprint
libgnomeui
libgpg-error
libgsf
libgsm
libgtk-perl
libgtkhtml2
libgtop
libgtop2
libhtml-parser-perl
libid3tag
libident
libidl
libidn
libjcode-pm-perl
libjpeg6b
liblocale-gettext-perl
liblockfile
libmad
libmikmod
libmng
libmrproject
libmysqlclient-lgpl
libnss-db
libogg
libole2
libopenobex
libpaper
libpcap
libpng
libpng3
libproplist
librep
librsvg
librsvg2
libsdl1.2
libsigc++-1.2
libsigc++
libsoup
libsynce
libtasn1
libtext-charwidth-perl
libtext-iconv-perl
libtextwrap
libtool
libungif4
libunicode
libusb
libvorbis
libwmf
libwnck
libxml-parser-perl
libxml
libxml2
libxmltok
libxslt
libzvt
linc
linux-kernel-headers
lirc
liwc
logrotate
lpr
lsof
lwm
lynx
lzo
m4
magicfilter
mailx
make
man-db
mawk
mc
medusa
menu
metacity-setup
metacity
metamail
mgp
minicom
module-init-tools
modutils
moon-buggy
mozilla
mpack
mpg321
mtools
mtr
multisync
mutt
mysql-dfsg
nano
nas
nautilus
nautilus1
ncftp
ncurses
net-tools
netcat
netkit-base
netkit-ftp
netkit-rsh
netkit-telnet
netpbm-free
newt
nfs-utils
nmh
ntp
nvi
oaf
opencdk
opencdk8
openldap2
openslp
openssh
openssl
openssl096
orbit
orbit2
pam
pan
pango1.0
patch
pciutils
pcre3
pdksh
perl-tk
perl
perlftlib
pilot-link
pkgconfig
popt
portmap
postgresql
powermgmt-base
ppp
procmail
procps
psmisc
pspell-ispell
pspell
psutils
pyorbit
python-gnome2
python-gtk2
python-iconvcodec
python-numeric
python1.5
python2.1
python2.2
python2.3
qt-x11-free
qt-x11
quake2
rcs
rdist
readline4
recode
rep-gtk
rplay
rpm
rsync
rxvt
sawfish
schedutils
screen
scrollkeeper
scsiadd
sdl-mixer1.2
sed
setserial
shadow
sharutils
slang
smpeg
sox
speex
startup-notification
strace
swfdec
symlinks
synce-dccm
sysklogd
sysstat
sysvinit
t1lib
tasksel
tcl8.3
tcl8.4
tcp-wrappers
tcpdump
tcsh
tetex-bin
texinfo
tftp-hpa
tiff
time
tin
tinysnmp
tk8.3
tk8.4
traceroute
tree
tuxracer
ucd-snmp
unzip
update
usbutils
usbview
uw-imap
vacation
vim
vlc
vm
vte
vtwm
w3c-libwww
wget
whois
wmaker
xaw3d
xchat
xcursor
xfree86
xft
xft2
xgalaga
xli
xmms
xosd
xpaint
xpdf
xrender
xscreensaver
xzgv
yelp
zip
zlib
zsh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: script to check for guaranteed-to-crash-your-app warnings
  2004-01-06 21:41 script to check for guaranteed-to-crash-your-app warnings David Mosberger
  2004-01-06 21:46 ` Randolph Chung
  2004-01-07  1:46 ` David Mosberger
@ 2004-01-07  1:56 ` David Mosberger
  2004-01-07  4:48 ` David Mosberger
  3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2004-01-07  1:56 UTC (permalink / raw)
  To: linux-ia64

Argh, the situation must be worse than what I reported, since
"evolution" didn't show up at all!  evolution was missed because lynx
by default wraps lines after 80 columns.  I fixed the fetch-log script
and am rerunning it now.  I'm sure this would be a lot easier to do
for someone who has direct access to the log files...

	--david

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: script to check for guaranteed-to-crash-your-app warnings
  2004-01-06 21:41 script to check for guaranteed-to-crash-your-app warnings David Mosberger
                   ` (2 preceding siblings ...)
  2004-01-07  1:56 ` David Mosberger
@ 2004-01-07  4:48 ` David Mosberger
  3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2004-01-07  4:48 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Tue, 6 Jan 2004 17:56:31 -0800, David Mosberger <davidm@linux.hpl.hp.com> said:

  David> Argh, the situation must be worse than what I reported, since
  David> "evolution" didn't show up at all!  evolution was missed
  David> because lynx by default wraps lines after 80 columns.  I
  David> fixed the fetch-log script and am rerunning it now.  I'm sure
  David> this would be a lot easier to do for someone who has direct
  David> access to the log files...

OK, here is a more credible list of offenders.  Several critical
packages are affected.  I already filed patches for gnumeric and
evolution, so those you don't need to worry about (I listed them for
completeness below).  List of all other affected packages:

	dia
	gnome-iconedit
	gnome-media
	gnumeric
	libgda2
	libgnomedb
	libgsm
	libtk-perl
	metacity-setup
	rep-gtk
	vlc

libgtk-perl looks to be in particularly bad shape.  Perhaps nobody
cares about that one.  libgda2, libgnomedb, metacity-setup, rep-gtk
seem fairly fundamental, on the other hand.

	--david

---
Here is the detailed output:

checking dia.log...
Function `pango_ft2_get_context' implicitly converted to pointer at app_procs.c:396
Function `pango_ft2_get_context' implicitly converted to pointer at app_procs.c:396

checking evolution.log...
Function `strdup' implicitly converted to pointer at e-pilot-util.c:42
Function `e_path_to_physical' implicitly converted to pointer at mail-importer.c:98

checking gnome-iconedit.log...
Function `ie_model_get_pixel' implicitly converted to pointer at grid.c:417
Function `ie_model_get_pixel' implicitly converted to pointer at mode.c:54

checking gnome-media.log...
Function `device_from_name' implicitly converted to pointer at prefs.c:119

checking gnumeric.log...
Function `gtk_menu_item_new_with_label' implicitly converted to pointer at ../../../src/dialogs/dialog-printer-setup.c:846

checking libgda2.log...
Function `gda_type_to_string' implicitly converted to pointer at gda-sqlite-provider.c:675

checking libgnomedb.log...
Function `BONOBO_WINDOW' implicitly converted to pointer at glade-gnomedb.c:53

checking libgsm.log...
Function `fdopen' implicitly converted to pointer at src/toast.c:510

checking libgtk-perl.log...
Function `newSVGtkObjectRef' implicitly converted to pointer at GdkPixbufLoader.c:39
Function `SvGtkObjectRef' implicitly converted to pointer at GdkPixbufLoader.c:58
Function `SvGtkXmHTMLCallbackStruct' implicitly converted to pointer at GtkXmHTML.c:1024
Function `SvGdkImlibImage' implicitly converted to pointer at GnomeCanvasItem.xs:32
Function `newSVGdkImlibImage' implicitly converted to pointer at GnomeCanvasItem.xs:63
Function `newSVGtkObjectRef' implicitly converted to pointer at GnomePrinter.c:40
Function `SvGtkObjectRef' implicitly converted to pointer at GnomePrinter.c:57
Function `newSVDefEnumHash' implicitly converted to pointer at GnomePrinter.c:69
Function `SvGtkObjectRef' implicitly converted to pointer at GnomePrintMasterPreview.c:36
Function `newSVGtkObjectRef' implicitly converted to pointer at GnomePrintMasterPreview.c:49
Function `newSVGtkObjectRef' implicitly converted to pointer at GnomePrinterWidget.c:39
Function `SvGtkObjectRef' implicitly converted to pointer at GnomePrinterWidget.c:57
Function `newSVGtkObjectRef' implicitly converted to pointer at GnomePrinterDialog.c:39
Function `SvGtkObjectRef' implicitly converted to pointer at GnomePrinterDialog.c:57
Function `SvGtkObjectRef' implicitly converted to pointer at GnomePrintDialog.c:34
Function `newSVDefEnumHash' implicitly converted to pointer at GnomePrintDialog.c:46
Function `newSVGtkObjectRef' implicitly converted to pointer at GnomePrintDialog.c:131
Function `newSVGtkObjectRef' implicitly converted to pointer at GnomePrintMaster.c:39
Function `SvGtkObjectRef' implicitly converted to pointer at GnomePrintMaster.c:57

checking metacity-setup.log...
Function `gnome_vfs_get_file_mime_type' implicitly converted to pointer at callbacks.c:68

checking rep-gtk.log...
Function `gnome_geometry_string' implicitly converted to pointer at gnomeui-glue.c:1275

checking vlc.log...
Function `NPP_GetJavaClass' implicitly converted to pointer at support/npunix.c:341

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-07  4:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-06 21:41 script to check for guaranteed-to-crash-your-app warnings David Mosberger
2004-01-06 21:46 ` Randolph Chung
2004-01-07  1:46 ` David Mosberger
2004-01-07  1:56 ` David Mosberger
2004-01-07  4:48 ` David Mosberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.