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

Don't delete data if HOME is equal to REAL_HOME #25

Conversation

sergio-costas
Copy link
Collaborator

Some snaps set $HOME equal to $SNAP_REAL_HOME, which breaks the HOME folder because the extensions scripts presumes that $HOME points to the snap HOME. This can result in replacing some XDG folders with a soft link to themselves, or config data being deleted.

This patch tries to fix this.

Fix ubuntu/gnome-sdk#188

Some snaps set $HOME equal to $SNAP_REAL_HOME, which breaks
the HOME folder because the extensions scripts presumes that
$HOME points to the snap HOME. This can result in replacing
some XDG folders with a soft link to themselves, or config
data being deleted.

This patch tries to fix this.

Fix ubuntu/gnome-sdk#188
@sergio-costas
Copy link
Collaborator Author

sergio-costas commented Mar 25, 2024

Tested using a virtual machine and a modified drawing snap, where I added HOME: $SNAP_REAL_HOME in the app/drawing/environment entry in the snapcraft.yaml file.

When installing and lauching this modified snap in the virtual machine, the XDG folders were replaced by links to themselves:

Captura desde 2024-03-25 18-15-39

I unsquashed gnome-42-2204_172.snap, modified like in this patch the file /command-chain/desktop-launch, re-squashed it and installed it in a fresh virtual machine, also installing the modified drawing snap. Now, the folders are kept.

Captura desde 2024-03-25 18-47-14

@sergio-costas sergio-costas marked this pull request as ready for review March 25, 2024 17:51
Copy link
Contributor

@kenvandine kenvandine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks

@kenvandine kenvandine merged commit 3944bad into snapcore:main Mar 25, 2024
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

Successfully merging this pull request may close these issues.

Extension deletes user personal files from Music, Templates, Public, Desktop
2 participants