salman-abedin / devour

X11 window swallower
GNU General Public License v2.0
415 stars 30 forks source link

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

Open filipencopav opened 3 years ago

filipencopav commented 3 years ago
[~] 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.

EmperorPenguin18 commented 3 years ago

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
EmperorPenguin18 commented 3 years ago

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.