Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inotifywait fails with 11k files specified on the commandline #217

Open
cryptomilk opened this issue Apr 18, 2024 · 2 comments
Open

inotifywait fails with 11k files specified on the commandline #217

cryptomilk opened this issue Apr 18, 2024 · 2 comments

Comments

@cryptomilk
Copy link

I'm running git ls-files on the Samba source tree which has 11k files. Appending this to inotifywait ends up in a buffer overflow:

git ls-files -z | xargs -0 inotifywait --event modify --event create --event delete --monitor
Setting up watches.
Couldn't watch 0,ZU: No such file or directory
double free or corruption (out)
xargs: inotifywait: terminated by signal 6

Running with valgrind:

==9924== 
==9924== Invalid write of size 8
==9924==    at 0x10BC7A: construct_path_list(int, char**, char const*, FileList*) (common.cpp:155)
==9924==    by 0x10ACCB: main (inotifywait.cpp:240)
==9924==  Address 0x4ac3160 is 0 bytes after a block of size 8,192 alloc'd
==9924==    at 0x4845784: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==9924==    by 0x10BD2C: construct_path_list(int, char**, char const*, FileList*) (common.cpp:118)
==9924==    by 0x10ACCB: main (inotifywait.cpp:240)
==9924==
@ericcurtin
Copy link
Member

I think this is a hardcoded max:

grep -r LIST_CHUNK .
./src/common.cpp:#define LIST_CHUNK 1024
./src/common.cpp:	list->watch_files_ = (char const**)malloc(sizeof(char*) * LIST_CHUNK);
./src/common.cpp:	list->exclude_files_ = (char const**)malloc(sizeof(char*) * LIST_CHUNK);

somebody should work on that.

@cryptomilk
Copy link
Author

cryptomilk commented Apr 18, 2024

Looks like #195 is hitting the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants