Repository navigation
context: Emit valid option names for D-Bus name policies - #6807
Merged
Merged
Conversation
smcv
requested changes
Aug 26, 2026
Comment on lines
+1300
to
+1301
| /* There is no command-line option for FLATPAK_POLICY_SEE */ | ||
| return NULL; |
Collaborator
There was a problem hiding this comment.
Why do FLATPAK_POLICY_NONE and FLATPAK_POLICY_SEE have different results? I would expect them to either both be --[system-]no-talk-name, or both be the absence of an option.
As a general style thing, when we convert an enum to some derived fact, it's often best to use a switch, because that way the compiler will warn us if we miss a possibility. Something like this:
switch (policy)
{
case FLATPAK_POLICY_TALK:
return "talk-name";
case FLATPAK_POLICY_OWN:
return "own-name";
case FLATPAK_POLICY_NONE:
case FLATPAK_POLICY_SEE:
return "no-talk-name"; /* or maybe NULL, I'm not sure which would be better */
default:
g_return_val_if_reached ("no-talk-name"); /* or maybe NULL */
}
flatpak_context_to_args() built the D-Bus name options from flatpak_policy_to_string(). That function gives the values used in the [Session Bus Policy] and [System Bus Policy] metadata groups. Two of them, "none" and "see", are not command-line options. A context that contained such a policy gave --none-name= and --system-none-name=. flatpak-run(1) writes these arguments to the [Instance] extra-args of /.flatpak-info. flatpak-portal gives them back to flatpak(1) when a sandboxed app calls flatpak-spawn(1). flatpak(1) then rejected the whole command line with "Unknown option --none-name=...", so --no-talk-name and --system-no-talk-name broke flatpak-spawn(1). Map each policy to the option that sets it: --no-talk-name for FLATPAK_POLICY_NONE, --talk-name for FLATPAK_POLICY_TALK, and --own-name for FLATPAK_POLICY_OWN. FLATPAK_POLICY_SEE has no command-line option, so emit nothing for it. It cannot occur here: the only caller serializes a context that comes from the command line.
AbhinavMir
force-pushed
the
bus-policy-to-args-option-names
branch
from
August 26, 2026 18:38
fec0e3f to
5bc32eb
Compare
Collaborator
|
@smcv want to take another look? |
swick
approved these changes
Sep 18, 2026
smcv
approved these changes
Sep 18, 2026
This was referenced Sep 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#6776