ftrigr bug

From: Olivier Brunel <jjk_at_jjacky.com>
Date: Fri, 27 Jan 2017 20:59:08 +0100

Hi,

So I believe there's a (little) bug in ftrigr_update(). It has multiple
symptoms, but basically it boils down to: the list of ids
"returned"/made available can sometimes contain duplicates, and also
the return value might be wrong.

Imagine this: I subscribe w/ regex "[abc]" and option FTRIGR_REPEAT, and
then events a & c occur in that order.

Now, when calling ftrigr_update() what does it return? If you answered
2 you are correct, but that's also not what it should be. As per the
doc, it should return "the number of identifiers for which something
happened" -- which cannot possibly be more than 1 when there is only
one id being used so far!
(Currently it actually returns the number of messages received from the
daemon, if I'm not mistaken.)

Never mind that return value, I get the id from the list & call
ftrigr_check() for it. As expected it tells me the last event was 'c'
and it returns 2, aka the number of times it was triggered (p->count).

I process this however I need, and all is good... Except, as you
(probaly) guessed, there's another id in the list. Or, more accurately,
the same id a second time.

Save for errors, ftrigr_update() should return the number of ids for
which something happened, as the doc says, i.e. the length of the list
of ids.
So this is what the attached patch does.

Cheers,



Received on Fri Jan 27 2017 - 19:59:08 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC