Skip to content

Commit

Permalink
[CBRD-24630] The stop command of cubrid hb (applylogdb/repl) does not…
Browse files Browse the repository at this point in the history
… work correctly when the build is generated in the QA environment, release mode and devtoolset-9 (#4092)

http://jira.cubrid.org/browse/CBRD-24630

Purpose

when the build is created in the QA env, release mode and devtoolset-9, the stop command of cubrid hb (applylogdb or replication) doesn't work correctly
the reason is not clear. But the problem is related to the strcmp function. The following code block is in the process_is_registered_proc(). And the if condition checks the response from cub_master in order to check the copylogdb or applylogdb is alive
if (size > 0 && strcmp (reply_buffer, HA_REQUEST_SUCCESS) == 0)
the problem is that the strcmp() returns a positive value even if values of arguments are equal
when I try to dump values of arguments as hexa, they have same values with null termination
when I try to compare them using memcmp(), strcmp()(again), they return 0
when I try to check the length of them using strlen(), they return 1 (it means values are terminated with null)
now, I don't have any options to handle this problem. But when I change the strcmp() to strncmp(), the problem is disapeared. So I apply this fix for the regression test temparaly(or permenantly if there are no solution)
Implementation

strcmp() -> strncmp()
Remarks

the problem is occurred after changing devtoolset-8 to devtoolset-9
  • Loading branch information
hornetmj authored Feb 8, 2023
1 parent ffb8a38 commit 0db1d7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/executables/commdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ process_is_registered_proc (CSS_CONN_ENTRY * conn, char *args)
rid = send_request_one_arg (conn, IS_REGISTERED_HA_PROC, (char *) buffer, len);
return_string (conn, rid, &reply_buffer, &size);

if (size > 0 && strcmp (reply_buffer, HA_REQUEST_SUCCESS) == 0)
if (size > 0 && strncmp (reply_buffer, HA_REQUEST_SUCCESS, size - 1) == 0)
{
error = NO_ERROR;
}
Expand Down

0 comments on commit 0db1d7d

Please sign in to comment.