hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
273 stars 47 forks source link

fix : inShellPath, Permission denied #213

Closed v3llocet closed 4 months ago

v3llocet commented 4 months ago

In certain unusual scenarios where the $PATH starts or contains a directory inaccessible to the user, running "/usr/lib/xdg-desktop-portal-hyprland" may produce the following error:

#PATH=/root/.local/bin:/root/go/bin:/home/v3llocet/.local/bin...
what(): filesystem error: status: Permission denied [/root/.local/bin/grim]
/home/v3llocet/.config/hypr/xdg: line 7: 6807 Aborted (core dumped) /usr/lib/xdg-desktop-portal-hyprland

This error occurs because the function "std::filesystem::exists" breaks when encountering such an error. To address this issue, I propose replacing it with "access" which can verify permissions and return true if the executable exists.