Package: acpitool
Version: 0.5.1-6
Severity: normal

Hi,

running acpitool coredumps on my system:

| % acpitool
| acpitool: battery.cpp:816: int Count_Batteries_SysFS(): Assertion `findex < 
4' failed.
| [1]    1295360 abort (core dumped)  acpitool

strace-ing acpitool shows, that it seems to have troubles with
working with my /proc/acpi/battery/ and /sys/class/power_supply/:

| openat(AT_FDCWD, "/proc/acpi/battery/", 
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or 
directory)
| openat(AT_FDCWD, "/sys/class/power_supply/", 
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
| fstat(3, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
| openat(AT_FDCWD, "/sys/class/power_supply/", 
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
| fstat(4, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
| brk(0x55fbf790c000)                     = 0x55fbf790c000
| getdents64(4, 0x55fbf78e3100 /* 7 entries */, 32768) = 232
| getdents64(4, 0x55fbf78e3100 /* 0 entries */, 32768) = 0
| close(4)                                = 0
| write(2, "acpitool: battery.cpp:816: int C"..., 87acpitool: battery.cpp:816: 
int Count_Batteries_SysFS(): Assertion `findex < 4' failed.
| ) = 87

My laptop's battery indeed seems to behave strange (it's currently
running on power), but `acpi` doesn't fail hard on it:

| % acpi
| Battery 0: Unknown, 96%
| Battery 1: Discharging, 0%, rate information unavailable

acpitool shouldn't coredump, but either properly handle this
situation, or at least report an error message otherwise.

FTR:

| % ls -la /proc/acpi/
| total 0
| dr-xr-xr-x   6 root root 0 Nov  5 13:58 .
| dr-xr-xr-x 414 root root 0 Oct 21 15:43 ..
| dr-xr-xr-x   3 root root 0 Nov  5 14:00 button
| -rw-rw----   1 root root 0 Nov  5 14:00 call
| dr-xr-xr-x  15 root root 0 Nov  5 14:00 ibm
| -rw-r--r--   1 root root 0 Nov  5 14:00 wakeup
| % ls -la /sys/class/power_supply
| total 0
| drwxr-xr-x  2 root root 0 Nov  5 12:31 .
| drwxr-xr-x 66 root root 0 Nov  5 12:31 ..
| lrwxrwxrwx  1 root root 0 Nov  5 13:26 AC -> 
../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/ACPI0003:00/power_supply/AC
| lrwxrwxrwx  1 root root 0 Nov  5 13:30 BAT0 -> 
../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
| lrwxrwxrwx  1 root root 0 Nov  5 13:26 hidpp_battery_3 -> 
../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:02.0/0000:3a:00.0/usb3/3-1/3-1.2/3-1.2.2/3-1.2.2:1.2/0003:046D:C52B.0036/0003:046D:4069.0037/power_supply/hidpp_battery_3
| lrwxrwxrwx  1 root root 0 Nov  5 13:26 ucsi-source-psy-USBC000:001 -> 
../../devices/platform/USBC000:00/power_supply/ucsi-source-psy-USBC000:001
| lrwxrwxrwx  1 root root 0 Nov  5 13:26 ucsi-source-psy-USBC000:002 -> 
../../devices/platform/USBC000:00/power_supply/ucsi-source-psy-USBC000:002

Debugging info:

| [New LWP 1294019]
| Core was generated by `acpitool'.
| Program terminated with signal SIGABRT, Aborted.
| #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
| 50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
| (gdb) bt
| #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
| #1  0x00007f8432467537 in __GI_abort () at abort.c:79
| #2  0x00007f843246740f in __assert_fail_base (fmt=0x7f84325d0128 "%s%s%s:%u: 
%s%sAssertion `%s' failed.\n%n", assertion=0x55636450a294 "findex < 4", 
file=0x55636450a288 "battery.cpp", line=816, function=<optimized out>) at 
assert.c:92
| #3  0x00007f8432476662 in __GI___assert_fail (assertion=0x55636450a294 
"findex < 4", file=0x55636450a288 "battery.cpp", line=816, 
function=0x55636450a26c "int Count_Batteries_SysFS()") at assert.c:101
| #4  0x0000556364503b17 in ?? ()
| #5  0x000055636450622d in ?? ()
| #6  0x00005563644f9f3f in ?? ()
| #7  0x00005563644f574c in ?? ()
| #8  0x00007f8432468d0a in __libc_start_main (main=0x5563644f5330, argc=1, 
argv=0x7ffc502fa608, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7ffc502fa5f8) at ../csu/libc-start.c:308
| #9  0x00005563644f5a5a in ?? ()

regards
-mika-

Reply via email to