From 419a3cac80c46dfd457c9672af979e7ac1a8a7f4 Mon Sep 17 00:00:00 2001 From: Andrey Kravchenko Date: Thu, 30 Oct 2025 00:08:20 +0300 Subject: [PATCH] Fix output errors and warnings to stderr in gbak utility --- src/burp/backup.epp | 6 +++--- src/burp/burp.cpp | 18 +++++++++--------- src/burp/mvol.cpp | 2 +- src/burp/restore.epp | 41 ++++++++++++++++++++--------------------- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/burp/backup.epp b/src/burp/backup.epp index 2cbb866d51d..056a6c32a84 100644 --- a/src/burp/backup.epp +++ b/src/burp/backup.epp @@ -1130,7 +1130,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id) if (!status_vector.isSuccess()) { BurpMaster master; - BURP_print(false, 81, field->fld_name); + BURP_print(true, 81, field->fld_name); // msg 81 error accessing blob field %s -- continuing BURP_print_status(false, &status_vector); #ifdef DEBUG @@ -1235,7 +1235,7 @@ void put_asciz( const att_type attribute, const TEXT* string) // We can't honor operating systems that allow longer file names. if (len >= MAX_FILE_NAME_SIZE) { - BURP_print(false, 343, SafeArg() << int(attribute) << "put_asciz()" << (MAX_FILE_NAME_SIZE - 1)); + BURP_print(true, 343, SafeArg() << int(attribute) << "put_asciz()" << (MAX_FILE_NAME_SIZE - 1)); // msg 343: text for attribute @1 is too large in @2, truncating to @3 bytes len = MAX_FILE_NAME_SIZE - 1; } @@ -1276,7 +1276,7 @@ void put_blob( burp_fld* field, ISC_QUAD& blob_id) if (!blob.open(DB, gds_trans, blob_id)) { BurpMaster master; - BURP_print(false, 81, field->fld_name); + BURP_print(true, 81, field->fld_name); // msg 81 error accessing blob field %s -- continuing BURP_print_status(false, &status_vector); return; diff --git a/src/burp/burp.cpp b/src/burp/burp.cpp index a8086d659fe..1c7a25ce57b 100644 --- a/src/burp/burp.cpp +++ b/src/burp/burp.cpp @@ -1795,19 +1795,19 @@ void BURP_print_status(bool err, const Firebird::IStatus* status_vector, USHORT SCHAR s[1024]; if (fb_interpret(s, sizeof(s), &vector)) { - BURP_msg_partial(err, 256); // msg 256: gbak: ERROR: - burp_output(err, "%s\n", s); + BURP_msg_partial(true, 256); // msg 256: gbak: ERROR: + burp_output(true, "%s\n", s); while (fb_interpret(s, sizeof(s), &vector)) { - BURP_msg_partial(err, 256); // msg 256: gbak: ERROR: - burp_output(err, " %s\n", s); + BURP_msg_partial(true, 256); // msg 256: gbak: ERROR: + burp_output(true, " %s\n", s); } } if (secondNumber) { - BURP_msg_partial(err, 169); // msg 169: gbak: + BURP_msg_partial(true, 169); // msg 169: gbak: BURP_msg_put(true, secondNumber, SafeArg()); } } @@ -1850,13 +1850,13 @@ void BURP_print_warning(const Firebird::IStatus* status, bool printErrorAsWarnin if (fb_interpret(s, sizeof(s), &vector)) { - BURP_msg_partial(false, 255); // msg 255: gbak: WARNING: - burp_output(false, "%s\n", s); + BURP_msg_partial(true, 255); // msg 255: gbak: WARNING: + burp_output(true, "%s\n", s); while (fb_interpret(s, sizeof(s), &vector)) { - BURP_msg_partial(false, 255); // msg 255: gbak: WARNING: - burp_output(false, " %s\n", s); + BURP_msg_partial(true, 255); // msg 255: gbak: WARNING: + burp_output(true, " %s\n", s); } } } diff --git a/src/burp/mvol.cpp b/src/burp/mvol.cpp index 33b9f191839..5c67c1f806c 100644 --- a/src/burp/mvol.cpp +++ b/src/burp/mvol.cpp @@ -1713,7 +1713,7 @@ static void put_asciz(SCHAR attribute, const TEXT* str) USHORT l = static_cast(strlen(str)); if (l > MAX_UCHAR) { - BURP_print(false, 343, SafeArg() << int(attribute) << "put_asciz()" << USHORT(MAX_UCHAR)); + BURP_print(true, 343, SafeArg() << int(attribute) << "put_asciz()" << USHORT(MAX_UCHAR)); // msg 343: text for attribute @1 is too large in @2, truncating to @3 bytes l = MAX_UCHAR; } diff --git a/src/burp/restore.epp b/src/burp/restore.epp index 1aecf4f1cb0..076c72e4146 100644 --- a/src/burp/restore.epp +++ b/src/burp/restore.epp @@ -317,7 +317,7 @@ void activateIndex(BurpGlobals* tdgbl, const QualifiedMetaString& indexName) if (fError) { - BURP_print(false, 173, indexName.toQuotedString().c_str()); + BURP_print(true, 173, indexName.toQuotedString().c_str()); BURP_print_status(false, &local_status_vector); tdgbl->flag_on_line = false; @@ -378,25 +378,25 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name) MODIFY IDX USING IDX.RDB$INDEX_INACTIVE = TRUE; END_MODIFY; - BURP_print(false, 240, indexName.toQuotedString().c_str()); + BURP_print(true, 240, indexName.toQuotedString().c_str()); // msg 240 Index \"%s\" failed to activate because: if (error_code == isc_no_dup) { - BURP_print(false, 241); + BURP_print(true, 241); // msg 241 The unique index has duplicate values or NULLs - BURP_print(false, 242); + BURP_print(true, 242); // msg 242 Delete or Update duplicate values or NULLs, and activate index with } else { - BURP_print(false, 244); + BURP_print(true, 244); // msg 244 Not enough disk space to create the sort file for an index - BURP_print(false, 245); + BURP_print(true, 245); // msg 245 Set the TMP environment variable to a directory on a filesystem that does have enough space, and activate index with } - BURP_print(false, 243, indexName.toQuotedString().c_str()); + BURP_print(true, 243, indexName.toQuotedString().c_str()); // msg 243 ALTER INDEX \"%s\" ACTIVE; } END_FOR @@ -765,7 +765,7 @@ void add_files(BurpGlobals* tdgbl, const char* file_name) COMMIT // existing ON_ERROR continues past error, beck ON_ERROR - BURP_print (false, 174); + BURP_print (true, 174); // msg 174 cannot commit files BURP_print_status (false, &tdgbl->status_vector); ROLLBACK; @@ -2116,7 +2116,7 @@ void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer) elements_written * field->fld_length, (*buffer) + data_at); if (status_vector->hasData()) { - BURP_print (false, 81, field->fld_name); + BURP_print (true, 81, field->fld_name); // msg 81 error accessing blob field %s -- continuing BURP_print_status (true, &status_vector); #ifdef DEBUG @@ -3143,9 +3143,9 @@ static void check_data_error(BurpGlobals* tdgbl, IStatus* status_vector, const b { if (tdgbl->gbl_sw_incremental) { - BURP_print(false, 138, relation->rel_name.toQuotedString().c_str()); + BURP_print(true, 138, relation->rel_name.toQuotedString().c_str()); // msg 138 validation error on field in relation %s - BURP_print_status (false, status_vector); + BURP_print_status(false, status_vector); } else BURP_error_redirect(status_vector, 47); @@ -3155,9 +3155,8 @@ static void check_data_error(BurpGlobals* tdgbl, IStatus* status_vector, const b { if (tdgbl->gbl_sw_incremental) { + BURP_print(true, 114, relation->rel_name.toQuotedString().c_str()); // msg 114 restore failed for record in relation %s - BURP_print(false, 114, relation->rel_name.toQuotedString().c_str()); - BURP_print_status(false, status_vector, 342); // isc_gbak_invalid_data } else @@ -3167,7 +3166,7 @@ static void check_data_error(BurpGlobals* tdgbl, IStatus* status_vector, const b { if (tdgbl->gbl_sw_incremental && isc_sqlcode(status_vector->getErrors()) != -902) { - BURP_print (false, 114, relation->rel_name.toQuotedString().c_str()); + BURP_print(true, 114, relation->rel_name.toQuotedString().c_str()); // msg 114 restore failed for record in relation %s BURP_print_status(false, status_vector); } @@ -3214,25 +3213,25 @@ static void commit_relation_data(BurpGlobals* tdgbl, burp_rel* relation) { IDX.RDB$INDEX_INACTIVE = TRUE; - BURP_print(false, 240, indexName.toQuotedString().c_str()); + BURP_print(true, 240, indexName.toQuotedString().c_str()); // msg 240 Index \"%s\" failed to activate because: if (error_code == isc_no_dup) { - BURP_print(false, 241); + BURP_print(true, 241); // msg 241 The unique index has duplicate values or NULLs - BURP_print(false, 242); + BURP_print(true, 242); // msg 242 Delete or Update duplicate values or NULLs, and activate index with } else { - BURP_print(false, 244); + BURP_print(true, 244); // msg 244 Not enough disk space to create the sort file for an index - BURP_print(false, 245); + BURP_print(true, 245); // msg 245 Set the TMP environment variable to a directory on a filesystem that does have enough space, and activate index with } - BURP_print(false, 243, indexName.toQuotedString().c_str()); + BURP_print(true, 243, indexName.toQuotedString().c_str()); // msg 243 ALTER INDEX \"%s\" ACTIVE } END_MODIFY @@ -3246,7 +3245,7 @@ static void commit_relation_data(BurpGlobals* tdgbl, burp_rel* relation) break; default: - BURP_print(false, 69, relation->rel_name.toQuotedString().c_str()); + BURP_print(true, 69, relation->rel_name.toQuotedString().c_str()); // msg 69 commit failed on relation %s BURP_print_status(false, &tdgbl->status_vector); ROLLBACK;