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

Packaging and then installing a fyne app on Linux as per https://docs.fyne.io/started/packaging.html breaks filesystem permissions #10

Open
Gambloide opened this issue Apr 2, 2024 · 5 comments

Comments

@Gambloide
Copy link

The archive created for Linux with the fyne package command assigns ownership for the whole folder structure to the current user. This means when it is extracted to the filesystem root / as per https://docs.fyne.io/started/packaging.html it overwrites the ownership for the /usr folder from root to either whoever created the archive or who unpacked it, depending on how the users decided to unpack it.

image

Additionally, the archive contains a Makefile, which is also extracted to /Makefile if the archive is just extracted as per the instructions on https://docs.fyne.io/started/packaging.html.

I assume the correct solution to this would be to update the docs to reflect that users should use the Makefile instead of extracting the archive directly to /. The Makefile even contains instructions on how to use it.

@andydotxyz
Copy link
Member

What command did you use to extract the files? A tar being expanded should not change permissions on directories that already exist...

@Gambloide
Copy link
Author

$ sudo tar xf myapp.tar.xz --directory=/

This does change the owner of /usr and all nested folders contained in the archive from root to my user.

@andydotxyz
Copy link
Member

Something isn't quite making sense here - as the tar does not contain any user / permission information for directories.
And according to the docs it would not alter permissions of existing directories - it may do this if it replaces files, but it is not replacing the directory to put a file inside it.

I don't know if this has changed, or if distributions are able to change the defaults - but here an extract doesn't alter owner or permission of parent directories. More thoughts at https://www.linuxquestions.org/questions/linux-software-2/tar-extracted-paths-not-retaining-original-ownership-4175591789/

@Gambloide
Copy link
Author

Gambloide commented Apr 3, 2024

The tar created by fyne package does contain ownership and permission information, as shown in the screenshot of my original message. Retaining ownership and permission information during compression of a folder is the default behavior of tar on any Linux distro I ever used. This behavior can be overwritten with e.g. the --owner and --group flags for ownership information. I do not know if or how tar on MacOS might differ.

tar is also working as documented when extracting.

From the man page:

--same-owner
              Try extracting files with the same ownership as exists in the archive (default for superuser).
--no-same-owner
              Extract files as yourself (default for ordinary users).

Since it cannot be unpacked without sudo into the target directories since they are owned by root, it will default to extracting the "files with the same ownership as exists in the archive".

Even if fyne package was changed to change the ownership of the packaged files to root, the instructions on https://docs.fyne.io/started/packaging.html would still be problematic, as that places the Makefile in the archive directly under /.

Which is why I opened the issue here in the documentation, rather than the main project. It appears everything works as intended, just that the installation instructions have unwanted side-effects and should just tell Linux users to either move the files over manually after extracting the folder in a safe location or simply use the provided Makefile.

@andydotxyz
Copy link
Member

The Makefile is indeed newer than these docs - but it is a developer tool not an end user one. We could update the docs to show this. The .tar.xz is realistically not a polished distribution format but something that allows any Linux package to put together the items into their package format.

Not sure if this helps or not.

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

2 participants