Skip to content

Permissions on screenshot_dir cause screenshooter to get stuck in an infinite loop

Hello. I've stumbled onto a reproducible bug when copying my xfce config files to a second user. If a directory specified in screenshot_dir in ~/.config/xfce4/xfce4-screenshooter exists but is not wirtable or accessible to the user, then at the moment of pressing "Save" button the program gets stuck and consumes 100% of cpu.

A way to reproduce:

mkdir ~/test
chmod -x ~/test
set screenshot_dir=file:///home/<your username>/test/ in ~/.config/xfce4/xfce4-screenshooter

I've took a quick look into the source, the program is getting stuck inside https://gitlab.xfce.org/apps/xfce4-screenshooter/-/blob/master/lib/screenshooter-utils.c#L455 . The loop is never terminating.

Proposed solution is to add directory permission check in https://gitlab.xfce.org/apps/xfce4-screenshooter/-/blob/master/src/main.c#L242