From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Jose Quaresma <quaresma.jose@gmail.com>,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Subject: RE: [OE-core] [PATCH] sstate: fix touching files inside pseudo
Date: Tue, 19 Oct 2021 19:37:52 +0000 [thread overview]
Message-ID: <b41d22f66c4b41d4ba82fff0ccdfba11@axis.com> (raw)
In-Reply-To: <20211018184711.94970-1-quaresma.jose@gmail.com>
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Jose Quaresma
> Sent: den 18 oktober 2021 20:47
> To: openembedded-core@lists.openembedded.org
> Cc: Jose Quaresma <quaresma.jose@gmail.com>
> Subject: [OE-core] [PATCH] sstate: fix touching files inside pseudo
>
> running the 'id' command inside the sstate_create_package
> function shows that this funcion run inside the pseudo:
>
> uid=0(root) gid=0(root) groups=0(root)
>
> The check for touch files [ ! -w ${SSTATE_PKG} ]
> will always return true and the touch can fail
> when the real user don't have permission or
> in readonly filesystem.
>
> As the documentation refers, the file test operator "-w"
> check if the file has write permission (for the user running the test).
>
> We can avoid this test running the touch and mask any return errors
> that we have.
>
> Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
> ---
> meta/classes/sstate.bbclass | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 7f034d746a..d4555150c4 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -830,7 +830,7 @@ sstate_task_postfunc[dirs] = "${WORKDIR}"
> sstate_create_package () {
> # Exit early if it already exists
> if [ -e ${SSTATE_PKG} ]; then
> - [ ! -w ${SSTATE_PKG} ] || touch ${SSTATE_PKG}
> + touch ${SSTATE_PKG} || true
You should pass stderr to /dev/null to avoid messages in the log
if/when touch fails, i.e.:
touch ${SSTATE_PKG} 2>/dev/null || :
> return
> fi
>
> @@ -865,7 +865,7 @@ sstate_create_package () {
> else
> rm $TFILE
> fi
> - [ ! -w ${SSTATE_PKG} ] || touch ${SSTATE_PKG}
> + touch ${SSTATE_PKG} || true
> }
>
> python sstate_sign_package () {
> --
> 2.33.1
//Peter
next prev parent reply other threads:[~2021-10-19 19:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 18:47 [PATCH] sstate: fix touching files inside pseudo Jose Quaresma
2021-10-19 19:37 ` Peter Kjellerstedt [this message]
2021-10-20 11:13 ` [OE-core] " Jose Quaresma
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=b41d22f66c4b41d4ba82fff0ccdfba11@axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=quaresma.jose@gmail.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