<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>12932</bug_id>
          
          <creation_ts>2018-09-25 19:24:25 +0000</creation_ts>
          <short_desc>USERADD_ERROR_DYNAMIC = &quot;error&quot; does not throw errors on missing groupIds/userIds.  =&quot;warn&quot; works.</short_desc>
          <delta_ts>2020-03-11 19:11:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>2.5.2</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sue Wolber">susan_wolber</reporter>
          <assigned_to name="Peter Kjellerstedt">peter.kjellerstedt</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>Regression (Used to work)</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>81621</commentid>
    <comment_count>0</comment_count>
    <who name="Sue Wolber">susan_wolber</who>
    <bug_when>2018-09-25 19:24:25 +0000</bug_when>
    <thetext>Basically I expect that 
    USERADD_ERROR_DYNAMIC = &quot;error&quot;
And
    USERADD_ERROR_DYNAMIC = &quot;warn&quot;
Will do 99% the same thing as each other - one gives warnings and one gives errors, but the _list_ of missing userIds and groupdIds being listed as warnings or errors should be the same.

Instead I see that the lists are completely different.  Building with empty group/passwd files:
&quot;warn&quot; warns about 16 missing userIds and 22 missing groupIds in various recipes 
&quot;error&quot; errors about 2 missing userIds and 1 missing groupId in the &apos;dbus&apos; recipe.  After these entries are added to the group/passwd files, no other errors are thrown from any other recipe.
 

To reproduce:

git clone git://git.yoctoproject.org/poky poky_sumo 
cd poky_sumo 
git checkout sumo 
source oe-init-build-env 
cat &gt; useradd_error.conf  &lt;&lt; EOF 
USERADD_ERROR_DYNAMIC = &quot;error&quot;
USERADDEXTENSION = &quot;useradd-staticids&quot;
USERADD_UID_TABLES = &quot;./passwd&quot;
USERADD_GID_TABLES = &quot;./group&quot;
EOF
cat &gt; group &lt;&lt; EOF
messagebus:x:994:
netdev:x:995:
EOF
cat &gt; passwd &lt;&lt; EOF
messagebus:x:995:::::
EOF
bitbake core-image-minimal -r useradd_error.conf


# No errors are thrown, build completes.  Expected to get errors on missing userId / groupId like &apos;dhcp&apos;, &apos;rpc&apos; &apos;sshd&apos; etc
# If files &apos;passwd&apos; and &apos;group&apos; are empty, dbus recipe throws errors.  No other recipes are observed to throw errors
# If instead of   USERADD_ERROR_DYNAMIC = &quot;error&quot;    you set   =&quot;warn&quot; and rebuild from clean, then warnings are thrown for ~16 missing userIds &amp; ~22 missing groupIds
# poky &apos;morty&apos; throws errors as expected on many recipes.  &apos;pyro&apos; through sumo &amp; master do not as of 24 Sept 2018</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83841</commentid>
    <comment_count>1</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2019-05-16 20:55:10 +0000</bug_when>
    <thetext>(I had not noticed that I had been assigned to this, hence the late answer.)

I believe this is working as intended, even though the result may be a bit confusing at first. When USERADD_ERROR_DYNAMIC is set to &quot;warn&quot;, it will report all user/group IDs that do not have any static IDs assigned for all recipes in all layers. However, when it is set to &quot;error&quot;, it will only fail with an error for those recipes that are actually built. This saves you from having to add static IDs for all those recipes you know you will never build.

If you add a bb.warn(msg) before raise NotImplementedError(msg) in the handle_missing_id() function in useradd-staticids.bbclass, you should see all the warnings during parsing, and later the errors during build.

What we could do, I guess, is to update the documentation to clarify the behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83842</commentid>
    <comment_count>2</comment_count>
    <who name="Sue Wolber">susan_wolber</who>
    <bug_when>2019-05-16 21:12:17 +0000</bug_when>
    <thetext>Hi Peter,
You say
&gt; When USERADD_ERROR_DYNAMIC is set to &quot;warn&quot;, it will report all user/group IDs that do not have any static IDs assigned for all recipes in all layers. However, when it is set to &quot;error&quot;, it will only fail with an error for those recipes that are actually built.

Ok yes thanks for explaining the difference between &quot;all recipes&quot; and &quot;all recipes that are actually built&quot;.  

But I think that still matches the behavior I expect, which isn&apos;t the behavior I see.  My problem is that building poky core-image-minimal creates /etc/passwd and /etc/group with 16-20 entries.  If I create static files with only 2 entries, and turn on  USERADD_ERROR_DYNAMIC=&quot;error&quot;, I expect to see the other (missing static id values) 14-18 entries in /etc/passwd and /etc/group cause build errors.  The generated /etc/passwd and /etc/group entries are only for the recipes being built, right?

There&apos;s obviously some confusion here.  What am I not understanding?
:-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83860</commentid>
    <comment_count>3</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2019-05-18 21:03:01 +0000</bug_when>
    <thetext>Ah, you are probably thinking of the default users and groups installed by base-passwd, e.g., root, daemon, bin, sys, etc. They have static IDs from the upstream Debian package. After building base-passwd, you can find the default users in tmp/sysroots-components/core2-64/base-passwd/usr/share/base-passwd/passwd.master (assuming you build for qemux86-64). Those should match the users you saw in /etc/passwd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83875</commentid>
    <comment_count>4</comment_count>
    <who name="Sue Wolber">susan_wolber</who>
    <bug_when>2019-05-22 00:56:27 +0000</bug_when>
    <thetext>Ah.... yes you are right.  I didn&apos;t know those userids and groupids were static from the upstream packages!

I have been re-testing with thud and you are absolutely correct.
SO sorry to have wasted your time!
Please close this bug as stupid-user-misunderstanding.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83876</commentid>
    <comment_count>5</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2019-05-22 07:22:25 +0000</bug_when>
    <thetext>Nah, it&apos;s not stupid. Even though the functionality is correct, the documentation can obviously be improved.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84676</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-08-15 15:03:38 +0000</bug_when>
    <thetext>Could someone send a patch to clarify the docs so we could close this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85795</commentid>
    <comment_count>7</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2019-12-11 17:15:03 +0000</bug_when>
    <thetext>Long, long overdue, but I just sent a patch to yocto@lists.yoctoproject.org to update the documentation for USERADD_ERROR_DYNAMIC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86702</commentid>
    <comment_count>8</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2020-03-11 19:11:31 +0000</bug_when>
    <thetext>The update to the manual is now integrated.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>