[Reportbug-maint] Bug#521496: reportbug crashes when trying to open files with bad permissions or a missing file
Carl Chenet
chaica at ohmytux.com
Fri Mar 27 21:48:04 UTC 2009
Package: reportbug
Version: 4.0
Severity: important
Tags: patch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
reportbug-4.0/reportbug/utils.py file does not check if
/etc/debian_version, /var/dpkg/status or /proc/cpuinfo are readable
before trying to open them. It leads to a reportbug crash if these files
are unreadable.
In the same idea, utils.py does not check if /proc/cpuinfo exists before
trying to read it, which leads to a crash if this file does not exist,
e.g on a system where /proc has not been mounted (chrooted environment).
Here is a really simple patch to deal with these issues.
Regards,
Carl Chenet
- -- Package-specific info:
** Environment settings:
INTERFACE="text"
** /home/chaica/.reportbugrc:
reportbug_version "4.0"
mode standard
ui text
realname "Carl Chenet"
email "chaica at ohmytux.com"
smtphost "smtp.free.fr"
- -- System Information:
Debian Release: lenny/sid
APT prefers hardy-updates
APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.24-23-generic (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages reportbug depends on:
ii apt 0.7.9ubuntu17.1 Advanced front-end for dpkg
ii python 2.5.2-0ubuntu1 An interactive high-level object-o
ii python-central 0.6.7ubuntu0.1 register and build utility for Pyt
reportbug recommends no packages.
- -- no debconf information
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFJzUmU8lge+lYYJUgRAiTEAKCAQ8xebseXmI7biwL2z0fgYr/SMgCffvN1
2XjR3fmnjYy1+plQqwqOdiw=
=ssV7
-----END PGP SIGNATURE-----
-------------- next part --------------
430c430,434
< fp = open(STATUSDB)
---
> try:
> fp = open(STATUSDB)
> except IOError, msg:
> print msg
> sys.exit(1)
658c662,666
< fob = open('/etc/debian_version')
---
> try:
> fob = open('/etc/debian_version')
> except IOError, msg:
> print msg
> sys.exit(1)
709,715c717,726
< fob = open('/proc/cpuinfo')
< for line in fob:
< if line.startswith('processor'):
< cpucount += 1
< #print repr(line), cpucount
< fob.close()
<
---
> if os.path.exists('/proc/cpuinfo'):
> try:
> fob = open('/proc/cpuinfo')
> for line in fob:
> if line.startswith('processor'):
> cpucount += 1
> #print repr(line), cpucount
> fob.close()
> except IOError, msg:
> print msg
More information about the Reportbug-maint
mailing list