瀏覽代碼

support/apply-patches: re-instate set -e

As reported by Sébastien Szymanski [1], the apply-patches script
doesn't stop if a tar command can't extract an archive.

Use "set -e" to exit immediately if a command return an error.

Be sure to ignore any expected error: when we check if a patch to be
applied has the same basename as an already applied patch, the grep
would fail when no such patch was already applied. We should not fail
in this case.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Cc: Romain Naour <romain.naour@openwide.fr>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
Tested-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Yann E. MORIN 9 年之前
父節點
當前提交
d5ae67b4f4
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      support/scripts/apply-patches.sh

+ 3 - 1
support/scripts/apply-patches.sh

@@ -31,6 +31,8 @@
 # applied. The list of the patches applied is stored in '.applied_patches_list'
 # applied. The list of the patches applied is stored in '.applied_patches_list'
 # file in the build directory.
 # file in the build directory.
 
 
+set -e
+
 silent=
 silent=
 if [ "$1" = "-s" ] ; then
 if [ "$1" = "-s" ] ; then
     # add option to be used by the patch tool
     # add option to be used by the patch tool
@@ -103,7 +105,7 @@ function apply_patch {
         echo "Error: missing patch file ${path}/$patch"
         echo "Error: missing patch file ${path}/$patch"
         exit 1
         exit 1
     fi
     fi
-    existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list)"
+    existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list || true)"
     if [ -n "${existing}" ]; then
     if [ -n "${existing}" ]; then
         echo "Error: duplicate filename '${patch}'"
         echo "Error: duplicate filename '${patch}'"
         echo "Conflicting files are:"
         echo "Conflicting files are:"