From e96a892a100f42f3ec7c293734a2e6ad8ae9e595 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 9 Feb 2020 02:54:53 +0100 Subject: [PATCH] config/functions: fix safe_remove of multiple files Several packages call safe_remove with a wildcard to remove multiple files but safe_remove only deleted the first one. Fix this by iterating over all arguments passed into safe_remove so unwanted files don't end up in the image. Signed-off-by: Matthias Reichl --- config/functions | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/functions b/config/functions index ee9b636886..6c50307457 100644 --- a/config/functions +++ b/config/functions @@ -132,17 +132,17 @@ build_msg() { # prints a warning if the file slated for removal doesn't exist # this allows us to continue instead of bailing out with just "rm" safe_remove() { - local path="$1" + local path - [ -z "${path}" ] && return 0 - - if [ -e "${path}" -o -L "${path}" ]; then - rm -r "${path}" - elif [ -n "${PKG_NAME}" ]; then - print_color CLR_WARNING "safe_remove: path does not exist: [${PKG_NAME}]: ${path}\n" - else - print_color CLR_WARNING "safe_remove: path does not exist: ${path}\n" - fi + for path in "$@" ; do + if [ -e "${path}" -o -L "${path}" ]; then + rm -r "${path}" + elif [ -n "${PKG_NAME}" ]; then + print_color CLR_WARNING "safe_remove: path does not exist: [${PKG_NAME}]: ${path}\n" + else + print_color CLR_WARNING "safe_remove: path does not exist: ${path}\n" + fi + done } ### BUILDSYSTEM HELPERS ###