GNOME Bugzilla – Bug 104160
Dialog for missing files in /proc
Last modified: 2004-12-22 21:47:04 UTC
Package: gnome-applets Severity: critical Version: GNOME2.2.0 0 os_details: Gnome.Org Synopsis: battstat-applet crashes Bugzilla-Product: gnome-applets Bugzilla-Component: battery BugBuddy-GnomeVersion: 2.0 (2.1.90) Description: Description of Problem: Whenever I try to load the battstat applet, it segfaults. Steps to reproduce the problem: 1. Load battstat-applet-2 Actual Results: crash Expected Results: load battery applet in panel How often does this happen? everytime Additional Information: (I'm not sure what information would be useful because I'm new at this, but if you let me know what you need, I'll do my best to provide it to you) ------- Bug moved to this database by unknown@bugzilla.gnome.org 2003-01-22 11:42 ------- Reassigning to the default owner of the component, gnome-applets-maint@bugzilla.gnome.org.
Please include a backtrace of the crash using bug-buddy or gdb. See http://bugzilla.gnome.org/getting-traces.cgi for more information. Thanks.
Backtrace was generated from '/usr/lib/battstat-applet-2' (no debugging symbols found)... Core was generated by `/usr/lib/battstat-applet-2 --oaf-activate-iid=OAFIID:GNOME_BattstatApplet_Facto'. Program terminated with signal 11, Segmentation fault. (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...#0 0x403fc092 in pthread_mutex_lock () from /lib/i686/libpthread.so.0
+ Trace 33021
Thread 1 (process 3478)
Is this really GNOME 2.2 or 2.0?
I found the source of the bug... it is not Gnome related. The problem is with the Dell BIOS and the handling of power managamenet. Usinger kernel 2.4.19, the battstat applet works. Anything higher (2.4.20 or greater) causes some problems.
In acpi-linux.c: in acpi_linux_read () about line 189, the code reads: procdir=opendir("/proc/acpi/battery/"); while ((procdirentry=readdir(procdir))) The problem is that opendir will return NULL if the directory does not exists (this happens when you don't have the battery.o module loaded). So the code does no check for NULL and passes it to readdir which segfaults. about the line 228, the same problem happens with the "ac_adapter" dir, which is not present until you load the ac.o module. other than that, after loading the needed modules, it works great. It will be easy to just check for "procdir == NULL", but IMHO, the applet should also tell the user that he lacks "battery/ac" information support.
Created attachment 15910 [details] [review] Proposed patch to avoid the crash
The patch fixes the bug, which is good (tm). But please, please, if the situation I explained happens, there is a good chance to give feedback to the user. Anyway knowing the code can put a simple dialog?
Adding PATCH keyword and setting priority->high because of the patch.
Patch applied. Thanks Manuel
Kevin: Resolved->fixed? Or do you want to wait until a dialog to inform the user of the missing directory is written?
Changing summary and retriaging
We should either file a new bug to make sure we support the new /proc/acpi format or change the title of this one. This needs to be fixed on the gnome-2-2 branch as well because it crashes on a newer 2.4.x kernel which will probably be coupled with GNOME 2.2.x on a lot of distros in the future.
*** Bug 118453 has been marked as a duplicate of this bug. ***
Kjartan: Go ahead and commit to the gnome-2-2 branch.
Hmm. I guess there's no new format in there I was just looking at it with no acpi modules loaded. Anyway, I still can't get the actual battery info while using ACPI here. Where is it supposed to be stored?
More of my confusion wrt ACPI. Closing as fixed.