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

Fix Documents, Pictures, Music etc are symlinks in #220

Merged
merged 2 commits into from
Feb 9, 2021

Conversation

lucyllewy
Copy link
Contributor

When a user has one or several XDG_SPECIAL_DIRS folders symlinked in their real home folder to elsewhere in their real home folder common/desktop-exports will attempt to mv those folders to themselves.

  • guard mv calls with test for is_subpath to ensure that we're only moving symlinks we created.

While this is not a fatal error here, the electron-builder copies are using bash -e so they fail hard. I will forward these changes to electron-builder once reviewed here... (currently symlinks for Documents etc, combined with the electron-builder default of plugging home, cause electron-builder-built snaps to refuse to launch because the mv calls break the execution due to bash -e.)

Signed-off-by: Daniel Llewellyn diddledan@ubuntu.com

Daniel Llewellyn added 2 commits February 9, 2021 09:03
When a user has one or several `XDG_SPECIAL_DIRS` folders symlinked in their real home folder to elsewhere in their real home folder `common/desktop-exports` will attempt to mv those folders to themselves.

* guard `mv` calls with test for `is_subpath` to ensure that we're only moving symlinks we created.

Signed-off-by: Daniel Llewellyn <diddledan@ubuntu.com>
If readlink fails, it will output on stderr.

* Throw away stderr

Signed-off-by: Daniel Llewellyn <diddledan@ubuntu.com>
@kenvandine
Copy link
Member

This looks sensible. Can you also propose these changes to the snapcraft extensions?

@lucyllewy
Copy link
Contributor Author

willdo

lucyllewy pushed a commit to diddlesnaps/app-builder that referenced this pull request Feb 9, 2021
When a user has one or several `XDG_SPECIAL_DIRS` folders symlinked in
their real home folder to elsewhere in their real home folder
`desktop-common.sh` will attempt to mv those folders to themselves.
Because we are executing this script with `bash -e`, this prevents any
Snap with the `home` interface built with these scripts from launching
when the user has moved any of their Documents, Pictures, Music, etc.
and replaced with a symlink.

* guard `mv` calls with test for `is_subpath` to ensure that we're only
  moving symlinks we created.

See related PRs on Snapcraft-desktop-helpers and Snapcraft:

* ubuntu/snapcraft-desktop-helpers#220
* canonical/snapcraft#3435

Signed-off-by: Daniel Llewellyn <diddledan@ubuntu.com>
@kenvandine kenvandine merged commit 12c6ea6 into ubuntu:master Feb 9, 2021
develar pushed a commit to develar/app-builder that referenced this pull request Mar 1, 2021
When a user has one or several `XDG_SPECIAL_DIRS` folders symlinked in
their real home folder to elsewhere in their real home folder
`desktop-common.sh` will attempt to mv those folders to themselves.
Because we are executing this script with `bash -e`, this prevents any
Snap with the `home` interface built with these scripts from launching
when the user has moved any of their Documents, Pictures, Music, etc.
and replaced with a symlink.

* guard `mv` calls with test for `is_subpath` to ensure that we're only
  moving symlinks we created.

See related PRs on Snapcraft-desktop-helpers and Snapcraft:

* ubuntu/snapcraft-desktop-helpers#220
* canonical/snapcraft#3435

Signed-off-by: Daniel Llewellyn <diddledan@ubuntu.com>
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.

2 participants