linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/boot: Fix dash warning
@ 2025-04-22 11:30 Madhavan Srinivasan
  2025-04-22 13:08 ` Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Madhavan Srinivasan @ 2025-04-22 11:30 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: naveen, linuxppc-dev, Madhavan Srinivasan, Stephen Rothwell

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.

Fixes: b2accfe7ca5b '("powerpc/boot: Check for ld-option support")'
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Patch applies clean on top of powerpc/fixes branch

 arch/powerpc/boot/wrapper | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 267ca6d4d9b3..7dfd8e527253 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -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; echo $?)" -eq 0 ]; then
 	nowarn="$nowarn --no-warn-rwx-segments"
 fi
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/boot: Fix dash warning
  2025-04-22 11:30 [PATCH] powerpc/boot: Fix dash warning Madhavan Srinivasan
@ 2025-04-22 13:08 ` Stephen Rothwell
  2025-04-22 13:47   ` Madhavan Srinivasan
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2025-04-22 13:08 UTC (permalink / raw)
  To: Madhavan Srinivasan; +Cc: mpe, npiggin, christophe.leroy, naveen, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

Hi Madhavan,

On Tue, 22 Apr 2025 17:00:23 +0530 Madhavan Srinivasan <maddy@linux.ibm.com> wrote:
>
>  # 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; echo $?)" -eq 0 ]; then
>  	nowarn="$nowarn --no-warn-rwx-segments"
>  fi

On the way to bed, it occurred to me that the above "if" line can be
written as:

if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/boot: Fix dash warning
  2025-04-22 13:08 ` Stephen Rothwell
@ 2025-04-22 13:47   ` Madhavan Srinivasan
  0 siblings, 0 replies; 3+ messages in thread
From: Madhavan Srinivasan @ 2025-04-22 13:47 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: mpe, npiggin, christophe.leroy, naveen, linuxppc-dev



On 4/22/25 6:38 PM, Stephen Rothwell wrote:
> Hi Madhavan,
> 
> On Tue, 22 Apr 2025 17:00:23 +0530 Madhavan Srinivasan <maddy@linux.ibm.com> wrote:
>>
>>  # 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; echo $?)" -eq 0 ]; then
>>  	nowarn="$nowarn --no-warn-rwx-segments"
>>  fi
> 
> On the way to bed, it occurred to me that the above "if" line can be
> written as:
> 
> if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then

if command; then
  # Commands to execute if the command succeeds (exit status 0)
fi

Yeah nice, Will fix and send a v2

Maddy

> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-22 13:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22 11:30 [PATCH] powerpc/boot: Fix dash warning Madhavan Srinivasan
2025-04-22 13:08 ` Stephen Rothwell
2025-04-22 13:47   ` Madhavan Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).