! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
sensors plugin crash when trying to refresh ACPI FAN state
Status:
RESOLVED: FIXED
Product:
Xfce4-sensors-plugin
Component:
General

Comments

Description Yves-Alexis Perez editbugs 2008-08-06 06:35:49 CEST
Hi,

a Debian user tracked down a crash in the acpi code, when refreshing fan state. All details are in the Debian bug report, but basically get_acpi_value() takes a full path while it's currently given a filename, so it returns NULL, and then strcmp() crash on NULL.

He cooked a patch (which I attach) which fix the path problem, the check for NULL before strcmp, and replaces strcmp() by strncmp() because on his box (and maybe others) there's a \n after 'on' in the state file.

I just tested the patch on a box where /proc/acpi/fan exists, and it seems to work fine.

Btw, is there an ETA for replacing every /proc code by the /sys one, now that /proc/acpi begins to be deprecated?

Cheers and thanks,
Comment 1 Yves-Alexis Perez editbugs 2008-08-06 06:51:27 CEST
Created attachment 1757 
Fix fan info catching
Comment 2 Fabian Nowak editbugs 2008-08-07 20:41:53 CEST
(In reply to comment #0)

Thanks, but the patch isn't perfect as it does not free() properly. See changes in repository. I can't test the free()ing of char *state as I don't have fan state with Linux 2.6.22, 2.6.24 and 2.6.25.

There are no plans for /sys/. I guess I'll skip this step and wait until there's a convenient proc-like file system again. Who cares about deprecation if there's something good, reliable and convenient? I don't.
Comment 3 Yves-Alexis Perez editbugs 2008-08-07 20:52:35 CEST
(In reply to comment #2)
> (In reply to comment #0)
> 
> Thanks, but the patch isn't perfect as it does not free() properly. See changes
> in repository. I can't test the free()ing of char *state as I don't have fan
> state with Linux 2.6.22, 2.6.24 and 2.6.25.

I'll try the repository and report back.
> 
> There are no plans for /sys/. I guess I'll skip this step and wait until
> there's a convenient proc-like file system again. Who cares about deprecation
> if there's something good, reliable and convenient? I don't.

A convenient proc-like filesystem? There won't be. Switch to sysfs, that's you're “something good, reliable and convenient”. I don't think you have another choice. Better switch before removal :)

Cheers,
Comment 4 Yves-Alexis Perez editbugs 2008-08-07 21:13:48 CEST
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #0)
> > 
> > Thanks, but the patch isn't perfect as it does not free() properly. See changes
> > in repository. I can't test the free()ing of char *state as I don't have fan
> > state with Linux 2.6.22, 2.6.24 and 2.6.25.
> 
> I'll try the repository and report back.

I just build the plugin with the patch, and it runs fine. I didn't look precisely if the memory didn't grow, but I guess so.

Cheers,
Comment 5 Fabian Nowak editbugs 2008-11-25 22:44:58 CET
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > (In reply to comment #0)
> > > 
> > > Thanks, but the patch isn't perfect as it does not free() properly. See changes
> > > in repository. I can't test the free()ing of char *state as I don't have fan
> > > state with Linux 2.6.22, 2.6.24 and 2.6.25.
> > 
> > I'll try the repository and report back.
> 
> I just build the plugin with the patch, and it runs fine. I didn't look
> precisely if the memory didn't grow, but I guess so.

Wanna close this bug?
Comment 6 Fabian Nowak editbugs 2010-03-30 17:12:41 CEST
cf. comment 5

Bug #4265

Reported by:
Yves-Alexis Perez
Reported on: 2008-08-06
Last modified on: 2010-03-30

People

Assignee:
Xfce-Goodies Maintainers
CC List:
1 user

Version

Version:
unspecified

Attachments

Fix fan info catching (1.43 KB, patch)
2008-08-06 06:51 CEST , Yves-Alexis Perez
no flags

Additional information