> Static variables are best avoided, for one they wont work correctly for the 
> case where you query/build multiple specs on a single run.

Argh... The multi-spec case somehow didn't occur to me... yet it's pretty 
obvious :sweat_smile:

> A simple alternative would be adding a special purpose counter to the spec 
> struct, and log a message based on that towards the end of parsePrep() where 
> you can then also log the number of times emitted.

Yup, or even simpler: just add an int pointer argument to `doPatchMacro()` 
where `parsePrep()` would pass a counter which the function would increment, 
and then do whatever (print the message, count, etc.) at the end.

Both of these solutions have the downside of "leaking" this particular warning 
outside of `doPatchMacro()`, though. It might just be fine (and better than 
`static`) as a temporary solution.

> Basically, whenever a message is logged, compare to the previous one and if 
> identical, bump a counter. When a non-identical message arrives, log a 
> "previous warning/error suppressed N times", reset counter and proceed with 
> the new message as usual. This will need some sort of flushing though to 
> ensure the "repeated" message gets shown (but at least for build, I think 
> we'll get it for free from the "build warnings" log message) . Bonus points 
> for an additional time-stamp and using that for additional heuristics: if a 
> log message is repeated within N seconds, you probably want to suppress but 
> otherwise you may want to show it regardless.

Nice idea! Thanks for the detailed description, I couldn't have wished for more 
guidance, really :smile: 



-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2388#issuecomment-1423885669
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2388/c1423885...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to