Re: RFS: triggerhappy
-----BEGIN PGP SIGNED MESSAGE-----
On 2010-12-18 15:10, Stefan Tomanek wrote:
> Dear mentors,
> Looking for a way of globally assigning hotkey handlers to the special keys
> found on my notebooks, I developed triggerhappy. I also use it to control
> headless systems, e.g. a ARM based MPD jukebox which is controlled by a USB
> keypad or bluetooth wiimote. Having this software in Debian would provide an
> easy way to bind commands to input events without the need for running an
> X11 session or logging in.
> I would be glad if someone uploaded this package for me.
> Kind regards
> Stefan Tomanek
I just did a quick review of your package; packaging-wise your package
Though the upstream code might need a little attention (or some
clarification); e.g. cppcheck finds a resource leak:
[cmdsocket.c:126]: (error) Resource leak: fd
Looking at the code I am not sure what the intention is. My best guess
is that it is trying to transmit the "leaked" file descriptor.
Though I am not convinced this will work; even if it is possible (I
vaguely recall seeing an extension in Linux to allow something like
this), I suspect the program relies on undefined behaviour here:
m.msg_control = buffer;
The issue is that buffer goes out of scope before m is used (in sendmsg).
In the if in uinput.c:27 it looks like you are missing a uinput_fd = -1;
In trigger.c:205 there is no check for if fork failed and this leads to
a "silent nothing happened". There are also got a number of unchecked
malloc/strdup, which could lead to "out of memory" segfaults, but at
least that is "some kind of feedback".
cppcheck also believes that count_triggers (trigger.c) and print_ignores
(ignore.c) are never used. I did not verify that.
In thd.c:331 the error message implies that the user does not exist, but
getpwnam can fail with other reasons; it might be a good idea to
use a more "neutral" error like:
int err = errno;
fprintf(stderr, "Could not look up the user %s\n", user);
errno = err;
Adding warnings to gcc I saw the following:
cc -g -O2 -Wall -Wextra -g -O2 -Wall -Wextra -c -o eventnames.o
In file included from eventtable.h:10,
evtable_KEY.h:123: warning: initialized field overwritten
evtable_KEY.h:123: warning: (near initialization for 'KEY_NAME')
evtable_KEY.h:154: warning: initialized field overwritten
evtable_KEY.h:154: warning: (near initialization for 'KEY_NAME')
evtable_KEY.h:379: warning: initialized field overwritten
evtable_KEY.h:379: warning: (near initialization for 'KEY_NAME')
In file included from eventtable.h:14,
evtable_SW.h:5: warning: initialized field overwritten
evtable_SW.h:5: warning: (near initialization for 'SW_NAME')
They are were triggered with -Wextra; it may be nothing, but I figured I
would mention it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----