New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gbak isn't returning exit code about errors when using service manager (-se) [CORE5520] #5789
Comments
Commented by: @AlexPeshkoff Works for me - may be it's windows specific issue? localhost bin # ./gbak -rep `pwd`/gbak.corr tmp -user sysdba -password masterkey -v -se 127.0.0.1/3050:service_mgr |
Commented by: Beto Neto (betoneto.tbo) Try to simulate with this backup: https://drive.google.com/drive/folders/0B-qEIYAtH5uPcW9OV3RzMTlPc28?usp=sharing |
Commented by: Hans Thielen (hansthielen) If you restore a database and deny access to the restore.log, you got the same behaviour, i.e.: e:\Dbs>"C:\Program Files\Firebird\Firebird_2_5\bin\GBAK" -REP -v -y Restore.log -user sysdba -pas masterkey WORK.GBK WORK.GDB -se service_mgr e:\Dbs>"C:\Program Files\Firebird\Firebird_2_5\bin\GBAK" -REP -v -y Restore.log -user sysdba -pas masterkey WORK.GBK WORK.GDB |
Commented by: @pavel-zotov > If you restore a database and deny access to the restore.log ... OFFTOP. IMO it is wrong way to assume that logs for storing STDOUT & STDERR results should be always avaliable. So, the first thing your script (.bat) should do is get ensurance that both logs can be: One may to do that by using following scratch:@echo off set logdir=c:\temp\gbak-results if exist %logdir%\nul (
) else ( echo Check access to directory and STDOUT and STDERR logs passed OK. @Rem -------------- here we can start gbak --------------------------- :finalAs of gbak results you may need redirect BOTH stdout and stderr to the same file.
|
Commented by: Hans Thielen (hansthielen) >> If you restore a database and deny access to the restore.log ... I just wanted to create a reproduceable error. > ...After backup/restore will finish, you can open this log and look there for string "gbak: ERROR:". Ahh, that was cool 1982... (maybe) |
Commented by: Beto Neto (betoneto.tbo) > I expect an exe to behave like this: +1 |
Commented by: @pavel-zotov Still can't understand: why priority of this ticket is "Critical" ? IMO workaround (check access rights for logs and parse them after gbak will finish) is not too hard to be implemented... |
Commented by: Hans Thielen (hansthielen) A "global" try catch is also not too hard to implement?! Maybe it is not a critical bug, I did not prioritize this ticket. Anyway I think it is critical to suggest workarounds to cover up the deficiency of the software instead of just fixing it. |
Modified by: @dyemanovpriority: Critical [ 2 ] => Major [ 3 ] |
Commented by: Beto Neto (betoneto.tbo) I think this maybe isn't critical, but is out of standars. I have created an updater for my application, as it primary step it executes an backup and restore of the database to garantee database consistence. I was assuming blindly that the gbak exit code was following the standards, "a utility must return an exit code different of zero when errors occurs". As a workaround I must now catch the syserr and everything printed on it will signal an "exit error code". I hope with this solution I do not have any new surprises, like "error messages printed in sysout". Please fix it. |
Submitted by: Beto Neto (betoneto.tbo)
Votes: 2
I'm trying to restore a corrupted backup file.
My shell script takes care about this process using the gbak, and analyzes the exit code from it.
Without using the "-se" option, everything goes ok!
This command will print "2".
But, when I run the restore with the service manager option it doesn't returns the error code:
This command will print "0"
The text was updated successfully, but these errors were encountered: