-
-
Notifications
You must be signed in to change notification settings - Fork 743
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
more specific return code / rc / error codes of the borg process #6756
Comments
I'll update this list here with whatever we come up with:
If a wrapper is unaware of a specific return code, it must treat it like 2 ERROR and notify the user. An updated wrapper at least needs to implement a range check for the new error / warning / info ranges. |
I'll update this list with other related issues we find: |
I'd like to suggest an enhancement of error codes. We should at least reserve or define a broader range of codes that could be implemented in future versions, for example: 1-63: warning (1 meaning "general warning" as it is now) (128+N stays unchanged) If we don't want to implement more detailed return values yet, at least we would change rc 2 to 64. If we want, we could already define some sub-ranges, e.g. "network errors", "disk related", "quota related" and the like. |
No, rc 0 1 2 need to stay as is. There are enough free codes without changing these. @fantasya-pbem I've updated #6756 (comment) . |
hmm, if we only reserve space for warnings/errors, we only have 0 for success / information. not sure if that is a problem / limitation in practice. |
We could reserve the range from 128+64 onwards, maybe 200+ for possible success codes, if we ever have the need for this. Posix signals / real-time signals have max code 32 / 64. |
This proposal collects possible error/warning cases that can occur. Some may not be detectable or make no sense with the current implementation. Specific errors 3 unknown cli option Specific warnings 64 cannot combine cli options Comments welcome! |
For errors (fatal stuff that leads to immediate termination) we can deal rather easily with them: raise an Exception, let the exit handler deal with the exception. For warnings (stuff borg notices while processing, but does not immediately terminate), we could encounter multiple different warnings. How to deal with that? Collect them in a list? If |
Thanks for the heads-up! We mostly use 0, 1 and 2 at the moment, but the new ones are for sure interesting to provide better feedback in the UI. Tracking adjustments here: borgbase/vorta#1349 |
At first glance, this seems redundant to message ids. Pika is already making use of them. Therefore I don't see the use case yet. (I would like to add msg ids to a bunch of existing warnings though 😆) |
Use case is for the shell people that don't want to parse JSON. Thank you for the message ids link, I wasn't aware of that yet. We could associate some of those IDs to return codes. |
New errors and warnings tables, return codes and message IDs associated (best guess).
|
Is there some systematic in the Code (guess it means the return code, rc) column (except that >= 64 is a warning)? Where do the numbers seen there come from? |
Not yet. Now, after having integrated the message IDs, the codes have to be distributed more evenly. But first I want to check these IDs - are they all really errors that abort Borg or are some of them progress messages? Second, after we have found that the suggested groups make sense and we have defined all possible (and recognizable) error / warning conditions, we can distribute the return codes appropriately. |
I found that most message IDs are just raised errors, but at least |
It's not unusual to have different warnings like "File changed during borg create" or "File not found" during one Overall, I'm a bit scared of the shell script that will handle all of these errors. Since the number of exit codes is quite limited I don't really see that this concept scales. I would suggest writing down the use case more specifically to see how this could actually work. |
@fantasya-pbem are you still working on this? |
No, and nobody besides me seems to have interest, too. My "work" has been collecting possible error codes,the real work had to be done by developers of Borg. Feel free to close this issue. |
@fantasya-pbem Well, my impression was that there definitely is some interest (see also misc. other related tickets) and I was primarily waiting for you to finish your work, see #6756 (comment) . I guess I or someone else could then implement this, but having a good plan first is essential. In case we get some funds on the bountysource org account, there could be even one or two bounties. Personally I will be rather busy with #6987 for a while, so help here is appreciated! |
See #6756 (comment). Also: It seems that warning return codes are less useful as there is likely more than one condition to be represented. Error codes make more sense here I guess, maybe we could concentrate on errors first. Then, the next task would be to check the code where these errors can occur: Is there an exception thrown / is Borg aborted? If so, the respective error code could be returned directly. |
ERRORs are rather simple, WARNINGs more difficult / unclear yet how to best deal with. |
I think you have to walk through the relevant parts of the code base and specify the return code for a the different problems resulting in an error. Or is a their a way to easily map existing exceptions and message ids to return codes in one place? |
@real-yfprojects yes. it's not necessarily an exception, can be also just an |
Are there plans to have a own RC for the borg create message "file changed while we backed it up", which comes now up with RC1? |
@mai-schlau that is a warning (not: error) message and considering there might be multiple and different warnings (plus potentially even some real error), this is a more difficult case than the "real error" return codes and IIRC we did not discuss yet how to handle that. |
As we have multiple systems, which produce this "file changed while we backed it up" and which still have to be backuped it would be very helpful if these messages would produce a different RC than 1. But maybe, and this is only a simple suggestion, something like RC 1-1 for the "changed while" and a simple 1 for the rest would be an approach. Further RC1s like 'no such path' could also come up with RC 1-2 and maybe the list could be filled till 1-9. Especially the RC1-1 for the "file changed while we backed it up", would make the messages and our monitoring a lot clearer ... |
idea about how to deal with warningsAs there can be multiple warnings in a borg run, it is difficult to map all this information to a few bits in a 8bit return code. But what we could do is:
We could think about whether it makes sense to have the same rc for different kinds of similar warnings, so that the specific warning rc case in that computation is used more frequently than the fallback to rc 1 ("find it out yourself!") |
Couldn't see this being mentioned before: If any exit codes are added, I would strongly advice to not use exit codes that might appear independent of borg. Especially 128+n for signals like SEGFAULT. |
@sophie-h sure, only 3..127 will be used (and 0, 1, 2 when nothing more specific is known). |
PR #7928 is not quite finished, but guess some early review / feedback would be helpful! I did a PR against 1.2-maint, but guess that needs some good review and testing before we can decide whether it can go into 1.2.x releases - the change got a bit bigger than I thought... Update: I suspect that this has a slight potential to either break existing scripts or have some new bugs in the way errors and warnings are dealt with internally in borg - so maybe this is not suitable for a 1.2.x patch release which is expected to be rather stable and boring.
Thus, borg What do you think about that? |
Related: #7080 (msgid for file changed warning) |
Guess everybody was too busy to comment, so I just went ahead and put this into first borg 1.4.0 milestone. |
borg 1.4 fixed by PR #7976 - this definitely will need practical testing! |
borg2 / master branch now got all the changes forward-ported, too. |
Currently, borg has only a few, rather generic return codes: 0 ok, 1 warning, 2 error, >=128 for termination due to signals.
This could be improved (preferably with a breaking release) by moving some stuff to more specific codes. Everything that has no specific code assigned stays at the current code.
First task is to go through the issue tracker and link to all issues talking about (more specific) error codes from here.
Then it needs some planning: what makes sense, what does not, ...
When planning is finished and there is some consensus, implementation can follow.
The text was updated successfully, but these errors were encountered: