snapcraft-desktop-helpers icon indicating copy to clipboard operation
snapcraft-desktop-helpers copied to clipboard

Elementary OS default folder in home dir is replaced with symbolic links

Open pracedru opened this issue 4 years ago • 13 comments

I have experienced a bug that seems to be related to Elementary OS. When installing my application Folkfinder on Elementary OS 5.1 Hera the default folders in the home dir are replaced with symbolic links that point to them selves: Video documentation of bug List of home folder before and after app has been run:
image Output from snap:
image My snap yaml file for Folkfinder: https://gitlab.com/folkfinder/folkfinder-snap/-/blob/master/snap/snapcraft.yaml

pracedru avatar Aug 10 '20 09:08 pracedru

I wonder if this is partly caused by:

    environment:
      HOME: /home/$USER

Can you try building and installing without that?

popey avatar Aug 10 '20 09:08 popey

Sure i will do.

pracedru avatar Aug 10 '20 09:08 pracedru

I wonder if this is partly caused by:

    environment:
      HOME: /home/$USER

Can you try building and installing without that?

Removing this changed the behavior. The sym links are no longer created. But also the app doesn't have access to the files in the home folder. Could this be a QT related issue?

pracedru avatar Aug 10 '20 10:08 pracedru

I can reproduce the issue with the version of folkfinder in stable. The version in candidate does not change the files in home. However both versions can see files in home just fine. I don't understand what you mean by "the app doesn't have access to the files in the home folder"? Please detail what you see and what you should see.

popey avatar Aug 10 '20 12:08 popey

I can reproduce the issue with the version of folkfinder in stable. The version in candidate does not change the files in home. However both versions can see files in home just fine. I don't understand what you mean by "the app doesn't have access to the files in the home folder"? Please detail what you see and what you should see.

I just downloaded some random images to the Pictures folder from the internet, to see if I could select and view them.

pracedru avatar Aug 10 '20 14:08 pracedru

I just tried the version in candidate, has no issues accessing content in ~/Pictures. I am seeing lots of dconf errors, I think this snap needs the gsettings plug.

kenvandine avatar Aug 10 '20 14:08 kenvandine

I just tried the version in candidate, has no issues accessing content in ~/Pictures. I am seeing lots of dconf errors, I think this snap needs the gsettings plug.

Ok I will add the gsettings like this: image

And try again.

pracedru avatar Aug 10 '20 14:08 pracedru

You really shouldn't set HOME there, and shouldn't need to. You also can't assume a user's homedir will be /home/$USER.

kenvandine avatar Aug 10 '20 14:08 kenvandine

You really shouldn't set HOME there, and shouldn't need to. You also can't assume a user's homedir will be /home/$USER.

I am not the original author of this. I will ask the author why this was done.

pracedru avatar Aug 10 '20 14:08 pracedru

When running with this new setup i get this in Ubuntu: image The home folder defaults into the snap folder . I get the Qt file dialogs for some reason and the qt5ct style looks strange. The default folders are not bookmarked in the file dialog. I Elementary i get this: image The home folder defaults into the snap folder but there is a bookmark to the users home folder by name in the bottom. The qt5ct style looks correct. The filedialog is correctly set to the default system dialog. The bookmarks to the default folders do point to the correct folders in the home dir.

Also the app can see the files on both OS'es (my bad)

pracedru avatar Aug 10 '20 15:08 pracedru

I am the original author of the code he was copying, during my testing and looking trought different opensource project's snapcraft.yaml's i found thos environment variable being set and it was one which solved the problem while i already guessed this wasnt proper solution and am intent of properly configuring it when i have enought time to properly figure out what i need to do.

Why exacly is this envvar included in my snapcraft.yaml it is because this was the only way i could get right home directory in file dialogs like you can see above

bigpod98 avatar Aug 10 '20 19:08 bigpod98

Also the app can see the files on both OS'es (my bad)

I had downloaded two files with the extensions .gif and .jpeg. But I had not included them in the file filter in the FolderView.

pracedru avatar Aug 10 '20 21:08 pracedru

Both projects that i manage have been privated because of this code and we have discovered another unrelated bug.

Problem as it goes is that no mazter how we set it up we need to assume users have standard /home/$USER home directory because while inside python code we cannot in any other way besides hardcoding access home directory we tried using both xdg_home_dir(or something like that) but that uses ~ and when using ~ home directory it will resolve to is the snaps directory inside users home directory(~/snap/{snapname}/current(or revision number)or common cant remember exacly) /) which isnt intended behaveour. What can we use then

Im sorry for all your trubble

bigpod98 avatar Aug 11 '20 10:08 bigpod98