unshare regression in 2.42-rc1

From: Chris Hofstaedtler

Date: Sun Mar 22 2026 - 07:48:19 EST


Hi Karel, Christian,

Debian CI found a regression in the unshare command when using --map-user with numeric UIDs. This worked in 2.41 and earlier:

% unshare --version && unshare --user --map-auto --map-user=65536 id
unshare from util-linux 2.41.3
uid=65536 gid=65534(nogroup) groups=65534(nogroup)

And is broken in 2.42-rc1:

% unshare --version && unshare --user --map-auto --map-user=65536 id
unshare from util-linux 2.42-rc1
unshare: failed to parse uid '65536'

Note the following (true in both cases):
$ grep 65536 /etc/passwd
%

I suspect (but did not verify yet) this was introduced in
commit 0a7fb806118bc4418e231081bd13c69bbc31b988
unshare: use the new ul_get{grp,userpw}_str() routines

This change refactors get_group() and get_user(), so that it
uses the new routines ul_getgrp_str() and ul_getuserpw_str(),
to simplify the code and remove the overkill mem allocations.
https://github.com/util-linux/util-linux/commit/0a7fb806118bc4418e231081bd13c69bbc31b988

Thanks to Helmut Grohne for reducing the failed debvm CI run to the short unshare command.

Best,
Chris