Dvlv / BoxBuddyRS

A Graphical Interface for Distrobox
MIT License
243 stars 24 forks source link

User’s PATH defined in bashrc or equivalent is not used when looking for distrobox #95

Closed fonskip closed 3 months ago

fonskip commented 3 months ago

Install method Flatpak

Distrobox Version 1.7.2.1

Your Host OS Debian 12.5

Describe your Issue https://github.com/Dvlv/BoxBuddyRS/blob/bd4df8390a2419f102260f9f3567eb4ecffe942a/src/utils.rs#L217C8-L217C31

The has_distrobox_installed function does not use the user’s PATH (because std::process::Command::output is not invoked in an interactive shell). Thus, if your distrobox is installed in a non-OS PATH (e.g. : in .local/bin/), it is not recognized by the function.

Solution proposal I suggest changing the which distrobox to env $SHELL -ic "which distrobox" in order to run the command in an interactive shell (works with zsh, fish and bash, at least) : let output = get_command_output(String::from("env"), Some(&["$SHELL -ic", "which distrobox"])); (note that this line hasn’t been testing, only the concept of sourcing the PATH with -ic is tested).

This would also require to get the output of the which command and store it somewhere in order to be able to invoke distrobox later. If you agree with such a solution, I could try and make a PR with something tested.

fonskip commented 3 months ago

If you do not want to source shell init files, another workaround would be to add an option in the app (similar to "Set Preferred Terminal") that would be : "Set Distrobox Executable". It requires the same tweaks for running the distrobox command correctly, though.

Dvlv commented 3 months ago

Hello, BoxBuddy definitely works with a local distrobox install, as this is how I set up my VMs:

image

Do you have a problem with the way you have distrobox installed? If so, how have you installed it?

fonskip commented 3 months ago

Hi, it looks like it’s specific to Debian. I encountered the issue with distrobox installed manually on Debian 12.5. Tested it on Arch and Fedora Workstation and it was OK. I think Debian does not add ~/.local/bin to the users’ PATHs by default. But there’s actually a workaround as you can set your flatpak PATH in Flatseal or using flatpak override. I guess the issue can be closed then.