* [PATCH 1/1] fix group splitting in user creation
@ 2023-07-26 4:59 Felix Moessbauer
2023-07-26 10:59 ` Gylstorff Quirin
0 siblings, 1 reply; 2+ messages in thread
From: Felix Moessbauer @ 2023-07-26 4:59 UTC (permalink / raw)
To: isar-users; +Cc: tobias.schaffner, Felix Moessbauer
There is a bug when converting the USER_<foo>[groups] configuration
from the bitbake format (space separated) to the format useradd
expects (comma separated). We cannot simply replace spaces with commas,
as then multiple spaces in a row would create multiple commas. Instead,
we need to split it first into the tokens and then join these tokens by
comma.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes/image-account-extension.bbclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/classes/image-account-extension.bbclass b/meta/classes/image-account-extension.bbclass
index e783c135..6f67f459 100644
--- a/meta/classes/image-account-extension.bbclass
+++ b/meta/classes/image-account-extension.bbclass
@@ -98,10 +98,10 @@ def image_create_users(d: "DataSmart") -> None:
add_user_option("--comment", "comment")
add_user_option("--shell", "shell")
- groups = d.getVarFlag(user_entry, "groups") or ""
+ groups = (d.getVarFlag(user_entry, "groups") or "").split()
if groups:
args.append("--groups")
- args.append(groups.replace(' ', ','))
+ args.append(','.join(groups))
flags = (d.getVarFlag(user_entry, "flags") or "").split()
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] fix group splitting in user creation
2023-07-26 4:59 [PATCH 1/1] fix group splitting in user creation Felix Moessbauer
@ 2023-07-26 10:59 ` Gylstorff Quirin
0 siblings, 0 replies; 2+ messages in thread
From: Gylstorff Quirin @ 2023-07-26 10:59 UTC (permalink / raw)
To: isar-users
On 7/26/23 06:59, 'Felix Moessbauer' via isar-users wrote:
> There is a bug when converting the USER_<foo>[groups] configuration
> from the bitbake format (space separated) to the format useradd
> expects (comma separated). We cannot simply replace spaces with commas,
> as then multiple spaces in a row would create multiple commas. Instead,
> we need to split it first into the tokens and then join these tokens by
> comma.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> meta/classes/image-account-extension.bbclass | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/image-account-extension.bbclass b/meta/classes/image-account-extension.bbclass
> index e783c135..6f67f459 100644
> --- a/meta/classes/image-account-extension.bbclass
> +++ b/meta/classes/image-account-extension.bbclass
> @@ -98,10 +98,10 @@ def image_create_users(d: "DataSmart") -> None:
> add_user_option("--comment", "comment")
> add_user_option("--shell", "shell")
>
> - groups = d.getVarFlag(user_entry, "groups") or ""
> + groups = (d.getVarFlag(user_entry, "groups") or "").split()
> if groups:
> args.append("--groups")
> - args.append(groups.replace(' ', ','))
> + args.append(','.join(groups))
>
> flags = (d.getVarFlag(user_entry, "flags") or "").split()
>
I haved tested the patch. Looks good to me. Is it possible to add
unittest for this?
Quirin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-26 10:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 4:59 [PATCH 1/1] fix group splitting in user creation Felix Moessbauer
2023-07-26 10:59 ` Gylstorff Quirin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox