Bug 65846 - The daemon should also watch /etc/groups
Summary: The daemon should also watch /etc/groups
Status: VERIFIED FIXED
Alias: None
Product: accountsservice
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Matthias Clasen
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-17 08:23 UTC by Marius Vollmer
Modified: 2013-10-16 06:24 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Factor out file monitor setup. (6.04 KB, patch)
2013-06-17 08:23 UTC, Marius Vollmer
Details | Splinter Review
Also monitor /etc/groups for changes. (1.46 KB, patch)
2013-06-17 08:24 UTC, Marius Vollmer
Details | Splinter Review
Also monitor /etc/groups for changes. (2.12 KB, patch)
2013-06-17 10:56 UTC, Marius Vollmer
Details | Splinter Review
Factor out file monitor setup. (6.09 KB, patch)
2013-06-18 06:40 UTC, Marius Vollmer
Details | Splinter Review
Also monitor /etc/groups for changes. (1.46 KB, patch)
2013-06-18 06:41 UTC, Marius Vollmer
Details | Splinter Review
Emit "changed" signal when account type changes. (1.17 KB, patch)
2013-06-18 06:42 UTC, Marius Vollmer
Details | Splinter Review
Factor out file monitor setup. (6.90 KB, patch)
2013-06-18 13:58 UTC, Marius Vollmer
Details | Splinter Review

Description Marius Vollmer 2013-06-17 08:23:11 UTC
So that changes to wheel membership are picked up.
Comment 1 Marius Vollmer 2013-06-17 08:23:46 UTC
Created attachment 80934 [details] [review]
Factor out file monitor setup.
Comment 2 Marius Vollmer 2013-06-17 08:24:17 UTC
Created attachment 80935 [details] [review]
Also monitor /etc/groups for changes.
Comment 3 Marius Vollmer 2013-06-17 10:56:36 UTC
Created attachment 80948 [details] [review]
Also monitor /etc/groups for changes.
Comment 4 Stef Walter 2013-06-17 13:40:51 UTC
Comment on attachment 80934 [details] [review]
Factor out file monitor setup.

Review of attachment 80934 [details] [review]:
-----------------------------------------------------------------

::: src/daemon.c
@@ +749,5 @@
> +               void (*callback) (GFileMonitor      *monitor,
> +                                 GFile             *file,
> +                                 GFile             *other_file,
> +                                 GFileMonitorEvent  event_type,
> +                                 Daemon            *daemon))

Seems like a typedef is appropriate here, no? Or just use G_CALLBACK(), and move that cast up the call stack.
Comment 5 Stef Walter 2013-06-17 13:43:02 UTC
Comment on attachment 80948 [details] [review]
Also monitor /etc/groups for changes.

Review of attachment 80948 [details] [review]:
-----------------------------------------------------------------

::: src/user.c
@@ +216,4 @@
>          /* GID */
>          user->gid = pwent->pw_gid;
>  
> +        AccountType at = account_type_from_pwent (pwent);

Declarations should be at top of block.

@@ +220,5 @@
> +        if (at != user->account_type) {
> +                user->account_type = at;
> +                changed = TRUE;
> +                g_object_notify (G_OBJECT (user), "account-type");
> +        }

Isn't all of this logically a different change than what the commit message describes? Maybe apropriate to split this out into a separate patch?
Comment 6 Marius Vollmer 2013-06-17 13:46:14 UTC
(In reply to comment #4)
> Comment on attachment 80934 [details] [review] [review]
> Factor out file monitor setup.
> 
> Review of attachment 80934 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: src/daemon.c
> @@ +749,5 @@
> > +               void (*callback) (GFileMonitor      *monitor,
> > +                                 GFile             *file,
> > +                                 GFile             *other_file,
> > +                                 GFileMonitorEvent  event_type,
> > +                                 Daemon            *daemon))
> 
> Seems like a typedef is appropriate here, no? Or just use G_CALLBACK(), and
> move that cast up the call stack.

I'd say that GCallback is not really appropriate since setup_monitor is more specialized and we can get some compile-time type checking by using the correct type for the callback.

I'll add a FileChangedCallback typedef.
Comment 7 Marius Vollmer 2013-06-17 13:48:10 UTC
> @@ +220,5 @@
> > +        if (at != user->account_type) {
> > +                user->account_type = at;
> > +                changed = TRUE;
> > +                g_object_notify (G_OBJECT (user), "account-type");
> > +        }
> 
> Isn't all of this logically a different change than what the commit message
> describes? Maybe apropriate to split this out into a separate patch?

Sure.
Comment 8 Marius Vollmer 2013-06-18 06:40:57 UTC
Created attachment 80983 [details] [review]
Factor out file monitor setup.

Added typedef.
Comment 9 Marius Vollmer 2013-06-18 06:41:43 UTC
Created attachment 80984 [details] [review]
Also monitor /etc/groups for changes.

Don't emit "changed".
Comment 10 Marius Vollmer 2013-06-18 06:42:19 UTC
Created attachment 80985 [details] [review]
Emit "changed" signal when account type changes.
Comment 11 Stef Walter 2013-06-18 10:53:16 UTC
Comment on attachment 80983 [details] [review]
Factor out file monitor setup.

Review of attachment 80983 [details] [review]:
-----------------------------------------------------------------

Other than the whitespace tweak, this looks good.

::: src/daemon.c
@@ +751,5 @@
> +
> +static GFileMonitor *
> +setup_monitor (Daemon *daemon,
> +               const gchar *path,
> +               FileChangeCallback *callback)

Spacing of the arguments.
Comment 12 Stef Walter 2013-06-18 10:56:05 UTC
Comment on attachment 80984 [details] [review]
Also monitor /etc/groups for changes.

Review of attachment 80984 [details] [review]:
-----------------------------------------------------------------

Do all the GFileMonitor leak? Seems like group_monitor does.
Comment 13 Stef Walter 2013-06-18 10:57:05 UTC
Comment on attachment 80985 [details] [review]
Emit "changed" signal when account type changes.

Review of attachment 80985 [details] [review]:
-----------------------------------------------------------------

Looks good.
Comment 14 Marius Vollmer 2013-06-18 13:48:39 UTC
(In reply to comment #12)
> Comment on attachment 80984 [details] [review] [review]
> Also monitor /etc/groups for changes.
> 
> Review of attachment 80984 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> Do all the GFileMonitor leak? Seems like group_monitor does.

Well, daemon_finalize is never called afaics, so...  I think that's a feature and we could put a g_assert_not_reached into daemon_finalize, even.
Comment 15 Marius Vollmer 2013-06-18 13:58:54 UTC
Created attachment 81007 [details] [review]
Factor out file monitor setup.
Comment 16 Marius Vollmer 2013-06-18 13:59:17 UTC
> Spacing of the arguments.

Yep.
Comment 17 Ray Strode [halfline] 2013-10-15 20:15:59 UTC
i've pushed these.
Comment 18 Marius Vollmer 2013-10-16 06:24:28 UTC
(In reply to comment #17)
> i've pushed these.

Thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.