#1034121 feh: makes a bad FD_SET() call and aborts if inotify_init() fails

Package:
feh
Source:
feh
Description:
imlib2 based image viewer
Submitter:
Michael Gold
Date:
2023-04-09 17:09:04 UTC
Severity:
normal
#1034121#5
Date:
2023-04-09 17:00:02 UTC
From:
To:
Dear Maintainer,

Today I'm getting the following error whenever I try to run feh:
	feh WARNING: inotify_init failed: Too many open files
	feh WARNING: Disabling inotify-based auto-reload
	*** bit out of range 0 - FD_SETSIZE on fd_set ***: terminated
	Aborted

It turns out that inotify_init() has the very low limit of 128 instances
per user by default, and lsof shows they are mostly used by instances of
dbus-daemon, dconf-service, and xdg-desktop-portal.

feh_main_iteration() calls FD_SET(opt.inotify_fd, &fdset) if auto_reload
is enabled, regardless of whether inotify_fd is valid.  It also needs to
check 'opt.inotify_fd >= 0' in the 'if' statement.

A workaround is to use the --reload=0 command line option.

- Michael