Skip to contentSkip to conversation

useradd-staticids.bbclass: Support recipes specifying static IDs

PATCH Superseded Peter Kjellerstedt 2 participants 4 messages Mar 14, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 useradd-staticids.bbclass: Support recipes specifying static IDs

If this bblcass is used and a recipe specifies a static ID for a user/group as part of the USERADD_PARAM_${PN} or GROUPADD_PARAM_${PN}, the build would fail with and error like this if there was no corresponding ID in the passwd/group files specified via USERADD_UID_TABLES/USERADD_GID_TABLES:

ERROR: meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb:
meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or GROUPMEMS_PARAM for package postgresql

---
 meta/classes/useradd-staticids.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/useradd-staticids.bbclass +2 -0
index a65c3f69cb..9b194df490 100644
@@ -125,6 +125,7 @@ def update_useradd_static_config(d):
             if uaargs.LOGIN not in users:
                 if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid:
                     handle_missing_id(uaargs.LOGIN, 'user', pkg)
+                newparams.append(param)
                 continue
 
             field = users[uaargs.LOGIN]
@@ -260,6 +261,7 @@ def update_useradd_static_config(d):
             if gaargs.GROUP not in groups:
                 if not gaargs.gid or not gaargs.gid.isdigit():
                     handle_missing_id(gaargs.GROUP, 'group', pkg)
+                newparams.append(param)
                 continue
 
             field = groups[gaargs.GROUP]
Signature · 1 line
2.12.0
#1 lore raw

PATCH v2 2/2 useradd-staticids.bbclass: Always fail/warn for missing IDs

Previously, with USERADD_ERROR_DYNAMIC set to error/warn, if a static UID/GID was specified in the recipe, then no error/warning would be issued even if no ID was specified in the passwd/groups files.

---
 meta/classes/useradd-staticids.bbclass | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta/classes/useradd-staticids.bbclass +2 -4
index 9b194df490..c156a12ee5 100644
@@ -123,8 +123,7 @@ def update_useradd_static_config(d):
                 users = merge_files(get_passwd_list(d), 7)
 
             if uaargs.LOGIN not in users:
-                if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid:
-                    handle_missing_id(uaargs.LOGIN, 'user', pkg)
+                handle_missing_id(uaargs.LOGIN, 'user', pkg)
                 newparams.append(param)
                 continue
 
@@ -259,8 +258,7 @@ def update_useradd_static_config(d):
                 groups = merge_files(get_group_list(d), 4)
 
             if gaargs.GROUP not in groups:
-                if not gaargs.gid or not gaargs.gid.isdigit():
-                    handle_missing_id(gaargs.GROUP, 'group', pkg)
+                handle_missing_id(gaargs.GROUP, 'group', pkg)
                 newparams.append(param)
                 continue
 
Signature · 1 line
2.12.0
#2 lore raw

Re: [PATCHv2 2/2] useradd-staticids.bbclass: Always fail/warn for missing IDs

Quoted 3 lines · Peter Kjellerstedt

Previously, with USERADD_ERROR_DYNAMIC set to error/warn, if a static UID/GID was specified in the recipe, then no error/warning would be issued even if no ID was specified in the passwd/groups files.

I'm glad it was this simple to implement.

Acked.

--Mark

Quoted 30 lines
---
 meta/classes/useradd-staticids.bbclass | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta/classes/useradd-staticids.bbclass +2 -4
index 9b194df490..c156a12ee5 100644
@@ -123,8 +123,7 @@ def update_useradd_static_config(d):
                 users = merge_files(get_passwd_list(d), 7)
 
             if uaargs.LOGIN not in users:
-                if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid:
-                    handle_missing_id(uaargs.LOGIN, 'user', pkg)
+                handle_missing_id(uaargs.LOGIN, 'user', pkg)
                 newparams.append(param)
                 continue
 
@@ -259,8 +258,7 @@ def update_useradd_static_config(d):
                 groups = merge_files(get_group_list(d), 4)
 
             if gaargs.GROUP not in groups:
-                if not gaargs.gid or not gaargs.gid.isdigit():
-                    handle_missing_id(gaargs.GROUP, 'group', pkg)
+                handle_missing_id(gaargs.GROUP, 'group', pkg)
                 newparams.append(param)
                 continue
 
#3 lore raw
In reply to Peter Kjellerstedt
Quoted 1 line · Peter Kjellerstedt

If this bblcass is used and a recipe specifies a static ID for a

'bbclass' (typo)

Otherwise, acked.

Quoted 36 lines

user/group as part of the USERADD_PARAM_${PN} or GROUPADD_PARAM_${PN}, the build would fail with and error like this if there was no corresponding ID in the passwd/group files specified via USERADD_UID_TABLES/USERADD_GID_TABLES:

ERROR: meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb:
meta-oe/recipes-support/postgresql/postgresql_9.4.11.bb inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or GROUPMEMS_PARAM for package postgresql

---
 meta/classes/useradd-staticids.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/useradd-staticids.bbclass +2 -0
index a65c3f69cb..9b194df490 100644
@@ -125,6 +125,7 @@ def update_useradd_static_config(d):
             if uaargs.LOGIN not in users:
                 if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid:
                     handle_missing_id(uaargs.LOGIN, 'user', pkg)
+                newparams.append(param)
                 continue
 
             field = users[uaargs.LOGIN]
@@ -260,6 +261,7 @@ def update_useradd_static_config(d):
             if gaargs.GROUP not in groups:
                 if not gaargs.gid or not gaargs.gid.isdigit():
                     handle_missing_id(gaargs.GROUP, 'group', pkg)
+                newparams.append(param)
                 continue
 
             field = groups[gaargs.GROUP]