Udev rule problem
One problem was this udev rule:
ACTION=="add", SUBSYSTEM=="block", DEVTYPE=="disk", RUN+="/bin/sh -c 'echo ACTION=$ACTION SUBSYSTEM=$SUBSYSTEM DEVTYPE=$DEVTYPE DEVPATH=$DEVPATH > /tmp/pup_event_backend_s'"
This rule is how udevd notifies my frontend daemon, pup_event_frontend_d, when a drive is inserted. However, I was getting strange behaviour, and I eventually discovered that udevd was also writing to /tmp/pup_event_backend_s when:
ACTION=="add", SUBSYSTEM=="block", DEVTYPE=="partition"
which caused two (or more) messages when my frontend script was only expecting one.
It seems that udevd is trying to be clever and has ignored the explicit instructions in the rule (unless I have misunderstood the rules syntax, which wouldn't surprise me). Anyway, I put in a fix.
The other problem I fixed was more of a potential bug. I was using 'inotifywait' to wait until /tmp/pup_event_backend_s is modified, and my script read the file after detecting a modification. However, there is a potential failure if udevd too-rapidly writes again to the file.
I don't have this potential problem with my own pup_event_backend_d daemon (alternative to udevd).
Anyway, I fixed the problem by changing from 'inotifywait' to 'inotail'. The latter is a tail utility that is especially useful to run in daemon mode (inotail -f <file>) as it uses the inotify mechanism, so uses very little resources while waiting for a file to be modified.
So, the 'inotify' package, version 0.5, is now in Puppy. This is just one utility, only 10KB.
Comments:Posted on 11 Jul 2008, 23:17 by coolpup
It has been reset to zero, again.
Posted on 12 Jul 2008, 9:54 by BarryK
Re: hits counter
You have to contact the author of PPLOG about this. He is currently working on the next version and has invited feedback.
Posted on 12 Jul 2008, 10:06 by BarryK
Re: inotifywait versus inotail
There is another reason why inotail is preferable.
inotifywait -e modify <filename> returns as soon as it detects a file modification, whereas I would prefer the return after a complete line is written. inotail -f <filename> will return the complete appended line.