Fix gbak output some errors and warnings to stderr instead of stdout#8793
Fix gbak output some errors and warnings to stderr instead of stdout#8793XaBbl4 wants to merge 3 commits intoFirebirdSQL:masterfrom
Conversation
|
Earlier the following approach was used - errors that may be recovered by gbak were going to stdout, fatal - to stderr. I can agree that putting recoverable errors into stderr makes sense. Bit why not all? Something like: in restore.epp is left in stdout but in backup.epp will go into stderr. I want to know what criteria was used to keep some messages in stdout. |
|
Initially, during the restore, I tried to capture only those errors that didn't bring the database online when the utility terminated. As I mentioned in the first message, I might have missed some places, as I couldn't reproduce every case; this is likely one of them. In the backup, I moved all BURP_print calls to the error stream, not seeing the logic for splitting the output. |
AlexPeshkoff
left a comment
There was a problem hiding this comment.
Andrey, may be I was not enough explicit. I suggest to:
-
Complete cleanup process in restore.epp. There is no need to reproduce all bugs - just find all BURP_print calls with false parameter. Regarding previous comments about about errors 171 & 343 - it's completely OK to sent output to stderr for both of them. Like all other invocations of BURP_error.
-
After cleanup finished - may be argument
errshould be removed from BURP_print() at all? For a few remaining calls in burp.cpp like
BURP_print(false, 91, FB_VERSION);
may be invite new function name?
All messages from these functions are now printed to standard error stream. BURP_print with output version has been replaced by BURP_message (same result). Calls BURP_error_redirect with NULL status argument replaces BURP_error with abort argument, because calling BURP_print_status only adds call overhead.
|
Certainly - it was a bug. Output direction for BURP_print and related BURP_print_status should certainly match. Looks like arrays are used not too often, and errors saving them to disk during restore are even more rare. According to old logic both of them were to go to stdout, according to new one - both to stderr. |
Changed this to one behavior |
Currently in standalone application mode when redirect to the standard stream, for example:
gbak ... > /path/to/stdout.logsome error and warning messages may be missed, which may cause inconvenience.
For example, during when restore we may see an error message:
but in order to find out which index remains inactive, we need to look at the entire log, and in it we can already find:
Although in the global community it is accepted to output all errors and warnings to stderr.
This patch fixes this bug. I tried to cover all the cases found, but may have missed something.
I believe
BURP_print_statusshould always output to stderr, regardless of whether theerrargument is set to true or not. Theerrargument is now only responsible for setting status in service mode. AlsoBURP_print_warningshould always output to stderr.