Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bazzite] Silent error when changing AppImage default location #89

Open
GeeLeonidas opened this issue Jun 4, 2024 · 9 comments
Open

Comments

@GeeLeonidas
Copy link

GeeLeonidas commented Jun 4, 2024

Recently I've moved to Bazzite (a distro based on Fedora Atomic Desktops) and various things are centralized inside /var, home directory included. When trying to rename Gear Lever's default folder from "AppImages" to "Applications" the interface just didn't react, nothing was changed. After inspecting the output, I've encountered this:

Traceback (most recent call last):
  File "/app/share/gearlever/gearlever/preferences.py", line 124, in on_select_default_location_response
    raise InternalError(_('The folder must be in your home directory'))

Knowing that, I could manage to change the default location to /home/$USER/Applications. The thing is, /var/home/$USER is my home directory and where the file chooser points me to, /home being just a symlink. After analysing the culprit line, it seems to me that GLib.get_home_dir() returns /home/$USER and not /var/home/$USER:

if selected_file.query_exists() and selected_file.get_path().startswith(GLib.get_home_dir()):

Why is that is another thing entirely, but checking for the real path, alongside the current checks, should do the trick.

@MMachado05
Copy link

Potentially unrelated, but how exactly did you access that traceback? Might prove useful in the future!

@GeeLeonidas
Copy link
Author

@MMachado05 It was printed to terminal when I ran flatpak run it.mijorus.gearlever, no extra hoops necessary :)

@MMachado05
Copy link

Ah, I'd never considered running it from the terminal! Definitely helpful. 👍

@mijorus
Copy link
Owner

mijorus commented Jun 6, 2024

Hi @GeeLeonidas, that check exists because Gear Lever has write permissions only in the home directory, hence that check.
I will try to investigate more, thank you

@mijorus mijorus changed the title Silent error when changing AppImage default location [Bazzite] Silent error when changing AppImage default location Jun 6, 2024
@ao-alt
Copy link

ao-alt commented Jun 19, 2024

@GeeLeonidas I was able to fix this on Bazzite by editing my /etc/passwd file to change the default home directory of my user from /home/<username> to /var/home/<username>. I'm not sure if that'll cause any problems down the line though.

@C-Higgins
Copy link

To clarify the OP, you can fix this by manually typing in the path /home/$USER/Applications instead of picking the folder from the file picker (which will end up as /var/home/$USER/Applications)

@selwynorren
Copy link

Hmm only discovered this brilliant app today, but I must admit being able to change the instal path is a little frustrating. I added /opt to my flatseal app for Gear Lever as an access path, but it seems the home location is hard coded and gives this silent error.

Running it through Terminal I get this error:
Traceback (most recent call last):

File "/app/share/gearlever/gearlever/preferences.py", line 133, in on_select_default_location_response
    raise InternalError(_('The folder must be in your home directory'))
gearlever.models.Models.InternalError

Can this be changed so that it will use any location of your choosing, just as long as access has been granted to that location using flatseal? or similar app?

I also noticed something else as well, if you click on show welcome screen, there is no way to exit that welcome screen except to run through al the steps. If you try and chnage teh location on the welcome screen, the error is kind of teh same, but slightly different:

Traceback (most recent call last):
  File "/app/share/gearlever/gearlever/WelcomeScreen.py", line 95, in on_select_default_location_response
    raise InternalError(_('The folder must be in your home directory'))
          ^^^^^^^^^^^^^
NameError: name 'InternalError' is not defined

@mijorus
Copy link
Owner

mijorus commented Aug 10, 2024

Hi, the location is hard coded because of the limitations of the Flatpak runtime.

In order to write in /opt, I would have to ask for system wide storage access, which would upset some people.

@selwynorren
Copy link

Hmm Makes sense.

I managed to work around it by adding /opt to the path list in Flatseal and then in the code I remove the and statement In preferences.py on line 128

if selected_file.query_exists() and selected_file.get_path().startswith(GLib.get_home_dir()):

becomes

if selected_file.query_exists():

Then I was able to change my installation path to /opt and it worked perfectly. I made the same mod to the welcome.py on line 93

Just curious, would it not be better to rather warn the user that if they select something outside of their home directly they woudl need to add the path to flatseal? Or ever better ask for permission to append the permissions to access the specified folder and restrict it to home and /opt considering that opt is the default location for optional software

I honestly know nothing about this, I was just stabbing in the dark with it and found the solution.

PO.S On another note, should the app not show the welcome screen on first run by default? Again just curious here.

I also have to just say after my small tweak the app worked flawlessly, really nice work done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants