Public bug reported:

Binary package hint: readahead-list

in readahead-watch.c, in watch_directory, the following code block:

                /* Add a watch on the directory */
                wd = inotify_add_watch (inotify_fd, queue->path,
                                        IN_OPEN | IN_CLOSE | IN_CREATE);
                if (wd < 0) {
                        continue;
                }

makes readahead-watch skip a directory and continue on any error when
trying to add a watch.  This includes ENOSPC, which from the
inotify_add_watch man page means:

       ENOSPC The user limit on the total number of inotify watches was reached 
or
              the kernel failed to allocate a needed resource.


If readahead-watch gets a ENOSPC, it's pointless to keep trying to add more 
watches, so it should break out of rather than continue the loop.  It should 
also inform the user that this happened, so that the user is not confused (as I 
was) when readahead-watch finishes with an empty output file.

Maybe it should do the following instead:


                /* Add a watch on the directory */
                wd = inotify_add_watch (inotify_fd, queue->path,
                                        IN_OPEN | IN_CLOSE | IN_CREATE);
                if (wd < 0) {
                   if (-wd == ENOSPC) {
                     fprintf(stderr, "%s: ran out of inotify watches at %s\n", 
program_name, queue->path);
                     break;
                   }
                   else continue;
                }

** Affects: readahead-list (Ubuntu)
     Importance: Undecided
         Status: New

-- 
readahead-watch fails silently when it runs out of inotify watches
https://bugs.launchpad.net/bugs/323403
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to