All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures
@ 2016-05-25 12:13 Sébastien Szymanski
  2016-05-25 15:11 ` Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sébastien Szymanski @ 2016-05-25 12:13 UTC (permalink / raw)
  To: buildroot

With several archives in a space-separated list of patches, if one archive
cannot be untar (i.e because it is not readable), Buildroot keeps going instead
of aborting. Fix this by checking the tar return code.
While at it, check if the unpack archive directory creation is successful.

Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
---
 support/scripts/apply-patches.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
index 201278d..b0a8ad4 100755
--- a/support/scripts/apply-patches.sh
+++ b/support/scripts/apply-patches.sh
@@ -132,7 +132,11 @@ function scan_patchdir {
                 unpackedarchivedir="$builddir/.patches-$(basename $i)-unpacked"
                 rm -rf "$unpackedarchivedir" 2> /dev/null
                 mkdir "$unpackedarchivedir"
-                tar -C "$unpackedarchivedir" -xaf "${path}/$i"
+                if [ $? != 0 ] ; then
+                    echo "Error: cannot create $unpackedarchivedir directory."
+                    exit 1
+                fi
+                tar -C "$unpackedarchivedir" -xaf "${path}/$i" || exit 1
                 scan_patchdir "$unpackedarchivedir"
             else
                 apply_patch "$path" "$i"
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures
  2016-05-25 12:13 [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures Sébastien Szymanski
@ 2016-05-25 15:11 ` Thomas Petazzoni
  2016-05-25 16:04   ` Sébastien Szymanski
  2016-07-05 10:40 ` Romain Naour
  2016-07-05 11:05 ` Romain Naour
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2016-05-25 15:11 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 25 May 2016 14:13:59 +0200, S?bastien Szymanski wrote:
> With several archives in a space-separated list of patches, if one archive
> cannot be untar (i.e because it is not readable), Buildroot keeps going instead
> of aborting. Fix this by checking the tar return code.
> While at it, check if the unpack archive directory creation is successful.
> 
> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> ---
>  support/scripts/apply-patches.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Thanks for the patch. One question though: are you actually using the
capability of Buildroot to take a tarball, and apply the patches that
it contains? If so, for what use case?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures
  2016-05-25 15:11 ` Thomas Petazzoni
@ 2016-05-25 16:04   ` Sébastien Szymanski
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Szymanski @ 2016-05-25 16:04 UTC (permalink / raw)
  To: buildroot

Hi,

On 05/25/2016 05:11 PM, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 25 May 2016 14:13:59 +0200, S?bastien Szymanski wrote:
>> With several archives in a space-separated list of patches, if one archive
>> cannot be untar (i.e because it is not readable), Buildroot keeps going instead
>> of aborting. Fix this by checking the tar return code.
>> While at it, check if the unpack archive directory creation is successful.
>>
>> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
>> ---
>>  support/scripts/apply-patches.sh | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> Thanks for the patch. One question though: are you actually using the
> capability of Buildroot to take a tarball, and apply the patches that
> it contains? If so, for what use case?
> 

Yes, we use this Buildroot feature. We have an old kernel with several
tarballs of patches for our i.MX28-based SoM. They was provided that way
by Freescale I guess.

Regards,

> Thanks,
> 
> Thomas
> 


-- 
S?bastien Szymanski
Software Engineer
Armadeus Systems - A new vision of the embedded world
sebastien.szymanski at armadeus.com
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures
  2016-05-25 12:13 [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures Sébastien Szymanski
  2016-05-25 15:11 ` Thomas Petazzoni
@ 2016-07-05 10:40 ` Romain Naour
  2016-07-05 11:05 ` Romain Naour
  2 siblings, 0 replies; 5+ messages in thread
From: Romain Naour @ 2016-07-05 10:40 UTC (permalink / raw)
  To: buildroot

Hi S?bastien,

Le 25/05/2016 ? 14:13, S?bastien Szymanski a ?crit :
> With several archives in a space-separated list of patches, if one archive
> cannot be untar (i.e because it is not readable), Buildroot keeps going instead
> of aborting. Fix this by checking the tar return code.
> While at it, check if the unpack archive directory creation is successful.
> 
> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> ---
>  support/scripts/apply-patches.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
> index 201278d..b0a8ad4 100755
> --- a/support/scripts/apply-patches.sh
> +++ b/support/scripts/apply-patches.sh
> @@ -132,7 +132,11 @@ function scan_patchdir {
>                  unpackedarchivedir="$builddir/.patches-$(basename $i)-unpacked"
>                  rm -rf "$unpackedarchivedir" 2> /dev/null
>                  mkdir "$unpackedarchivedir"
> -                tar -C "$unpackedarchivedir" -xaf "${path}/$i"
> +                if [ $? != 0 ] ; then
> +                    echo "Error: cannot create $unpackedarchivedir directory."
> +                    exit 1
> +                fi

I don't see why mkdir can fail here.

> +                tar -C "$unpackedarchivedir" -xaf "${path}/$i" || exit 1

Ok with the check.

Best regards,
Romain


>                  scan_patchdir "$unpackedarchivedir"
>              else
>                  apply_patch "$path" "$i"
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures
  2016-05-25 12:13 [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures Sébastien Szymanski
  2016-05-25 15:11 ` Thomas Petazzoni
  2016-07-05 10:40 ` Romain Naour
@ 2016-07-05 11:05 ` Romain Naour
  2 siblings, 0 replies; 5+ messages in thread
From: Romain Naour @ 2016-07-05 11:05 UTC (permalink / raw)
  To: buildroot

Hi S?bastien,

Le 25/05/2016 ? 14:13, S?bastien Szymanski a ?crit :
> With several archives in a space-separated list of patches, if one archive
> cannot be untar (i.e because it is not readable), Buildroot keeps going instead
> of aborting. Fix this by checking the tar return code.
> While at it, check if the unpack archive directory creation is successful.

As discussed with other Buildroot developers, we prefer to use "set -e" in
apply-patches.sh

See:
http://patchwork.ozlabs.org/patch/644705

I'll mark you patch rejected in patchwork.

Thanks!

Best regards,
Romain


> 
> Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
> ---
>  support/scripts/apply-patches.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
> index 201278d..b0a8ad4 100755
> --- a/support/scripts/apply-patches.sh
> +++ b/support/scripts/apply-patches.sh
> @@ -132,7 +132,11 @@ function scan_patchdir {
>                  unpackedarchivedir="$builddir/.patches-$(basename $i)-unpacked"
>                  rm -rf "$unpackedarchivedir" 2> /dev/null
>                  mkdir "$unpackedarchivedir"
> -                tar -C "$unpackedarchivedir" -xaf "${path}/$i"
> +                if [ $? != 0 ] ; then
> +                    echo "Error: cannot create $unpackedarchivedir directory."
> +                    exit 1
> +                fi
> +                tar -C "$unpackedarchivedir" -xaf "${path}/$i" || exit 1
>                  scan_patchdir "$unpackedarchivedir"
>              else
>                  apply_patch "$path" "$i"
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-05 11:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25 12:13 [Buildroot] [PATCH 1/1] support/scripts/apply-patches.sh: handle tar and mkdir failures Sébastien Szymanski
2016-05-25 15:11 ` Thomas Petazzoni
2016-05-25 16:04   ` Sébastien Szymanski
2016-07-05 10:40 ` Romain Naour
2016-07-05 11:05 ` Romain Naour

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.