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

dir: search for repositories also under FLATPAK_BASEDIR #5688

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pabloyoyoista
Copy link
Contributor

This is more compliant with FHS specification. Most remarkably, /etc
is not appropriate to hold distro configuration, which is a common
use for the remotes.d feature. It is better practice to put things
under /usr/share, and let the system administrator modify /etc to
their will, of course giving them priority.

In the process, fix a couple of leaks.

I know that FHS might not be the most up-to-date standard. But luckily the purpose of /etc hasn't really changed. FHS states: /etc : Host-specific system configuration. So not feasible for distributions to put their configuration.

@pabloyoyoista
Copy link
Contributor Author

I guess the auto macros in GStrvBuilder are too recent for this... Which is the minimum GLib version supported? I'm fine waiting for merging this if that's also an option.

common/flatpak-dir.c Outdated Show resolved Hide resolved
@TingPing
Copy link
Member

GLib 2.46 is the current latest supported.

@smcv
Copy link
Collaborator

smcv commented Feb 14, 2024

Most remarkably

en_GB: I think you mean "Most notably"

@smcv
Copy link
Collaborator

smcv commented Feb 14, 2024

I guess the auto macros in GStrvBuilder are too recent for this

All of GStrvBuilder is too recent for Flatpak, which aims to be runnable on really old distros. Please use GPtrArray (which can be g_autoptr) and append NULL explicitly.

@pabloyoyoista pabloyoyoista force-pushed the usr-remotes.d branch 3 times, most recently from 582f01e to f2e16b5 Compare February 16, 2024 00:21
@pabloyoyoista
Copy link
Contributor Author

en_GB: I think you mean "Most notably"

Is that a policy? But I'm not a native speaker, so just fixed it.

All of GStrvBuilder is too recent for Flatpak, which aims to be runnable on really old distros

Actually, that makes total sense. I updated using GPtrArray. I'm not very used to it, so hope I did it right (second try after debugging a segfault)

Copy link
Collaborator

@chrisawi chrisawi left a comment

Choose a reason for hiding this comment

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

This seems like a reasonable addition, but I'm wondering whether we need to properly support /etc-overrides-/usr here. Currently, if a distro ships a .flatpakrepo in /etc, an admin who doesn't want it can just remove it before booting the system.

With a remote defined in /usr, a same-named .flatpakrepo file in /etc would be applied over top of the one in /usr (when both are discovered at the same time), but (AFAICT) there would be no way to cancel the repo addition, or even disable it. The admin could of course flatpak remote-delete it from the booted system, which is fine for a typical user, but maybe there's a case where that wouldn't be ideal?

common/flatpak-dir.c Outdated Show resolved Hide resolved
common/flatpak-dir.c Outdated Show resolved Hide resolved
common/flatpak-dir.c Outdated Show resolved Hide resolved
@pabloyoyoista
Copy link
Contributor Author

This seems like a reasonable addition, but I'm wondering whether we need to properly support /etc-overrides-/usr here. Currently, if a distro ships a .flatpakrepo in /etc, an admin who doesn't want it can just remove it before booting the system.

This was our initial expectation downstream. Our thought there, is that the admin can simply instead create a file under /etc with a repo with the same name and xa.disable=true. /etc has preference over /usr in what I wrote, so then in that case the repo will be installed, but disabled. In any case, isn't it up to the distro to decide which workflow they want their admins to use? We really want to use /usr because for flatpak we care about regular users, I don't think I'm breaking anything for anybody else here.

@pabloyoyoista
Copy link
Contributor Author

This should be ready for another round of reviews. Hopefully closer to being merged now :)

@pabloyoyoista pabloyoyoista force-pushed the usr-remotes.d branch 2 times, most recently from 75b778b to b2e7171 Compare March 1, 2024 13:55
@pabloyoyoista
Copy link
Contributor Author

Rebased and amended the documentation, stating that one file will take precedence over the other, but not mentioning merging (since that does not happen)

Copy link
Collaborator

@smcv smcv left a comment

Choose a reason for hiding this comment

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

(Proofreading only, implementation not reviewed)

doc/flatpak-remote.xml Outdated Show resolved Hide resolved
doc/flatpak.xml Outdated Show resolved Hide resolved
doc/flatpakrepo.xml Outdated Show resolved Hide resolved
@pabloyoyoista
Copy link
Contributor Author

Fixed comments!

@pabloyoyoista
Copy link
Contributor Author

Rebased without any other changes

@pabloyoyoista
Copy link
Contributor Author

Rebased without any other changes. Is there anything else I can do to help move this forward?

common/flatpak-dir.c Outdated Show resolved Hide resolved
Copy link
Member

@TingPing TingPing left a comment

Choose a reason for hiding this comment

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

LGTM

This a preparatory commit for the follow-up changes, where we will be
looking at more directories.
This is more compliant with FHS specification. Most notably, /etc
is not appropriate to hold distro configuration, which is a common
use for the remotes.d feature. It is better practice to put things
under /usr/share, and let the system administrator modify /etc to
their will, of course giving them priority.

Update documentation to reflect this change
@pabloyoyoista
Copy link
Contributor Author

Feedback addressed :)

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.

None yet

5 participants