mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [ptxdist] [APPLIED] git-ptx-patches: Fix a race condition
Date: Thu,  7 Dec 2023 12:09:52 +0100	[thread overview]
Message-ID: <20231207110952.1328603-1-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20231129093743.906378-2-u.kleine-koenig@pengutronix.de>

Thanks, applied as 53de5f3e2e53582238bbd594aaa4749549672fb6.

Michael

[sent from post-receive hook]

On Thu, 07 Dec 2023 12:09:52 +0100, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> As the loop over the output of find moves files around, it can happen
> that find lists files more than once. In that case not only the "From "
> line is removed, but also the next one (usually the "From:" line).
> 
> To process each patch in series.auto exactly once, iterate over that
> file to remove the "From " line instead. Still be a bit conservative and
> make sure that only the intended line is dropped.
> 
> Reported-by: Thorsten Scherer <t.scherer@eckelmann.de>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Tested-by: Thorsten Scherer <t.scherer@eckelmann.de>
> Message-Id: <20231129093743.906378-2-u.kleine-koenig@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
> index a063cb73a875..df004fb8a8a5 100755
> --- a/scripts/git-ptx-patches
> +++ b/scripts/git-ptx-patches
> @@ -221,6 +221,13 @@ cat .ptxdist/series | _md5sum >> .ptxdist/series
>  
>  # The first line of the patch is 'From <some-git-hash> ...'
>  # remove it to avoid unnecessary changes in the patch files.
> +while read patch para; do
> +	# There are no comments or empty lines in series.auto, so no need to
> +	# handle these. Also be a bit cautious to only remove lines matching
> +	# "^From ".
> +	sed -i '1{/^From /d}' ".ptxdist/patches/$patch"
> +done < .ptxdist/series.auto
> +
>  find .ptxdist/patches/ ! -type d | sed -e 's,^.ptxdist/patches/,,' | \
>  while read patch para; do
>  	case "$patch" in
> @@ -228,9 +235,8 @@ while read patch para; do
>  		*) ;;
>  	esac
>  	if grep -q "$patch" .ptxdist/series.auto; then
> -		p=".ptxdist/patches/$patch"
> -		tail -n+2 "$p" > ".$patch.ptx-patches"
> -		mv ".$patch.ptx-patches" "$p"
> +		# ok, this is one of the patches we just touched
> +		:
>  	else
>  		if grep -q "$patch" .ptxdist/series.{0,1}; then
>  			echo "Base patch \"$patch\"!"



  parent reply	other threads:[~2023-12-07 11:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  9:37 [ptxdist] [PATCH 0/3] git-ptx-patches: A fix and two minor improvements Uwe Kleine-König
2023-11-29  9:37 ` [ptxdist] [PATCH 1/3] git-ptx-patches: Fix a race condition Uwe Kleine-König
2023-11-30  6:09   ` Thorsten Scherer
2023-12-07 11:09   ` Michael Olbrich [this message]
2023-11-29  9:37 ` [ptxdist] [PATCH 2/3] git-ptx-patches: Open .ptxdist/series less often for writing Uwe Kleine-König
2023-12-07 11:09   ` [ptxdist] [APPLIED] " Michael Olbrich
2023-11-29  9:37 ` [ptxdist] [PATCH 3/3] git-ptx-patches: Simplify nested if construct Uwe Kleine-König
2023-12-07 11:09   ` [ptxdist] [APPLIED] " Michael Olbrich

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=20231207110952.1328603-1-m.olbrich@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /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