Bug 70540 - libaccountsservice emits bogus "has no username" warnings sometimes.
Summary: libaccountsservice emits bogus "has no username" warnings sometimes.
Alias: None
Product: accountsservice
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Matthias Clasen
QA Contact:
Depends on:
Reported: 2013-10-16 17:36 UTC by Marius Vollmer
Modified: 2018-08-07 09:31 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:

Only warn about a missing username for existing users. (2.28 KB, patch)
2013-10-22 17:02 UTC, Marius Vollmer
Details | Splinter Review
Don't find excluded users. (3.13 KB, patch)
2013-10-22 17:06 UTC, Marius Vollmer
Details | Splinter Review

Description Marius Vollmer 2013-10-16 17:36:04 UTC
This happens for example when calling act_user_manager_get_user with a non-existing user.

The "has no username" warning should only be emitted for existing users (i.e., !act_user_is_nonexisting), and a failed GetAll call should mark the user as non-existing (if it is still unloaded at that time).  A failed GetAll could emit a more specific warning.

GetAll can fail when FindUserByName/ID succeeds and returns a object path, but the object has already been unregistered again by the time the GetAll call is made.  This can happen when asking for uid 0, for example, since a reload_users will unregister all explicitly excluded users, such as root.

FindUserByName/Id should probably fail for explicitly excluded users, but libaccountsservice still needs to be prepared for GetAll to fail, I'd say.

Anyway, it's just a warning...  I have only noticed because we check for all unexpected messages in our test suite and this one pops up occasionally.
Comment 1 Marius Vollmer 2013-10-22 17:02:28 UTC
Created attachment 88010 [details] [review]
Only warn about a missing username for existing users.

This silences the bogus warning, which I think should be uncontroversial.
Comment 2 Marius Vollmer 2013-10-22 17:06:56 UTC
Created attachment 88011 [details] [review]
Don't find excluded users.

This changes semantics of FindUserByName and FindUserByUID, which I would expect to need discussion.

The alternatives are to

 - continue to allow Find* to return non-human users,
   but to make a note of them so that reload_users will not unregister them.

 - do nothing and just accept that there is a (harmless) race.

I like the first alternative best (better than the patch), since it would make the "system user" property useful.
Comment 3 Marius Vollmer 2013-10-22 17:10:40 UTC
Another alternative is to just not exclude users evers, and rely on the client to filter based on the "system user" property.  I think that's the intention anyway, no?
Comment 4 GitLab Migration User 2018-08-07 09:31:12 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/accountsservice/accountsservice/issues/19.

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.