jack-ullery / AppAnvil

Graphical user interface for the AppArmor security module (in-progress)
GNU General Public License v3.0
14 stars 12 forks source link

Fix environment variables of processes spawned with call_command #57

Closed l-pt closed 1 year ago

l-pt commented 1 year ago

Hi, I was trying AppAnvil (compiled from source and installed in /usr/local/bin/) and i noticed this bug: the program would not display any profile or processes, and this error would come up:

Error calling 'pkexec'. Cannot run program aa-caller: No such file or directory

i.e. pkexec cannot find the aa-caller binary in /usr/local/bin.

The following line in command_caller.cc (CommandCaller::call_command):

std::vector envp = { "/usr/bin/", "/usr/sbin/", "/usr/local/bin" };

doesn't work because the envp parameter of Glib::spawn_sync expects a vector of environment variables (with the syntax variable=value)

This pull request fixes the problem by setting PATH correctly for spawned processes.

jack-ullery commented 1 year ago

Sweet, thank you. I was actually struggling with this today and will be sure to merge your contribution