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#8793dyemanov merged 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 |
|
This is example of SQL which creates unrecoverable DB (because of dplicates in index which will appear at restore phase): Let's create this DB and make backup.
Doing that on 6.0.0.1803 vs 6.0.0.1850 shows unexpected difference between logs for |
|
Yes, I've already encountered a problem where warnings and errors aren't being output through services, because the But now I'm more inclined to redirect all service error output to standard output, something like: void Service::outputError(const char* text)
{
outputVerbose(text);
}@AlexPeshkoff, what do you think? Will that be enough? |
|
On 3/26/26 11:18, Andrey Kravchenko wrote:
*XaBbl4* left a comment (FirebirdSQL/firebird#8793)
<#8793?email_source=notifications&email_token=AA44OUMSMC4ILQ2MGCMXIA34STRUZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJTGI2TQNBZGQ4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4132584948>
Yes, I've already encountered a problem where warnings and errors
aren't being output through services, because the
|Service::outputError| procedure is essentially empty, with only
|fb_assert(False)|
I initially made a commit where service warnings are output to stdout.
But now I'm more inclined to redirect all service error output to
standard output, something like:
void Service::outputError(const char* text)
{
outputVerbose(text);
}
@AlexPeshkoff <https://github.com/AlexPeshkoff>, what do you think?
Will that be enough?
Yes, for restore - quite enough. Backup is worse - in data mode (.fbk
file goes to stdout) that lines will be anyway not shown.
Currently I see no simple way to solve an issue just redirecting
messages here and there. Something like adding second data pump from
services manager to client app of marking data blocks in stdout flow as
'data' and 'warning' should help. But both seem to cause services API
incompatibility.
|
… instead of stdout) related to services
|
i have a question about difference between gbak and fbsvcmgr logs. == vs == Result: 1.1) 2.1) 2.2) So, entire output for |
Yes, unfortunately, that's the case now. There's no trivial way to output errors to stderr via services, so they're redirected to standard output (as was the case previously). |
|
I'd say it's worth creating a ticket to extend the Services API to separate stdin/stdout/stderr/data streams. Maybe we could do it in v7. |

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.