Closed rzetterberg closed 10 years ago
This is why I mentioned to @kolmodin that always trapping all exceptions in hinotify and ignoring them is not a good solution. So the error message is produced by the exception thrown by shelly and hinotify discards that. A quick fix for you would be to put an exception handler around shelly that catches the exception and prints it out.
I am closing this issue since it should be raise with hinotify
@gregwebs, thanks for explaining and providing a solution!
Brief description
I have written a small application as a exercise to show changes made to audit logs. Basically the program uses inotify to check when
/var/log/audit/audit.log
changes and runs a handler which uses shelly to run theausearch
tool to extract recent audits from that log.What happens is that when
ausearch
is run usingrun
nothing happens and all commands after are not executed.I have tried:
run
functionlastStderr
functionWhatever I do, nothing happens after the
ausearch
command is executed.I have included what output I'm expecting, the output I'm getting inside the inotify handler and the output I'm getting inside main loop.
At the bottom of this issue there's an example that reproduce the error complete with cabal file and source.
I'm new to shelly, inotify and systems programming so I have probably made a mistake in how I should use these libraries.
Thanks in advance!
Expected output
This is what I see if I run the command directly in bash:
I'm using sudo because the audit log has these permissions:
Actual output
This is how I'm executing my haskell program:
This is what I see when the command is executed via shelly inside the inotify handler:
This is what I see if I run the same shelly snippet in my main loop:
Minimal working example
This example was run using GHC 7.6.3 inside a cabal sandbox. Here are Main.hs and cabal file used to produce the sandbox and building the application.
cabal file
Main.hs