diff mbox series

[ovs-dev,1/2] Fix pidfile_is_running when $cmd is not passed

Message ID 20220613185922.2700748-1-ihrachys@redhat.com
State Superseded, archived
Headers show
Series [ovs-dev,1/2] Fix pidfile_is_running when $cmd is not passed | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ihar Hrachyshka June 13, 2022, 6:59 p.m. UTC
[ -z $string ] needs double quotes to handle zero-length strings
properly.

Fixes: 09dc4866fd32 ("Handle re-used pids in pidfile_is_running")
Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
---
 utilities/ovn-ctl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

0-day Robot June 13, 2022, 7:31 p.m. UTC | #1
Bleep bloop.  Greetings Ihar Hrachyshka, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 137 characters long (recommended limit is 79)
#24 FILE: utilities/ovn-ctl:46:
    test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && pid_exists "$pid" && [ -z "$cmd" -o pid_comm_check "$cmd" "$pid" ]

Lines checked: 30, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Numan Siddique June 13, 2022, 8:59 p.m. UTC | #2
On Mon, Jun 13, 2022 at 3:00 PM Ihar Hrachyshka <ihrachys@redhat.com> wrote:
>
> [ -z $string ] needs double quotes to handle zero-length strings
> properly.
>
> Fixes: 09dc4866fd32 ("Handle re-used pids in pidfile_is_running")
> Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>

I still see the same issue with this patch.

If I remove ' >/dev/null 2>&1'  I see the below error

/usr/share/ovn/scripts/ovn-ctl restart_northd
ovn-northd is not running.
Exiting ovnnb_db (1045).
Exiting ovnsb_db (1061).
Starting ovsdb-nb.
Starting ovsdb-sb.
/usr/share/ovn/scripts/ovn-ctl: line 53: [: too many arguments
OVN Northbound DB is not running : /var/run/ovn/ovnnb_db.pid ... failed!


I think there is an issue when pidfile_is_running() is called passing
when the 2nd argument is not passed.

Numan

> ---
>  utilities/ovn-ctl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> index e2f05915b..46cbac4c2 100755
> --- a/utilities/ovn-ctl
> +++ b/utilities/ovn-ctl
> @@ -43,7 +43,7 @@ ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"
>  pidfile_is_running () {
>      pidfile=$1
>      cmd=$2
> -    test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && pid_exists "$pid" && [ -z $cmd -o pid_comm_check "$cmd" "$pid" ]
> +    test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && pid_exists "$pid" && [ -z "$cmd" -o pid_comm_check "$cmd" "$pid" ]
>  } >/dev/null 2>&1
>
>  stop_nb_ovsdb() {
> --
> 2.34.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index e2f05915b..46cbac4c2 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -43,7 +43,7 @@  ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"
 pidfile_is_running () {
     pidfile=$1
     cmd=$2
-    test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && pid_exists "$pid" && [ -z $cmd -o pid_comm_check "$cmd" "$pid" ]
+    test -e "$pidfile" && [ -s "$pidfile" ] && pid=`cat "$pidfile"` && pid_exists "$pid" && [ -z "$cmd" -o pid_comm_check "$cmd" "$pid" ]
 } >/dev/null 2>&1
 
 stop_nb_ovsdb() {