Linux NFS development
 help / color / mirror / Atom feed
* [PATCH nfs-utils] start-statd: Fix shellcheck warnings
@ 2023-07-09  7:20 Salvatore Bonaccorso
  2023-07-17 21:49 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Salvatore Bonaccorso @ 2023-07-09  7:20 UTC (permalink / raw)
  To: NeilBrown, Steve Dickson; +Cc: linux-nfs, Ben Hutchings, Salvatore Bonaccorso

From: Ben Hutchings <benh@debian.org>

shellcheck currently complains:

In utils/statd/start-statd line 14:
       [ 1`cat /run/rpc.statd.pid` -gt 1 ] &&
          ^----------------------^ SC2046 (warning): Quote this to prevent word splitting.
          ^----------------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean:
       [ 1$(cat /run/rpc.statd.pid) -gt 1 ] &&

In utils/statd/start-statd line 15:
       kill -0 `cat /run/rpc.statd.pid` > /dev/null 2>&1
               ^----------------------^ SC2046 (warning): Quote this to prevent word splitting.
               ^----------------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean:
       kill -0 $(cat /run/rpc.statd.pid) > /dev/null 2>&1

Use quotes and $() as recommended.

Signed-off-by: Ben Hutchings <benh@debian.org>
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
---
 utils/statd/start-statd | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index 2baf73c385cf..b11a7d91a7f6 100755
--- a/utils/statd/start-statd
+++ b/utils/statd/start-statd
@@ -11,8 +11,8 @@ exec 9> /run/rpc.statd.lock
 flock -e 9
 
 if [ -s /run/rpc.statd.pid ] &&
-       [ 1`cat /run/rpc.statd.pid` -gt 1 ] &&
-       kill -0 `cat /run/rpc.statd.pid` > /dev/null 2>&1
+       [ "1$(cat /run/rpc.statd.pid)" -gt 1 ] &&
+       kill -0 "$(cat /run/rpc.statd.pid)" > /dev/null 2>&1
 then
     # statd already running - must have been slow to respond.
     exit 0
-- 
2.40.1


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

* Re: [PATCH nfs-utils] start-statd: Fix shellcheck warnings
  2023-07-09  7:20 [PATCH nfs-utils] start-statd: Fix shellcheck warnings Salvatore Bonaccorso
@ 2023-07-17 21:49 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2023-07-17 21:49 UTC (permalink / raw)
  To: Salvatore Bonaccorso, NeilBrown; +Cc: linux-nfs, Ben Hutchings



On 7/9/23 3:20 AM, Salvatore Bonaccorso wrote:
> From: Ben Hutchings <benh@debian.org>
> 
> shellcheck currently complains:
> 
> In utils/statd/start-statd line 14:
>         [ 1`cat /run/rpc.statd.pid` -gt 1 ] &&
>            ^----------------------^ SC2046 (warning): Quote this to prevent word splitting.
>            ^----------------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
> 
> Did you mean:
>         [ 1$(cat /run/rpc.statd.pid) -gt 1 ] &&
> 
> In utils/statd/start-statd line 15:
>         kill -0 `cat /run/rpc.statd.pid` > /dev/null 2>&1
>                 ^----------------------^ SC2046 (warning): Quote this to prevent word splitting.
>                 ^----------------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
> 
> Did you mean:
>         kill -0 $(cat /run/rpc.statd.pid) > /dev/null 2>&1
> 
> Use quotes and $() as recommended.
> 
> Signed-off-by: Ben Hutchings <benh@debian.org>
> Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
Committed (tag: nfs-utils-2-6-4-rc3)

steved.
> ---
>   utils/statd/start-statd | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/statd/start-statd b/utils/statd/start-statd
> index 2baf73c385cf..b11a7d91a7f6 100755
> --- a/utils/statd/start-statd
> +++ b/utils/statd/start-statd
> @@ -11,8 +11,8 @@ exec 9> /run/rpc.statd.lock
>   flock -e 9
>   
>   if [ -s /run/rpc.statd.pid ] &&
> -       [ 1`cat /run/rpc.statd.pid` -gt 1 ] &&
> -       kill -0 `cat /run/rpc.statd.pid` > /dev/null 2>&1
> +       [ "1$(cat /run/rpc.statd.pid)" -gt 1 ] &&
> +       kill -0 "$(cat /run/rpc.statd.pid)" > /dev/null 2>&1
>   then
>       # statd already running - must have been slow to respond.
>       exit 0


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

end of thread, other threads:[~2023-07-17 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-09  7:20 [PATCH nfs-utils] start-statd: Fix shellcheck warnings Salvatore Bonaccorso
2023-07-17 21:49 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox