prepare-kernel.sh: expand tilde in --outpatch path parameter
PATCH 1/1 prepare-kernel.sh: expand tilde in --outpatch path parameter
Ensure shell expands tilde (~) in the --outpatch parameter path the same way as --linux and --dovetail parameters. This fixes "cd: can't cd to ~" errors when using home directory shortcuts in output path.
The issue occurred because the ~ character in paths was not expanded before directory operations.
$ ./scripts/prepare-kernel.sh \ --linux=~/xenomai/linux-dovetail \ --arch=arm64 \ --outpatch=~/xenomai.patch ./scripts/prepare-kernel.sh: 1: cd: can't cd to ~
--- scripts/prepare-kernel.sh | 1 + 1 file changed, 1 insertion(+)
scripts/prepare-kernel.sh +1 -0
@@ -139,6 +139,7 @@ while test $# -gt 0; do ;; --outpatch=*) output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'` + output_patch=`eval "echo $output_patch"` ;; --filterkvers=*) echo "$me: warning: --filterkvers= is deprecated and now a no-op" >&2
Signature · 1 line
2.34.1
Quoted 24 lines · Haiyang He
Ensure shell expands tilde (~) in the --outpatch parameter path the same way as --linux and --dovetail parameters. This fixes "cd: can't cd to ~" errors when using home directory shortcuts in output path.
The issue occurred because the ~ character in paths was not expanded before directory operations.
$ ./scripts/prepare-kernel.sh \ --linux=~/xenomai/linux-dovetail \ --arch=arm64 \ --outpatch=~/xenomai.patch ./scripts/prepare-kernel.sh: 1: cd: can't cd to ~Signed-off-by Haiyang He <[email protected]>--- scripts/prepare-kernel.sh | 1 + 1 file changed, 1 insertion(+)scripts/prepare-kernel.sh +0
-0
scripts/prepare-kernel.sh while test $# -gt 0; do · line 142
Quoted 4 lines
scripts/prepare-kernel.sh +1
-0@@ -139,6 +139,7 @@ while test $# -gt 0; do ;; --outpatch=*) output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'` + output_patch=`eval "echo $output_patch"`
Something like "realpath" should do it (instead of eval), no?
Btw: AFAIR command substitutions should be done with the $() syntax nowadays (instead of ``).
Quoted 5 lines
scripts/prepare-kernel.sh +0
-0;; --filterkvers=*) echo "$me: warning: --filterkvers= is deprecated and now a no-op" >&2Signature · 1 line
2.34.1
Quoted 32 lines · Florian Bezdeka
Quoted 24 lines · Haiyang He
Ensure shell expands tilde (~) in the --outpatch parameter path the same way as --linux and --dovetail parameters. This fixes "cd: can't cd to ~" errors when using home directory shortcuts in output path.
The issue occurred because the ~ character in paths was not expanded before directory operations.
$ ./scripts/prepare-kernel.sh \ --linux=~/xenomai/linux-dovetail \ --arch=arm64 \ --outpatch=~/xenomai.patch ./scripts/prepare-kernel.sh: 1: cd: can't cd to ~Signed-off-by Haiyang He <[email protected]>--- scripts/prepare-kernel.sh | 1 + 1 file changed, 1 insertion(+)scripts/prepare-kernel.sh +0
-0scripts/prepare-kernel.sh while test $# -gt 0; do · line 142
Quoted 4 lines
scripts/prepare-kernel.sh +1
-0@@ -139,6 +139,7 @@ while test $# -gt 0; do ;; --outpatch=*) output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'` + output_patch=`eval "echo $output_patch"`Something like "realpath" should do it (instead of eval), no?
Quoted 3 lines
Btw: AFAIR command substitutions should be done with the $() syntax nowadays (instead of ``).
Make sense, and this works:
output_patch=$(eval "realpath $output_patch")
I will resend patch v2.
Quoted 6 lines
Quoted 5 lines
scripts/prepare-kernel.sh +0
-0;; --filterkvers=*) echo "$me: warning: --filterkvers= is deprecated and now a no-op" >&2Signature · 1 line
2.34.1
Jan Kiszka
AppliedQuoted 24 lines · Haiyang He
Ensure shell expands tilde (~) in the --outpatch parameter path the same way as --linux and --dovetail parameters. This fixes "cd: can't cd to ~" errors when using home directory shortcuts in output path.
The issue occurred because the ~ character in paths was not expanded before directory operations.
$ ./scripts/prepare-kernel.sh \ --linux=~/xenomai/linux-dovetail \ --arch=arm64 \ --outpatch=~/xenomai.patch ./scripts/prepare-kernel.sh: 1: cd: can't cd to ~Signed-off-by Haiyang He <[email protected]>--- scripts/prepare-kernel.sh | 1 + 1 file changed, 1 insertion(+)scripts/prepare-kernel.sh +0
-0
scripts/prepare-kernel.sh while test $# -gt 0; do · line 145
Quoted 7 lines
scripts/prepare-kernel.sh +1
-0@@ -139,6 +139,7 @@ while test $# -gt 0; do ;; --outpatch=*) output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'` + output_patch=`eval "echo $output_patch"` ;; --filterkvers=*) echo "$me: warning: --filterkvers= is deprecated and now a no-op" >&2
Thanks, applied.
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center