Browse files

list: stop casting unknown UIDs to their unicode values

If a container is owned by a UID that is not listed in /etc/passwd,
previously we would cast the UID to a string which contained a character
with the unicode value of the UID. This is clearly wrong, switch to
using fmt.Sprintf as intended.

In addition, notate unknown users with a leading '#' in the column. This
is necessary to ensure that a user is not under the impression that the
UID is the same as a numeric username.

Signed-off-by: Aleksa Sarai <>
  • Loading branch information...
cyphar committed Jul 11, 2017
1 parent 3a5b963 commit 21a005d074ad5a801d7818153fb236e3b07b039c
Showing with 1 addition and 1 deletion.
  1. +1 −1 list.go
@@ -135,7 +135,7 @@ func getContainers(context *cli.Context) ([]containerState, error) {
stat := item.Sys().(*syscall.Stat_t)
owner, err := user.LookupUid(int(stat.Uid))
if err != nil {
owner.Name = string(stat.Uid)
owner.Name = fmt.Sprintf("#%d", stat.Uid)
container, err := factory.Load(item.Name())

0 comments on commit 21a005d

Please sign in to comment.