Age | Commit message (Collapse) | Author |
|
The previous approach of storing them in static variables of the `actual` namespace and initializing them statically did not work out as it is not guaranteed that they are initialized before any interposed function is called.
|
|
|
|
|
|
|
|
All lines starting with `#` are interpreted as comments
|
|
The library may be provided with a new-line separated list of regular expressions via the newly introduced `CHANGE_LOG_IGNORE_PATTERN_PATH`.
Any proposed tracking path that is matched by any of the provided patterns is excluded from change reporting. This functionality uses the Standard's regular expression parsing functionality and as such doesn't introduce any new dependencies. If no file path is provided or the provided file path is unreadable all paths will be tracked.
`change` was adapted to set `CHANGE_LOG_IGNORE_PATTERN_PATH` to `.change_log_ignore` which means that it will by default exclude any patterns provided via this file in the current working directory.
An example for such a file customized for hiding _vim_'s internal write
logic may look as follows:
[0-9]+
[^~]*~
[.*\.viminfo
.*\.swp
Note that this is implemented in a fashion where it is not guaranteed that the full _canonical_ path is checked against the patterns. It remains to be decided if this is enough for all common use cases of this new functionality.
`tracking::PathMatcher` lacks any explicit thread synchronization - according to my current knowledge this should not be necessary as we are only ever reading the private `std::vector<std::regex>` instance.
If invalid regular expressions are provided they are silently ignored.
|
|
|
|
|
|
|
|
|
|
Introduce global static `enabled` variable used to signal the interposed functions to either start tracking or perform plain forwarding without any additional logic.
This is required as e.g. `nvim` crashed when wrapped in `libChangeLog` because it called interposed functions during library initialization.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Relying on `diff` for storing the pre-change content did not work out as it opens the file descriptors to soon and only reads the first block of pre-change file content until the remaining content is actually required. This obviously led to problems when tracking actually changing files.
|
|
This obviously leads to synchronizing syscalls that would otherwise happen in parallel. Luckily the goal of this library is to monitor file changes performed by single, user facing applications and as such it doesn't matter if some operations are slightly slower.
|
|
This ensures that the log file is actually accessable - there was a problem where e.g. `change rm test` did not create the log file correctly.
|
|
i.e. enable writing `change vim test` instead of `change "vim test"`.
|
|
|
|
`change` calls the given command wrapped in `libChangeLog` and prints the recorded change log afterwards.
|
|
|
|
|
|
Prevents the same file being tracked multiple times due to relative input paths.
|
|
While the file arguments remain fixed the actual `diff` application and its output style can be changed using the `CHANGE_LOG_DIFF_CMD` environment variable.
|
|
|
|
The library is designed to track the file changes performed by a single process, i.e. there is no need for explicitly stating when the process has exited. Furthermore this reduces the set of function interpositions to the ones handled by the `get_actual_function` method template.
|
|
|
|
The newly introduced `ChangeTracker` class is now keeping track of all tracked file in addition to spawning and managing a corresponding `diff` instance that enables printing pretty _patch-style_ change summaries to the logging target.
This commit introduces `boost-process` and `diff` as dependencies of this library.
|
|
|
|
The pointers to the actual function implementations are now fetched inside the `actual` namespace declared in the `actual_function.h` header.
Fixed source of _noreturn_ related warning during compilation by adding the appropriate flag. Sadly this means that we can not use `std::function` in this context as it doesn't seem to carry these _c-like_ flags.
|
|
|
|
|
|
|
|
|
|
|
|
The `CHANGE_LOG_TARGET` environment variable enables passing the path of an arbitrary target file to the preloaded library.
This may be used to e.g. print the log to a separate `cat` instance and is necessary for logging change events without altering the output of the wrapped process.
|
|
|
|
The goal is to implement a shared library to be loaded using `LD_PRELOAD` that tracks all file changes performed by a process.
This information is required to enable general purpose change logging inside a shell session. i.e. I want to be able to display diffs and before- / after-hashes of all changes performed by every single command without requiring every changed file to be known prior to execution.
|