Log the map path and resolved uid on ListEnrolledFingers

A seeded map was reported as empty. The instrumented path shows why in one line:
`user` on postmarketOS is uid 10000, not 1000, so the daemon looked for
fingers-10000.map and the file I had written was fingers-1000.map. Two probe-mode
enrolments today also went into gid 1000 on the same assumption -- a group the
daemon will never select for that user, since gid is the uid by design.

Nothing to correct in the daemon; the assumption was mine, and the fix is to
enrol through the daemon rather than around it. The log line stays because
"which uid did we resolve and which file did we open" is the first question
every time this surface says a user has nothing enrolled.
This commit is contained in:
Jorijn van der Graaf 2026-09-02 22:13:27 +02:00
commit ca9e84b24f

View file

@ -1528,10 +1528,16 @@ std::string MapPath(std::uint32_t uid) {
}
fingerprintd::store::Map LoadMap(std::uint32_t uid) {
std::ifstream f(MapPath(uid));
if (!f) return {};
std::string path = MapPath(uid);
std::ifstream f(path);
if (!f) {
std::println("map {}: {}", path, ::strerror(errno));
return {};
}
std::string text((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
return fingerprintd::store::Map::Decode(text);
auto m = fingerprintd::store::Map::Decode(text);
std::println("map {}: {} bytes, {} finger(s)", path, text.size(), m.Size());
return m;
}
void SaveMap(std::uint32_t uid, const fingerprintd::store::Map& m) {
@ -1712,6 +1718,8 @@ void HandleDevice(GDBusMethodInvocation* inv, std::string_view method, GVariant*
g_variant_get(params, "(&s)", &username);
auto who = ResolveUser(username ? username : "", inv);
if (!who) { ReturnError(inv, "Internal", "no such user"); return; }
std::println("ListEnrolledFingers('{}') -> {} uid {}", username ? username : "",
who->first, who->second);
auto m = LoadMap(who->second);
if (m.Size() == 0) { ReturnError(inv, "NoEnrolledPrints", "no fingers enrolled"); return; }
GVariantBuilder b;