linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/boot: Fix dash warning
@ 2025-04-23  8:21 Madhavan Srinivasan
  2025-04-23  8:53 ` Stephen Rothwell
  2025-04-23 22:40 ` Stephen Rothwell
  0 siblings, 2 replies; 4+ messages in thread
From: Madhavan Srinivasan @ 2025-04-23  8:21 UTC (permalink / raw)
  To: mpe, christophe.leroy
  Cc: npiggin, 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>
---
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(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 267ca6d4d9b3..3d8dc822282a 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; then
 	nowarn="$nowarn --no-warn-rwx-segments"
 fi
 
-- 
2.49.0



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

* Re: [PATCH v2] powerpc/boot: Fix dash warning
  2025-04-23  8:21 [PATCH v2] powerpc/boot: Fix dash warning Madhavan Srinivasan
@ 2025-04-23  8:53 ` Stephen Rothwell
  2025-04-23  9:38   ` Venkat Rao Bagalkote
  2025-04-23 22:40 ` Stephen Rothwell
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2025-04-23  8:53 UTC (permalink / raw)
  To: Madhavan Srinivasan; +Cc: mpe, christophe.leroy, npiggin, naveen, linuxppc-dev

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

Hi Madhavan,

On Wed, 23 Apr 2025 13:51:54 +0530 Madhavan Srinivasan <maddy@linux.ibm.com> wrote:
>
> 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>
> ---
> 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(-)
> 
> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
> index 267ca6d4d9b3..3d8dc822282a 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; then
>  	nowarn="$nowarn --no-warn-rwx-segments"
>  fi

Looks good to me.

Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au>

-- 
Cheers,
Stephen Rothwell

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

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

* Re: [PATCH v2] powerpc/boot: Fix dash warning
  2025-04-23  8:53 ` Stephen Rothwell
@ 2025-04-23  9:38   ` Venkat Rao Bagalkote
  0 siblings, 0 replies; 4+ messages in thread
From: Venkat Rao Bagalkote @ 2025-04-23  9:38 UTC (permalink / raw)
  To: linuxppc-dev


On 23/04/25 2:23 pm, Stephen Rothwell wrote:
> Hi Madhavan,
>
> On Wed, 23 Apr 2025 13:51:54 +0530 Madhavan Srinivasan <maddy@linux.ibm.com> wrote:
>> 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>
>> ---
>> 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(-)
>>
>> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
>> index 267ca6d4d9b3..3d8dc822282a 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; then
>>   	nowarn="$nowarn --no-warn-rwx-segments"
>>   fi
> Looks good to me.
>
> Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au>
>
Tested this patch by applying on base: 
b2accfe7ca5bc9f9af28e603b79bdd5ad8df5c0b and it fixes the issue. Hence,

Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>


Regards,

Venkat.



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

* Re: [PATCH v2] powerpc/boot: Fix dash warning
  2025-04-23  8:21 [PATCH v2] powerpc/boot: Fix dash warning Madhavan Srinivasan
  2025-04-23  8:53 ` Stephen Rothwell
@ 2025-04-23 22:40 ` Stephen Rothwell
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2025-04-23 22:40 UTC (permalink / raw)
  To: Madhavan Srinivasan; +Cc: mpe, christophe.leroy, npiggin, naveen, linuxppc-dev

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

Hi Madhavan,

On Wed, 23 Apr 2025 13:51:54 +0530 Madhavan Srinivasan <maddy@linux.ibm.com> wrote:
>
> 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>
> ---
> 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(-)
> 
> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
> index 267ca6d4d9b3..3d8dc822282a 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; 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.

-- 
Cheers,
Stephen Rothwell

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

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23  8:21 [PATCH v2] powerpc/boot: Fix dash warning Madhavan Srinivasan
2025-04-23  8:53 ` Stephen Rothwell
2025-04-23  9:38   ` Venkat Rao Bagalkote
2025-04-23 22:40 ` Stephen Rothwell

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).