Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] apply-patches.sh: detect missing patches
Date: Fri, 13 Sep 2013 20:27:02 +0200	[thread overview]
Message-ID: <20130913182702.GB3301@free.fr> (raw)
In-Reply-To: <20130913181527.GA11933@harvey.netwinder.org>

Ralph, All,

On 2013-09-13 14:15 -0400, Ralph Siemsen spake thusly:
> The return status of the "cat <patchfile> | patch ..." pipeline
> is zero (success) even if the patchfile does not exist. This is
> because patch receives no input, which is not an error condition.
> Therefore, explicitly check that patch file exists.
> 
> Based on feedback on buildroot mailing list, also changed the
> check for unsupported file format. The build will now error out,
> rather than continuing on silently.
> ---
> 
> Hi Thomas,
> Hopefully the formatting is now correct.
> -Ralph
> 
> diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
> index 7d5856c..d6e8983 100755
> --- a/support/scripts/apply-patches.sh
> +++ b/support/scripts/apply-patches.sh
> @@ -70,13 +70,17 @@ function apply_patch {
>  	*.patch*)
>  	type="patch"; uncomp="cat"; ;;
>  	*)
> -	echo "Unsupported format file for ${patch}, skip it";
> -	return 0;
> +	echo "Unsupported format file for ${path}/${patch}";
> +	return 1;

I was a bit surprised to read that you used "return 1" here, rather than
a more explicit "exit 1".

For example, if the patch failed to apply cleanly, the function does not
"return 1" but does "exit 1" (just the line after your patch ends). So I
would prefer this behaviour to be homogeneous across the different
code-paths.

For the records, "return 1" does work since we call apply_patch thus:
    apply_patch "${patchfile}" || exit 1

This is not really straightforward. Just remove the "|| exit 1" and
change all the "return 1" into "exit 1", so the script really errors out
right away.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2013-09-13 18:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13 16:00 [Buildroot] [PATCH] apply-patches.sh: detect missing patches Ralph Siemsen
2013-08-23 10:31 ` Thomas De Schampheleire
2013-09-05  7:03   ` Thomas De Schampheleire
2013-09-05  8:04     ` Thomas Petazzoni
2013-09-05  8:35       ` Luca Ceresoli
2013-09-05 14:01         ` Yann E. MORIN
2013-09-05 19:20           ` Thomas De Schampheleire
2013-09-11 12:06             ` Ralph Siemsen
2013-09-12  8:08               ` Thomas De Schampheleire
2013-09-13 18:15                 ` [Buildroot] [PATCH v2] " Ralph Siemsen
2013-09-13 18:27                   ` Yann E. MORIN [this message]
2013-09-15 13:37                     ` Ralph Siemsen
2013-09-15 14:13                       ` [Buildroot] [PATCH v3] " Ralph Siemsen
2013-09-15 20:09                         ` Peter Korsgaard
2013-09-16  7:11                           ` Peter Korsgaard
2013-09-16 12:46                             ` Ralph Siemsen
2013-09-16 20:50                               ` Peter Korsgaard
2013-09-16 15:24                             ` Thomas Petazzoni
2013-09-16 19:45                               ` Ralph Siemsen
2013-09-16 20:07                                 ` Arnout Vandecappelle
2013-09-16 20:49                               ` Peter Korsgaard
2013-09-16 20:51                                 ` Yann E. MORIN
2013-09-16 20:57                                   ` Peter Korsgaard
2013-09-16 12:36                           ` Ralph Siemsen
2013-09-16 13:42                             ` Peter Korsgaard

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=20130913182702.GB3301@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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