I am trying to use the "Execute new|edit|delete" feature to track changes to an elog using git.
When a new entry is created a shell script should be executed (certain attributes of the logbook entry should be passed as arguments to it). The script will then automatically stage all changes and create an appropriate git commit message. For a "new" entry in the logbook the commit message is a bit more verbose. When editing or deleting a message only a short commit message like "Edit message 25" should be created. Therefore I really need to distinguish between "new", "edit", and "delete".
However, I experienced unreproducible behavior when creating "new" entries. Sometimes the command specified by "Execute new=" is called, sometimes the one specified by "Execute edit=" is executed. Most of the time it doesn't work as expected. 
What I did so far to understand what goes wrong is I looked into elogd.c and found invoid submit_elog(LOGBOOK * lbs) that bedit is sometimes true and sometimes false, when creating a new entry, although it should be false then (right?).
This is why elogd then sometimes retrieves the wrong shell command from getcfg(lbs->name, "Execute edit"...) instead of getcfg(lbs->name, "Execute new"...) around line 23610 (not exact due to some eprintf()s inserted here and there to look at bedit and so on).
When deleting an entry, everything works fine: the shell command defined via "Execute delete=" is run, but this happens somewhere else in the code so it's not a surprise.
Do you have an idea how to fix this or can you point me in some direction to further track it down? Thank you! |