8000 [PBCKP-236] assert fix · postgrespro/pg_probackup@c526597 · GitHub
[go: up one dir, main page]

Skip to content

Commit c526597

Browse files
author
Ivan Lazarev
committed
[PBCKP-236] assert fix
1 parent 1ce38ed commit c526597

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/utils/remote.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ static char* extract_pg_edition_str()
295295
#define COMPATIBILITY_VAL_STR(macro) { #macro, macro, 0 }
296296
#define COMPATIBILITY_VAL_INT(macro) { #macro, NULL, macro }
297297

298+
#define COMPATIBILITY_VAL_SEPARATOR "="
299+
#define COMPATIBILITY_LINE_SEPARATOR "\n"
300+
298301
/*
299302
* Compose compatibility string to be sent by pg_probackup agent
300303
* through ssh and to be verified by pg_probackup peer.
@@ -303,7 +306,13 @@ static char* extract_pg_edition_str()
303306
*/
304307
size_t prepare_compatibility_str(char* compatibility_buf, size_t compatibility_buf_size)
305308
{
306-
struct { const char* name; const char* strval; int intval; } compatibility_params[] = {
309+
typedef struct compatibility_param_tag {
310+
const char* name;
311+
const char* strval;
312+
int intval;
313+
} compatibility_param;
314+
315+
compatibility_param compatibility_params[] = {
307316
COMPATIBILITY_VAL_STR(PG_MAJORVERSION),
308317
{ "edition", extract_pg_edition_str(), 0 },
309318
COMPATIBILITY_VAL_INT(SIZEOF_VOID_P),
@@ -312,16 +321,16 @@ size_t prepare_compatibility_str(char* compatibility_buf, size_t compatibility_b
312321
size_t result_size = 0;
313322
*compatibility_buf = '\0';
314323

315-
for (int i = 0; i < sizeof compatibility_params; i+=2)
324+
for (int i = 0; i < (sizeof compatibility_params / sizeof(compatibility_param)); i++)
316325
{
317326
if (compatibility_params[i].strval != NULL)
318327
result_size += snprintf(compatibility_buf + result_size, compatibility_buf_size - result_size,
319-
"%s=%s/n",
328+
"%s" COMPATIBILITY_VAL_SEPARATOR "%s" COMPATIBILITY_LINE_SEPARATOR,
320329
compatibility_params[i].name,
321330
compatibility_params[i].strval);
322331
else
323332
result_size += snprintf(compatibility_buf + result_size, compatibility_buf_size - result_size,
324-
"%s=%d/n",
333+
"%s" COMPATIBILITY_VAL_SEPARATOR "%d" COMPATIBILITY_LINE_SEPARATOR,
325334
compatibility_params[i].name,
326335
compatibility_params[i].intval);
327336
Assert(result_size < compatibility_buf_size);

tests/compatibility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def setUp(self):
1414
self.fname = self.id().split('.')[3]
1515

1616
# @unittest.expectedFailure
17-
# @unittest.skip("skip")
17+
@unittest.skip("skip")
1818
def test_catchup_with_different_remote_major_pg(self):
1919
"""
2020
Decription in jira issue PBCKP-236

0 commit comments

Comments
 (0)
0