Pádraig Brady wrote: > On 10/10/10 20:57, Jim Meyering wrote: >> Here is a snapshot of the latest coreutils development sources. >> Please build it and run "make check" on any systems you can, and >> report any problems to [email protected]. >> >> I expect to make a stable release in two or three days. > > I just noticed tail-2/inotify-hash-abuse hang on my system, > which is due to a 2.6.24 kernel bug where inotify_add_watch() > returns ENOSPC all the time. This causes tail -F to just > wait in vain. > > 10s fix is: > > --- tail.c 2010-09-30 07:47:45.000000000 +0000 > +++ /home/padraig/tail.c 2010-10-11 16:22:37.218039056 +0000 > @@ -1311,7 +1311,8 @@ > /* Map an inotify watch descriptor to the name of the file it's watching. > */ > Hash_table *wd_to_name; > > - bool found_watchable = false; > + bool found_watchable_file = false; > + bool found_watchable_dir = false; > bool writer_is_dead = false; > int prev_wd; > size_t evlen = 0; > @@ -1359,6 +1360,7 @@ > quote (f[i].name)); > continue; > } > + found_watchable_dir = true; > } > > f[i].wd = inotify_add_watch (wd, f[i].name, inotify_wd_mask); > @@ -1373,11 +1375,12 @@ > if (hash_insert (wd_to_name, &(f[i])) == NULL) > xalloc_die (); > > - found_watchable = true; > + found_watchable_file = true; > } > } > > - if (follow_mode == Follow_descriptor && !found_watchable) > + if ((follow_mode == Follow_descriptor && !found_watchable_file) > + || !found_watchable_dir) > return; > > prev_wd = f[n_files - 1].wd; > > > Note the above will also handle this case, where tail also just waits in vain: > tail -F /missing/dir/file > I might amend the above patch to timeout/recheck on ENOENT, > rather than return. I'll also fix the test to not busy loop. > Catching the train now...
Nice. Perfect timing. Definitely worth including in the upcoming release.
