Skip to contentSkip to conversation

classes/lib/useradd: The option -P is deprecated

OE-core Daiane Angolini 2 participants 3 messages Oct 18, 2021 – Oct 21, 2021

lore
Share & tools
lore
#0 lore raw

Since [1] the option -P is not available, so remove it from parsing lib.

This is a partial fix for [YOCTO #14605].

During the do_rootfs, the error message when using -P is:

useradd: unrecognized option '--clear-password'

---
 meta/lib/oe/useradd.py | 1 -
 1 file changed, 1 deletion(-)
meta/lib/oe/useradd.py +0 -1
index 8fc77568ff..63768311ee 100644
@@ -45,7 +45,6 @@ def build_useradd_parser():
     parser.add_argument("-N", "--no-user-group", dest="user_group", help="do not create a group with the same name as the user", action="store_const", const=False)
     parser.add_argument("-o", "--non-unique", help="allow to create users with duplicate (non-unique UID)", action="store_true")
     parser.add_argument("-p", "--password", metavar="PASSWORD", help="encrypted password of the new account")
-    parser.add_argument("-P", "--clear-password", metavar="CLEAR_PASSWORD", help="use this clear password for the new account")
     parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into")
     parser.add_argument("-r", "--system", help="create a system account", action="store_true")
     parser.add_argument("-s", "--shell", metavar="SHELL", help="login shell of the new account")
Signature · 1 line
2.30.2
#1 lore raw

Hello Daiane,

Quoted 18 lines · Daiane Angolini

Since [1] the option -P is not available, so remove it from parsing lib.

This is a partial fix for [YOCTO #14605].

During the do_rootfs, the error message when using -P is:

useradd: unrecognized option '--clear-password'

---
 meta/lib/oe/useradd.py | 1 -
 1 file changed, 1 deletion(-)
meta/lib/oe/useradd.py +0 -0
index 8fc77568ff..63768311ee 100644

meta/lib/oe/useradd.py def build_useradd_parser(): · line 48

Quoted 4 lines
meta/lib/oe/useradd.py +0 -1
@@ -45,7 +45,6 @@ def build_useradd_parser():
     parser.add_argument("-N", "--no-user-group", dest="user_group", help="do not create a group with the same name as the user", action="store_const", const=False)
     parser.add_argument("-o", "--non-unique", help="allow to create users with duplicate (non-unique UID)", action="store_true")
     parser.add_argument("-p", "--password", metavar="PASSWORD", help="encrypted password of the new account")
-    parser.add_argument("-P", "--clear-password", metavar="CLEAR_PASSWORD", help="use this clear password for the new account")

This causes an issue in useradd-staticids.bbclass

https://autobuilder.yoctoproject.org/typhoon/#/builders/115/builds/847/steps/12/logs/stdio

File: '<code>', lineno: 20, function: <module>
0016:__anon_177__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_siteinfo_bbclass(d) 0017:__anon_63__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_update_rc_d_bbclass(d) 0018:__anon_23__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_systemd_bbclass(d) 0019:__anon_195__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_useradd_bbclass(d)
*** 0020:__anon_311__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_useradd_staticids_bbclass(d)
0021:__anon_114__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_update_alternatives_bbclass(d)
File: '/home/pokybuild/yocto-worker/reproducible-centos/build/meta/classes/useradd-staticids.bbclass', lineno: 307, function: __anon_311__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_useradd_staticids_bbclass

     0303:python __anonymous() {
     0304:    if not bb.data.inherits_class('nativesdk', d) \
     0305:        and not bb.data.inherits_class('native', d):
     0306:        try:

*** 0307: update_useradd_static_config(d)
0308: except NotImplementedError as f:
0309: bb.debug(1, "Skipping recipe %s: %s" % (d.getVar('PN'), f))
0310: raise bb.parse.SkipRecipe(f)
0311:}
File: '/home/pokybuild/yocto-worker/reproducible-centos/build/meta/classes/useradd-staticids.bbclass', lineno: 271, function: update_useradd_static_config

     0267:        # is a bit of a waste -- only process useradd/groupadd
     0268:        useradd_param = d.getVar('USERADD_PARAM:%s' % pkg)
     0269:        if useradd_param:
     0270:            #bb.warn("Before: 'USERADD_PARAM:%s' - '%s'" % (pkg, useradd_param))
 *** 0271:            d.setVar('USERADD_PARAM:%s' % pkg, rewrite_useradd(useradd_param, True))
     0272:            #bb.warn("After:  'USERADD_PARAM:%s' - '%s'" % (pkg, d.getVar('USERADD_PARAM:%s' % pkg)))

0273:
0274: groupadd_param = d.getVar('GROUPADD_PARAM:%s' % pkg)
0275: if groupadd_param:
File: '/home/pokybuild/yocto-worker/reproducible-centos/build/meta/classes/useradd-staticids.bbclass', lineno: 177, function: rewrite_useradd

     0173:            newparam += ['', ' --no-user-group'][uaargs.user_group is False]
     0174:            newparam += ['', ' --non-unique'][uaargs.non_unique]
     0175:            if uaargs.password != None:
     0176:                newparam += ['', ' --password %s' % uaargs.password][uaargs.password != None]
 *** 0177:            elif uaargs.clear_password:
     0178:                newparam += ['', ' --clear-password %s' % uaargs.clear_password][uaargs.clear_password != None]
     0179:            newparam += ['', ' --root %s' % uaargs.root][uaargs.root != None]
     0180:            newparam += ['', ' --system'][uaargs.system]
     0181:            newparam += ['', ' --shell %s' % uaargs.shell][uaargs.shell != None]

Exception: AttributeError: 'Namespace' object has no attribute 'clear_password'

Quoted 16 lines
meta/lib/oe/useradd.py +0 -0
     parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into")
     parser.add_argument("-r", "--system", help="create a system account", action="store_true")
     parser.add_argument("-s", "--shell", metavar="SHELL", help="login shell of the new account")
Signature · 11 lines
2.30.2



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#157090): https://lists.openembedded.org/g/openembedded-core/message/157090
Mute This Topic: https://lists.openembedded.org/mt/86422106/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw
Quoted 17 lines · Alexandre Belloni

Hello Daiane,

Quoted 13 lines · Daiane Angolini

Since [1] the option -P is not available, so remove it from parsing lib.

This is a partial fix for [YOCTO #14605].

During the do_rootfs, the error message when using -P is:

useradd: unrecognized option '--clear-password'

---
 meta/lib/oe/useradd.py | 1 -
 1 file changed, 1 deletion(-)
Quoted 11 lines

meta/lib/oe/useradd.py def build_useradd_parser(): · line 48

Quoted 9 lines
meta/lib/oe/useradd.py +0 -1
index 8fc77568ff..63768311ee 100644
@@ -45,7 +45,6 @@ def build_useradd_parser():
     parser.add_argument("-N", "--no-user-group", dest="user_group", help="do not create a group with the same name as the user", action="store_const", const=False)
     parser.add_argument("-o", "--non-unique", help="allow to create users with duplicate (non-unique UID)", action="store_true")
     parser.add_argument("-p", "--password", metavar="PASSWORD", help="encrypted password of the new account")
-    parser.add_argument("-P", "--clear-password", metavar="CLEAR_PASSWORD", help="use this clear password for the new account")

This causes an issue in useradd-staticids.bbclass

I had imagined this would cause problems in other places, some of them I would not be aware of.
I will take a look again on this issue, and I have already sent an adjustment to the documentation to also cover the bug #14605

But I don't hope to be able to do so in the next 2 days.

Thanks,
Daiane

Quoted 64 lines

https://autobuilder.yoctoproject.org/typhoon/#/builders/115/builds/847/steps/12/logs/stdio

File: '<code>', lineno: 20, function: <module>
0016:__anon_177__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_siteinfo_bbclass(d) 0017:__anon_63__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_update_rc_d_bbclass(d) 0018:__anon_23__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_systemd_bbclass(d) 0019:__anon_195__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_useradd_bbclass(d)
*** 0020:__anon_311__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_useradd_staticids_bbclass(d)
0021:__anon_114__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_update_alternatives_bbclass(d)
File: '/home/pokybuild/yocto-worker/reproducible-centos/build/meta/classes/useradd-staticids.bbclass', lineno: 307, function: __anon_311__home_pokybuild_yocto_worker_reproducible_centos_build_meta_classes_useradd_staticids_bbclass

     0303:python __anonymous() {
     0304:    if not bb.data.inherits_class('nativesdk', d) \
     0305:        and not bb.data.inherits_class('native', d):
     0306:        try:

*** 0307: update_useradd_static_config(d)
0308: except NotImplementedError as f:
0309: bb.debug(1, "Skipping recipe %s: %s" % (d.getVar('PN'), f))
0310: raise bb.parse.SkipRecipe(f)
0311:}
File: '/home/pokybuild/yocto-worker/reproducible-centos/build/meta/classes/useradd-staticids.bbclass', lineno: 271, function: update_useradd_static_config

     0267:        # is a bit of a waste -- only process useradd/groupadd
     0268:        useradd_param = d.getVar('USERADD_PARAM:%s' % pkg)
     0269:        if useradd_param:
     0270:            #bb.warn("Before: 'USERADD_PARAM:%s' - '%s'" % (pkg, useradd_param))
 *** 0271:            d.setVar('USERADD_PARAM:%s' % pkg, rewrite_useradd(useradd_param, True))
     0272:            #bb.warn("After:  'USERADD_PARAM:%s' - '%s'" % (pkg, d.getVar('USERADD_PARAM:%s' % pkg)))

0273:
0274: groupadd_param = d.getVar('GROUPADD_PARAM:%s' % pkg)
0275: if groupadd_param:
File: '/home/pokybuild/yocto-worker/reproducible-centos/build/meta/classes/useradd-staticids.bbclass', lineno: 177, function: rewrite_useradd

     0173:            newparam += ['', ' --no-user-group'][uaargs.user_group is False]
     0174:            newparam += ['', ' --non-unique'][uaargs.non_unique]
     0175:            if uaargs.password != None:
     0176:                newparam += ['', ' --password %s' % uaargs.password][uaargs.password != None]
 *** 0177:            elif uaargs.clear_password:
     0178:                newparam += ['', ' --clear-password %s' % uaargs.clear_password][uaargs.clear_password != None]
     0179:            newparam += ['', ' --root %s' % uaargs.root][uaargs.root != None]
     0180:            newparam += ['', ' --system'][uaargs.system]
     0181:            newparam += ['', ' --shell %s' % uaargs.shell][uaargs.shell != None]

Exception: AttributeError: 'Namespace' object has no attribute 'clear_password'

Quoted 8 lines
meta/lib/oe/useradd.py +0 -1
     parser.add_argument("-R", "--root", metavar="CHROOT_DIR", help="directory to chroot into")
     parser.add_argument("-r", "--system", help="create a system account", action="store_true")
     parser.add_argument("-s", "--shell", metavar="SHELL", help="login shell of the new account")
--

2.30.2

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#157090): https://lists.openembedded.org/g/openembedded-core/message/157090
Mute This Topic: https://lists.openembedded.org/mt/86422106/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com