config: fix globing error for zsh

Message ID 20241026141809.10364-1-marocketbd@gmail.com
State Committed
Headers
Series config: fix globing error for zsh |

Commit Message

RocketDev Oct. 26, 2024, 2:18 p.m. UTC
  Zsh treat unmatched glob as error while bash treat that as the original
string. Substitute globing with find to solve.

    * config/profile.sh.in: Fix globing error for zsh

Signed-off-by: RocketDev <marocketbd@gmail.com>
---
 config/profile.sh.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Aaron Merey Oct. 29, 2024, 5:13 p.m. UTC | #1
On Sat, Oct 26, 2024 at 10:19 AM RocketDev <marocketbd@gmail.com> wrote:
>
> Zsh treat unmatched glob as error while bash treat that as the original
> string. Substitute globing with find to solve.
>
>     * config/profile.sh.in: Fix globing error for zsh
>
> Signed-off-by: RocketDev <marocketbd@gmail.com>
> ---
>  config/profile.sh.in | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/config/profile.sh.in b/config/profile.sh.in
> index 5e86f433..9f3e415a 100644
> --- a/config/profile.sh.in
> +++ b/config/profile.sh.in
> @@ -6,12 +6,12 @@
>
>  prefix="@prefix@"
>  if [ -z "$DEBUGINFOD_URLS" ]; then
> -    DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ' || :)
> +    DEBUGINFOD_URLS=$(find "@sysconfdir@/debuginfod" -name "*.urls" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ' ' || :)
>      [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS
>  fi
>
>  if [ -z "$DEBUGINFOD_IMA_CERT_PATH" ]; then
> -    DEBUGINFOD_IMA_CERT_PATH=$(cat /dev/null "@sysconfdir@/debuginfod"/*.certpath 2>/dev/null | tr '\n' ':' || :)
> +    DEBUGINFOD_IMA_CERT_PATH=$(find "@sysconfdir@/debuginfod" -name "*.certpath" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ':' || :)
>      [ -n "$DEBUGINFOD_IMA_CERT_PATH" ] && export DEBUGINFOD_IMA_CERT_PATH || unset DEBUGINFOD_IMA_CERT_PATH
>  fi
>  unset prefix
> --
> 2.47.0

Thanks, pushed as commit 00cb3efe36.

Aaron
  

Patch

diff --git a/config/profile.sh.in b/config/profile.sh.in
index 5e86f433..9f3e415a 100644
--- a/config/profile.sh.in
+++ b/config/profile.sh.in
@@ -6,12 +6,12 @@ 
 
 prefix="@prefix@"
 if [ -z "$DEBUGINFOD_URLS" ]; then
-    DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ' || :)
+    DEBUGINFOD_URLS=$(find "@sysconfdir@/debuginfod" -name "*.urls" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ' ' || :)
     [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS
 fi
 
 if [ -z "$DEBUGINFOD_IMA_CERT_PATH" ]; then
-    DEBUGINFOD_IMA_CERT_PATH=$(cat /dev/null "@sysconfdir@/debuginfod"/*.certpath 2>/dev/null | tr '\n' ':' || :)
+    DEBUGINFOD_IMA_CERT_PATH=$(find "@sysconfdir@/debuginfod" -name "*.certpath" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ':' || :)
     [ -n "$DEBUGINFOD_IMA_CERT_PATH" ] && export DEBUGINFOD_IMA_CERT_PATH || unset DEBUGINFOD_IMA_CERT_PATH
 fi
 unset prefix