powerpc/boot: Fix dash warning
Madhavan Srinivasan
maintainerPATCH v2 1/1 powerpc/boot: Fix dash warning
Commit b2accfe7ca5b '("powerpc/boot: Check for ld-option support")' suppressed linker warnings, but the expressed used did not go well with POSIX shell (dash) resulting with this warning
arch/powerpc/boot/wrapper: 237: [: 0: unexpected operator
ld: warning: arch/powerpc/boot/zImage.epapr has a LOAD segment with RWX permissions
Fix the check to handle the reported warning. Patch also fixes couple of shellcheck reported errors for the same line.
In arch/powerpc/boot/wrapper line 237:
if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then
^-- SC2046 (warning): Quote this to prevent word splitting.
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^---------^ SC3020 (warning): In POSIX sh, &> is undefined.
---
Changelog v1:
- modified the check to use the command exit
state instead explicit checking with exit code
Patch applies on top of powerpc/fixes
arch/powerpc/boot/wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/boot/wrapper +1 -1
@@ -234,7 +234,7 @@ fi # suppress some warnings in recent ld versions nowarn="-z noexecstack" -if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then +if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then nowarn="$nowarn --no-warn-rwx-segments" fi
Signature · 1 line
2.49.0
Hi Madhavan,
Quoted 36 lines · On Wed, 23 Apr 2025 13:51:54 +0530 Madhavan Srinivasan <[email protected]>…
Commit
b2accfe7ca5b'("powerpc/boot: Check for ld-option support")' suppressed linker warnings, but the expressed used did not go well with POSIX shell (dash) resulting with this warning
arch/powerpc/boot/wrapper: 237: [: 0: unexpected operator
ld: warning:arch/powerpc/boot/zImage.epaprhas a LOAD segment with RWX permissionsFix the check to handle the reported warning. Patch also fixes couple of shellcheck reported errors for the same line.
In
arch/powerpc/boot/wrapperline 237:
if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then
^-- SC2046 (warning): Quote this to prevent word splitting.
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^---------^ SC3020 (warning): In POSIX sh, &> is undefined.Fixes b2accfe7ca5b '("powerpc/boot: Check for ld-option support")'Reported-by Stephen Rothwell <[email protected]>Suggested-by Stephen Rothwell <[email protected]>Signed-off-by Madhavan Srinivasan <[email protected]>---
Changelog v1:
- modified the check to use the command exit
state instead explicit checking with exit codePatch applies on top of powerpc/fixes
arch/powerpc/boot/wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/boot/wrapper +0
-0
arch/powerpc/boot/wrapper fi · line 239
Quoted 7 lines
arch/powerpc/boot/wrapper +1
-1@@ -234,7 +234,7 @@ fi # suppress some warnings in recent ld versions nowarn="-z noexecstack" -if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then +if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then nowarn="$nowarn --no-warn-rwx-segments" fi
Looks good to me.
Signature · 2 lines
Cheers, Stephen Rothwell
Venkat Rao Bagalkote
Tested-byQuoted 47 lines · Stephen Rothwell
Hi Madhavan,
Quoted 35 lines · On Wed, 23 Apr 2025 13:51:54 +0530 Madhavan Srinivasan <[email protected]>…
Commit
b2accfe7ca5b'("powerpc/boot: Check for ld-option support")' suppressed linker warnings, but the expressed used did not go well with POSIX shell (dash) resulting with this warning
arch/powerpc/boot/wrapper: 237: [: 0: unexpected operator
ld: warning:arch/powerpc/boot/zImage.epaprhas a LOAD segment with RWX permissionsFix the check to handle the reported warning. Patch also fixes couple of shellcheck reported errors for the same line.
In
arch/powerpc/boot/wrapperline 237:
if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then
^-- SC2046 (warning): Quote this to prevent word splitting.
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^---------^ SC3020 (warning): In POSIX sh, &> is undefined.Fixes b2accfe7ca5b '("powerpc/boot: Check for ld-option support")'Reported-by Stephen Rothwell <[email protected]>Suggested-by Stephen Rothwell <[email protected]>Signed-off-by Madhavan Srinivasan <[email protected]>---
Changelog v1:
- modified the check to use the command exit
state instead explicit checking with exit codePatch applies on top of powerpc/fixes
arch/powerpc/boot/wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/boot/wrapper +0
-0arch/powerpc/boot/wrapper fi · line 239
Quoted 7 lines
arch/powerpc/boot/wrapper +1
-1@@ -234,7 +234,7 @@ fi # suppress some warnings in recent ld versions nowarn="-z noexecstack" -if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then +if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then nowarn="$nowarn --no-warn-rwx-segments" fiLooks good to me.
Quoted 2 lines
Reviewed-by Stephen Rothwell <[email protected]>
Tested this patch by applying on base: b2accfe7ca5bc9f9af28e603b79bdd5ad8df5c0b and it fixes the issue. Hence,
Regards,
Venkat.
Hi Madhavan,
Quoted 36 lines · On Wed, 23 Apr 2025 13:51:54 +0530 Madhavan Srinivasan <[email protected]>…
Commit
b2accfe7ca5b'("powerpc/boot: Check for ld-option support")' suppressed linker warnings, but the expressed used did not go well with POSIX shell (dash) resulting with this warning
arch/powerpc/boot/wrapper: 237: [: 0: unexpected operator
ld: warning:arch/powerpc/boot/zImage.epaprhas a LOAD segment with RWX permissionsFix the check to handle the reported warning. Patch also fixes couple of shellcheck reported errors for the same line.
In
arch/powerpc/boot/wrapperline 237:
if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then
^-- SC2046 (warning): Quote this to prevent word splitting.
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^---------^ SC3020 (warning): In POSIX sh, &> is undefined.Fixes b2accfe7ca5b '("powerpc/boot: Check for ld-option support")'Reported-by Stephen Rothwell <[email protected]>Suggested-by Stephen Rothwell <[email protected]>Signed-off-by Madhavan Srinivasan <[email protected]>---
Changelog v1:
- modified the check to use the command exit
state instead explicit checking with exit codePatch applies on top of powerpc/fixes
arch/powerpc/boot/wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/boot/wrapper +0
-0
arch/powerpc/boot/wrapper fi · line 240
Quoted 8 lines
arch/powerpc/boot/wrapper +1
-1@@ -234,7 +234,7 @@ fi # suppress some warnings in recent ld versions nowarn="-z noexecstack" -if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then +if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then nowarn="$nowarn --no-warn-rwx-segments" fi
I have applied this to linux-next today and will keep doing so until it (or a replacement) is added to the powerpc-fixes tree.
Signature · 2 lines
Cheers, Stephen Rothwell