-
-
Notifications
You must be signed in to change notification settings - Fork 197
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: fallback implementation is used if preferred value of none #1255
fix: fallback implementation is used if preferred value of none #1255
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Fixed lint issues :) |
Hi, thanks for this PR. that would be nice to have this fix in the next release. That could fix sway+firefox idle inhibit https://gitlab.archlinux.org/archlinux/packaging/packages/sway/-/issues/2 |
Any chance to get this PR merged? This would fix the firefox-idle-inhibit issue not only for |
Not only tests must pass, but the commits have to be squashed, and the commit message must follow the pattern that other commits do. |
@GeorgesStavracas The tests don't fail on my system. I can't figure out why they fail in CI. $ meson test -C build
ninja: Entering directory `/home/soumyarp/git/xdg-desktop-portal/build'
[61/61] Linking target tests/limited-portals
1/24 xdg-desktop-portal / testdb OK 0.01s 3 subtests passed
2/24 xdg-desktop-portal / test-doc-portal OK 0.10s 5 subtests passed
3/24 xdg-desktop-portal:portals / test-portals-camera OK 1.10s 1 subtests passed
4/24 xdg-desktop-portal:portals / test-portals-background OK 1.10s 1 subtests passed
5/24 xdg-desktop-portal:portals / test-portals-account OK 1.11s 1 subtests passed
6/24 xdg-desktop-portal:portals / test-portals-inhibit OK 1.11s 1 subtests passed
7/24 xdg-desktop-portal:portals / test-portals-notification OK 1.10s 1 subtests passed
8/24 xdg-desktop-portal:portals / test-portals-location SKIP 1.11s 0 subtests passed
9/24 xdg-desktop-portal:portals / test-portals-email OK 1.11s 1 subtests passed
10/24 xdg-desktop-portal:portals / test-portals-color SKIP 1.12s
11/24 xdg-desktop-portal:portals / test-portals-openfile SKIP 1.10s
12/24 xdg-desktop-portal:portals / test-portals-prepareprint SKIP 1.11s
13/24 xdg-desktop-portal:portals / test-portals-savefile SKIP 1.10s
14/24 xdg-desktop-portal:portals / test-portals-openuri OK 1.12s 1 subtests passed
15/24 xdg-desktop-portal:portals / test-portals-print OK 1.11s 1 subtests passed
16/24 xdg-desktop-portal:portals / test-portals-screenshot OK 1.10s 1 subtests passed
17/24 xdg-desktop-portal:portals / test-portals-settings OK 1.09s 1 subtests passed
18/24 xdg-desktop-portal:portals / test-portals-trash OK 1.09s 1 subtests passed
19/24 xdg-desktop-portal:portals / limited-portals-openfile SKIP 1.05s
20/24 xdg-desktop-portal:portals / limited-portals-savefile SKIP 1.05s
21/24 xdg-desktop-portal:portals / test-portals-wallpaper OK 1.07s 1 subtests passed
22/24 xdg-desktop-portal / test-permission-store OK 0.08s 14 subtests passed
23/24 xdg-desktop-portal / test-xdp-utils OK 0.01s 6 subtests passed
24/24 xdg-desktop-portal / test-xdp-method-info OK 0.00s 2 subtests passed
Ok: 17
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 7
Timeout: 0
Full log written to /home/soumyarp/git/xdg-desktop-portal/build/meson-logs/testlog.txt
|
Maybe a simple rebase would be sufficient? Please make sure to update the commit message |
37d02f8
to
497b28d
Compare
Squashed the commits and rebased on top of |
@SoumyaRanjanPatnaik CI test failures shows:
You don't hit those errors locally because your test setup skipped those tests. From your logs:
|
I don't want to be that guy, but either failing tests are wrong. Either that or the
I have yet to investigate which interfaces are being called in these tests. The naive fix is just to set the default interface to [preferred]
- default=none
+ default=limited
org.freedesktop.impl.portal.Account=limited
org.freedesktop.impl.portal.FileChooser=limited
org.freedesktop.impl.portal.Lockdown=limited
org.freedesktop.impl.portal.Settings=limited The alternative is to either figure out if the disabled interfaces are invoked and remove occurrences of these invocations, or to fix the Since fixing tests or the |
@jp7677 thanks for pointing out the failing tests were skipped on my system. It turns out I had to enable the This is how I ran the tests:
|
Hi @SoumyaRanjanPatnaik I'm looking (without having former experience with this project) at your patch and the tests. Your patch says: static gboolean
portal_interface_prefers_none (const char *interface)
{
const PortalInterface *iface = find_matching_iface_config (interface);
if (iface != NULL && g_strv_contains ((const char * const *) iface->portals, "none"))
{
g_debug ("Found 'none' in configuration for %s", iface->dbus_name);
return TRUE;
}
if (config != NULL && g_strv_contains ((const char * const *) config->default_portal->portals, "none"))
return TRUE;
return FALSE;
} As far as I'm reading this, it translates to: disable this interface when the interface itself is disabled ( Looking at the test configuration:
this means that all interfaces are disabled because one of the two conditions (the second one) is true. I think (not sure though) that the second Edit: May be something like this is needed (essentially adding diff --git a/src/portal-impl.c b/src/portal-impl.c
index 7086f55..1c6e6b3 100644
--- a/src/portal-impl.c
+++ b/src/portal-impl.c
@@ -516,8 +516,11 @@ portal_interface_prefers_none (const char *interface)
return TRUE;
}
- if (config != NULL && g_strv_contains ((const char * const *) config->default_portal->portals, "none"))
- return TRUE;
+ if (iface == NULL && config != NULL && g_strv_contains ((const char * const *) config->default_portal->portals, "none"))
+ {
+ g_debug ("No configuration found for %s and default is 'none'", interface);
+ return TRUE;
+ }
return FALSE;
}
|
497b28d
to
82c3819
Compare
@jp7677 Thanks for correctly pointing this out. I prematurely blamed the tests (really stupid of me 😢). Tests seem to pass after updating static gboolean
portal_default_prefers_none ()
{
if (config != NULL && g_strv_contains ((const char * const *) config->default_portal->portals, "none"))
{
g_debug ("Found 'none' in configuration for default");
return TRUE;
}
return FALSE;
}
static gboolean
portal_interface_prefers_none (const char *interface)
{
const PortalInterface *iface = find_matching_iface_config (interface);
if (iface == NULL)
return portal_default_prefers_none();
if (g_strv_contains ((const char * const *) iface->portals, "none"))
{
g_debug ("Found 'none' in configuration for %s", iface->dbus_name);
return TRUE;
}
return FALSE;
} |
@SoumyaRanjanPatnaik no worries, I’m happy to help to bring this forward. Thanks a lot for your work in the first place to address this issue! |
@GeorgesStavracas @ebassi is there anything left that needs to be done for this commit to get in? FWIW, I'm running this commit on top of |
Don't use fallback portal implementations in the following cases: - the preferred portals for an interface contains `none` - no preference is set for the interface but the default preference contains `none`
82c3819
to
c15ba89
Compare
@GeorgesStavracas Thanks for the review. Pushed the changes. |
Just curious, does this project have any documentation or formatter for enforcing the coding style? I searched for some documentation on code but found no leads in this regard. |
@ebassi @GeorgesStavracas gentle ping... |
Thanks |
Don't use fallback portal implementations in the following cases:
none
none
Fixes #1254