mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
Fix the dir module.
Internally, Dir kept track of the files in directory by storing all inode numbers in a set. However, when a file is deleted and a new file is created in a directory, the old file may get the same inode number as the old one. In this case, bro did not notice the new file. The patch simply changes the indexing of files - now files are indexed by inode and creation time. This should fix the scripts.base.utils.dir test failures.
This commit is contained in:
parent
c299a71b83
commit
4b0ee2e7ca
1 changed files with 2 additions and 1 deletions
|
@ -28,7 +28,8 @@ event Dir::monitor_ev(dir: string, last_files: set[string],
|
||||||
callback: function(fname: string),
|
callback: function(fname: string),
|
||||||
poll_interval: interval)
|
poll_interval: interval)
|
||||||
{
|
{
|
||||||
when ( local result = Exec::run([$cmd=fmt("ls -i -1 \"%s/\"", str_shell_escape(dir))]) )
|
# the command lists all file in the directory in the form [inode]-[ctime] [filename]
|
||||||
|
when ( local result = Exec::run([$cmd=fmt("find \"%s\" -depth 1 -exec stat -f \"%%i-%%c %%N\" {} \\;", str_shell_escape(dir))]) )
|
||||||
{
|
{
|
||||||
if ( result$exit_code != 0 )
|
if ( result$exit_code != 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue