netblue30 / firejail

Linux namespaces and seccomp-bpf sandbox
https://firejail.wordpress.com
GNU General Public License v2.0
5.55k stars 557 forks source link

Desktop Entry: firecfg --fix can not distinguish firefox, firefox-nightly, firefox-developer-edition,... #4018

Open geekshen8521 opened 3 years ago

geekshen8521 commented 3 years ago

Write clear, concise and in textual form.

Bug and expected behavior

Reproduce Steps to reproduce the behavior:

  1. install firefox alongside with other firefox versions (e.g. firefox-developer-edition, firefox-nightly, ...)
  2. Run firecfg --fix
  3. cd ~/.local/share/applications
  4. check each firefox-*.desktop

Environment

Checklist

debug output
geekshen8521 commented 3 years ago

I have read the man page, and desktop files in /usr/share/applications are like these: Exec=/usr/lib/firefox-developer-edition/firefox %u Exec=/opt/firefox-nightly/firefox %u I guess may be this is the reason.

rusty-snake commented 3 years ago

Looks like firecfg strips absolute paths even if they aren't in $PATH.

rusty-snake commented 3 years ago

Workaround

Because firecfg does not override existing files in ~/.local/share/applications, you can copy those dot-desktop files and prepend /usr/bin/firejail on all Exec= lines.

for ffxdd in /usr/share/applications/firefox-*.desktop; do
    sed "s|Exec=|Exec=/usr/bin/firejail |g" "$ffxdd" > ~/.local/share/applications/"$(basename "$ffxdd")"
done

or as oneliner:

for ffxdd in /usr/share/applications/firefox-*.desktop; do sed "s|Exec=|Exec=/usr/bin/firejail |g" "$ffxdd" > ~/.local/share/applications/"$(basename "$ffxdd")"; done
geekshen8521 commented 3 years ago

Thanks @rusty-snake Another workaround is to simply edit the desktop files under ~/.local/share/applications accordingly. And make sure that in PATH variable, /usr/local/bin precedes /usr/bin/.