From: Louis Rannou <lrannou@baylibre.com>
To: tgamblin@baylibre.com,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Subject: [RFC] incorrect parsing of sysusers.d in rootfs generation
Date: Mon, 5 Jun 2023 17:55:35 +0200 [thread overview]
Message-ID: <b02fd7f2-b6f7-01f6-256a-d1bf9f7aa91a@baylibre.com> (raw)
Hello,
I have found an issue in the rootfs routine. The
rootfs-postcommands.bbclass has a funtion systemd_create_users that
reads /etc/sysusers.d/*.conf files and parses lines as 'type name id
comment'.
However, the sysusers.d manual says, those lines can be 'type name id
comment home_dir shell'. If a home directory of shell is defined, they
are considered as part of the comment, and we run incorrect commands
such as the one below :
useradd --shell /sbin/nologin --uid 0 --comment "Super User" /root
--system root
To fix that, we require a stronger parsing. Several options look
possible to me, but I am not sure which one is preferred.
1. sed with a regular expression that returns something that still needs
parsing
2. awk with a step by step script that returns something that still
needs to be parsed
3. use python and regexp module
Also I don't know if the parsing should completely check the sysusers
syntax as said in the manual (first field is [urgm], second is
alphanum_-, etc.). In my opinion it should not as this will be made by
the useradd command.
Do you think it worth to add some testing about that ? I am not sure how
to do that.
Regards,
Louis Rannou
next reply other threads:[~2023-06-05 15:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 15:55 Louis Rannou [this message]
2023-06-07 15:16 ` [RFC] incorrect parsing of sysusers.d in rootfs generation Louis Rannou
2023-06-08 9:19 ` [OE-core] " Richard Purdie
2023-06-08 10:28 ` Louis Rannou
2023-06-08 10:36 ` Richard Purdie
2023-06-08 11:56 ` Louis Rannou
2023-06-09 11:06 ` Louis Rannou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b02fd7f2-b6f7-01f6-256a-d1bf9f7aa91a@baylibre.com \
--to=lrannou@baylibre.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=tgamblin@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).