diff mbox series

kernel-shark: Add quotes around $XDG_SESSION_TYPE in kshark-su-record

Message ID 20190722113707.156a099f@gandalf.local.home (mailing list archive)
State Accepted
Commit 00034f92c6df10876082e387347911817baeb69f
Headers show
Series kernel-shark: Add quotes around $XDG_SESSION_TYPE in kshark-su-record | expand

Commit Message

Steven Rostedt July 22, 2019, 3:37 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

If XDG_SESSION_TYPE is not set, then $XDG_SESSION_TYPE will become nothing,
which means the test:

 if [ $XDG_SESSION_TYPE = "wayland" ];

turns into

 if [  = "wayland" ];

And will cause a shell error. Adding quotes around "$XDG_SESSION_TYPE"
changes an empty $XDG_SESSION_TYPE into:

 if [ "" = "wayland" ];

which the shell can understand.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204261
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel-shark/bin/kshark-su-record | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yordan Karadzhov July 23, 2019, 8:02 a.m. UTC | #1
On 22.07.19 г. 18:37 ч., Steven Rostedt wrote:
> 
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> If XDG_SESSION_TYPE is not set, then $XDG_SESSION_TYPE will become nothing,
> which means the test:
> 
>   if [ $XDG_SESSION_TYPE = "wayland" ];
> 
> turns into
> 
>   if [  = "wayland" ];
> 
> And will cause a shell error. Adding quotes around "$XDG_SESSION_TYPE"
> changes an empty $XDG_SESSION_TYPE into:
> 
>   if [ "" = "wayland" ];
> 
> which the shell can understand.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204261
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>   kernel-shark/bin/kshark-su-record | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel-shark/bin/kshark-su-record b/kernel-shark/bin/kshark-su-record
> index ee839a26..2477045f 100755
> --- a/kernel-shark/bin/kshark-su-record
> +++ b/kernel-shark/bin/kshark-su-record
> @@ -1,6 +1,6 @@
>   #!/bin/bash
>   
> -if [ $XDG_SESSION_TYPE = "wayland" ]
> +if [ "$XDG_SESSION_TYPE" = "wayland" ]
>   then
>       xhost +si:localuser:root &>/dev/null
>   fi
> 

Thanks!

Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
diff mbox series

Patch

diff --git a/kernel-shark/bin/kshark-su-record b/kernel-shark/bin/kshark-su-record
index ee839a26..2477045f 100755
--- a/kernel-shark/bin/kshark-su-record
+++ b/kernel-shark/bin/kshark-su-record
@@ -1,6 +1,6 @@ 
 #!/bin/bash
 
-if [ $XDG_SESSION_TYPE = "wayland" ]
+if [ "$XDG_SESSION_TYPE" = "wayland" ]
 then
     xhost +si:localuser:root &>/dev/null
 fi