Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH][for-krogoth] backport staticid fix
@ 2016-06-22 19:35 Stephano Cetola
  2016-06-22 19:35 ` [PATCH] useradd-staticids.bbclass: Restore failure on missing UIDs/GIDs Stephano Cetola
  2016-06-25 15:11 ` [PATCH][for-krogoth] backport staticid fix akuster808
  0 siblings, 2 replies; 3+ messages in thread
From: Stephano Cetola @ 2016-06-22 19:35 UTC (permalink / raw)
  To: openembedded-core

I've backported this from master and tested.

[ YOCTO #9777 ]

Peter Kjellerstedt (1):
  useradd-staticids.bbclass: Restore failure on missing UIDs/GIDs

 meta/classes/useradd-staticids.bbclass | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

-- 
2.8.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] useradd-staticids.bbclass: Restore failure on missing UIDs/GIDs
  2016-06-22 19:35 [PATCH][for-krogoth] backport staticid fix Stephano Cetola
@ 2016-06-22 19:35 ` Stephano Cetola
  2016-06-25 15:11 ` [PATCH][for-krogoth] backport staticid fix akuster808
  1 sibling, 0 replies; 3+ messages in thread
From: Stephano Cetola @ 2016-06-22 19:35 UTC (permalink / raw)
  To: openembedded-core; +Cc: Peter Kjellerstedt

From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>

A regression was introduced with commit 3149319a whereby setting
USERADD_ERROR_DYNAMIC no longer resulted in an error for users and
groups that were missing numeric UIDs and GIDs but were not mentioned
at all in any passwd or groups file.

[YOCTO #9777]

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit adc0f830a695c417b4d282fa580c5231e1f0afbe)
---
 meta/classes/useradd-staticids.bbclass | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index a9b506d..50a7481 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -46,6 +46,11 @@ def update_useradd_static_config(d):
 
         return id_table
 
+    def handle_missing_id(id, type, pkg):
+        if d.getVar('USERADD_ERROR_DYNAMIC', True) == '1':
+            #bb.error("Skipping recipe %s, package %s which adds %sname %s does not have a static ID defined." % (d.getVar('PN', True),  pkg, type, id))
+            raise bb.build.FuncFailed("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN', True), pkg, type, id))
+
     # We parse and rewrite the useradd components
     def rewrite_useradd(params):
         # The following comes from --help on useradd from shadow
@@ -112,6 +117,8 @@ 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)
                 continue
 
             field = users[uaargs.LOGIN]
@@ -161,9 +168,8 @@ def update_useradd_static_config(d):
             uaargs.shell = field[6] or uaargs.shell
 
             # Should be an error if a specific option is set...
-            if d.getVar('USERADD_ERROR_DYNAMIC', True) == '1' and not ((uaargs.uid and uaargs.uid.isdigit()) and uaargs.gid):
-                #bb.error("Skipping recipe %s, package %s which adds username %s does not have a static uid defined." % (d.getVar('PN', True),  pkg, uaargs.LOGIN))
-                raise bb.build.FuncFailed("%s - %s: Username %s does not have a static uid defined." % (d.getVar('PN', True), pkg, uaargs.LOGIN))
+            if not uaargs.uid or not uaargs.uid.isdigit() or not uaargs.gid:
+                 handle_missing_id(uaargs.LOGIN, 'user', pkg)
 
             # Reconstruct the args...
             newparam  = ['', ' --defaults'][uaargs.defaults]
@@ -244,6 +250,8 @@ 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)
                 continue
 
             field = groups[gaargs.GROUP]
@@ -253,9 +261,8 @@ def update_useradd_static_config(d):
                     bb.warn("%s: Changing groupname %s's gid from (%s) to (%s), verify configuration files!" % (d.getVar('PN', True), gaargs.GROUP, gaargs.gid, field[2]))
                 gaargs.gid = field[2]
 
-            if d.getVar('USERADD_ERROR_DYNAMIC', True) == '1' and not (gaargs.gid and gaargs.gid.isdigit()):
-                #bb.error("Skipping recipe %s, package %s which adds groupname %s does not have a static gid defined." % (d.getVar('PN', True),  pkg, gaargs.GROUP))
-                raise bb.build.FuncFailed("%s - %s: Groupname %s does not have a static gid defined." % (d.getVar('PN', True), pkg, gaargs.GROUP))
+            if not gaargs.gid or not gaargs.gid.isdigit():
+                handle_missing_id(gaargs.GROUP, 'group', pkg)
 
             # Reconstruct the args...
             newparam  = ['', ' --force'][gaargs.force]
-- 
2.8.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][for-krogoth] backport staticid fix
  2016-06-22 19:35 [PATCH][for-krogoth] backport staticid fix Stephano Cetola
  2016-06-22 19:35 ` [PATCH] useradd-staticids.bbclass: Restore failure on missing UIDs/GIDs Stephano Cetola
@ 2016-06-25 15:11 ` akuster808
  1 sibling, 0 replies; 3+ messages in thread
From: akuster808 @ 2016-06-25 15:11 UTC (permalink / raw)
  To: Stephano Cetola, openembedded-core

staged for krogoth-next

thanks,
Armin

On 06/22/2016 12:35 PM, Stephano Cetola wrote:
> I've backported this from master and tested.
> 
> [ YOCTO #9777 ]
> 
> Peter Kjellerstedt (1):
>   useradd-staticids.bbclass: Restore failure on missing UIDs/GIDs
> 
>  meta/classes/useradd-staticids.bbclass | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-25 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22 19:35 [PATCH][for-krogoth] backport staticid fix Stephano Cetola
2016-06-22 19:35 ` [PATCH] useradd-staticids.bbclass: Restore failure on missing UIDs/GIDs Stephano Cetola
2016-06-25 15:11 ` [PATCH][for-krogoth] backport staticid fix akuster808

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox