All of lore.kernel.org
 help / color / mirror / Atom feed
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: another fix for touching files inside pseudo
Date: Thu, 4 Nov 2021 17:01:10 +0000	[thread overview]
Message-ID: <ec28e677b4354353ac6f93564fb68f72@axis.com> (raw)
In-Reply-To: <20211104154221.57948-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 4 november 2021 16:42
> To: openembedded-core@lists.openembedded.org
> Cc: Jose Quaresma <quaresma.jose@gmail.com>
> Subject: [OE-core] [PATCH] sstate: another fix for touching files inside
> pseudo
> 
> This patch is a fixup for 676757f "sstate: fix touching files inside
> pseudo"
> 
> running the 'id' command inside the sstate_unpack_package
> function shows that this funcion run inside the pseudo:
> 
>  uid=0(root) gid=0(root) groups=0(root)
> 
> The check for [ -w ${SSTATE_PKG} ] and [ -O ${SSTATE_PKG}.siginfo ]
> 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).
> - the file test operator "-O" check if you are owner of file
> 
> 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 | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 8182010047..e4d58639f3 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -900,12 +900,12 @@ sstate_unpack_package () {
>  	fi
> 
>  	tar -I "$ZSTD" -xvf ${SSTATE_PKG}
> -	# update .siginfo atime on local/NFS mirror
> -	[ -O ${SSTATE_PKG}.siginfo ] && [ -w ${SSTATE_PKG}.siginfo ] && [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo
> -	# Use "! -w ||" to return true for read only files
> -	[ ! -w ${SSTATE_PKG} ] || touch --no-dereference ${SSTATE_PKG}
> -	[ ! -w ${SSTATE_PKG}.sig ] || [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig
> -	[ ! -w ${SSTATE_PKG}.siginfo ] || [ ! -e ${SSTATE_PKG}.siginfo ] || touch --no-dereference ${SSTATE_PKG}.siginfo
> +	# update .siginfo atime on local/NFS mirror if it is a symbolic link
> +	[ ! -h ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true
> +	# update each symbolic link instead of any referenced file
> +	touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true
> +	touch --no-dereference ${SSTATE_PKG}.siginfo 2>/dev/null || true

To match the original code this should be:

	[ ! -e ${SSTATE_PKG}.siginfo ] || touch --no-dereference ${SSTATE_PKG}.siginfo 2>/dev/null || true

Or was there some reason you removed the test for if the siginfo 
file exists before touching it? If so, then the commit message 
should state this.

> +	[ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true
>  }
> 
>  BB_HASHCHECK_FUNCTION = "sstate_checkhashes"
> --
> 2.33.1

//Peter



  reply	other threads:[~2021-11-04 17:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 15:42 [PATCH] sstate: another fix for touching files inside pseudo Jose Quaresma
2021-11-04 17:01 ` Peter Kjellerstedt [this message]
2021-11-04 19:06   ` [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=ec28e677b4354353ac6f93564fb68f72@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.