Bug 15452 - Using of uuid/guid of non-existing users causes KeyError
Summary: Using of uuid/guid of non-existing users causes KeyError
Status: RESOLVED INVALID
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 5.0
Hardware: x86 Multiple
: Undecided normal
Target Milestone: 0.0.0
Assignee: Pavel Zhukov
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2024-03-21 16:06 UTC by Pavel Zhukov
Modified: 2024-03-22 17:20 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments
suggested patches (3.17 KB, patch)
2024-03-22 14:53 UTC, Pavel Zhukov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Zhukov 2024-03-21 16:06:00 UTC
do_install(){
       install --owner=1234 --group=1234 -d -m 0755 ${D}/mydir
}

causes [1]. While the failure and the reasoning behind are clear however chown'ing to uuid/guid of nonexisting users is valid usecase and should be allowed (user may not exist at the moment of building of the package, network users, systemd sysusers, NFS etc etc). 


[1]
File: '/mnt/builds/viso/viso-yocto-layer/oe-core/meta/lib/oe/sstatesig.py', lineno: 596, function: process
     0592:                    else:
     0593:                        add_perm(stat.S_IXOTH, 'x')
     0594:
     0595:                    try:
 *** 0596:                        update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
     0597:                        update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
     0598:                    except KeyError as e:
     0599:                        msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match "
     0600:                            "any user/group on target. This may be due to host contamination." %
Exception: Exception: KeyError: 'getpwuid(): uid not found: 1234'
Path /mnt/builds/viso/builds/build/tmp/work/core2-64-oe-linux/solutionmanager/git/sstate-build-package/package/mydir is owned by uid 1234, gid 1234, which doesn't match any user/group on target. This may be due to host contamination.
Comment 1 Pavel Zhukov 2024-03-22 14:53:55 UTC
Created attachment 5035 [details]
suggested patches
Comment 2 Richard Purdie 2024-03-22 16:18:48 UTC
This isn't supported, the recipe providing the user/group should be a dependency, then it will exist in the passwd/group files.
Comment 3 Pavel Zhukov 2024-03-22 17:20:57 UTC
Closing as this is clearly unsupported and can be easily worked around by creating user