salman-abedin/devour

Devour doesn't open when used with multiple files and a wildcard.

filipencopav opened this issue · 2 comments

[~] 0; find pix/screenshots/* | wc -l
36
[~] 0; devour feh pix/screenshots/*

Then it crashes (?)
The terminal goes after the milk and never returns.

All files in that directory are pngs and it doesn't work with other programs, like sxiv, either.

Have the same issue. Tried with feh and it is 100% reproducible. One file or a wildcard that only has one result both work. If the wildcard has a few results (seemed to be <10 for me) it works. But anything more and nothing opens. The terminal (tested with alacritty) stays open in the background but it seems feh doesn't launch. My images are in a fuse mount if that affects things.

This is the error message when --debug is used:

*** buffer overflow detected ***: terminated

After further investigation I think I've figured it out. When using the wildcard, the command is expanded to have each result as an argument. This makes for a command that has many more characters than the array can hold (1024). After changing the array size to 99999 it would load everything in the test directory I was using. It was still very fast, but this solution isn't very elegant. It could be a quick fix so that most people won't notice the problem.

I've created what I think is a cleaner solution in #28. My C is a little rough so there is likely a better way to handle this.