Skip to content
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

Do not hide libzypp exceptions in Pkg::ResolvableProperties() #31

Merged
merged 2 commits into from
Sep 9, 2014

Conversation

lslezak
Copy link
Member

@lslezak lslezak commented Sep 9, 2014

See bnc#895418

  • it makes debugging more difficult, return nil and log details in that case
  • 3.1.18

…5418)

it makes debugging more difficult, return nil in that case

- 3.1.18
@jreidinger
Copy link
Member

LGTM

@mvidner
Copy link
Member

mvidner commented Sep 9, 2014

No.

@mvidner
Copy link
Member

mvidner commented Sep 9, 2014

I agree that silently swallowing exceptions with catch(...) {} must be fixed. But are you sure you want to change the return value too, at this stage? Before, the returned value would be an empty list, IIUC. There may well be a code path where we rely on ignoring a zypp exception and work with the empty list. Nil would break that.

Also, the fix is incomplete. ResolvablePropertiesEx calls Resolvable2YCPMap which still contains a black hole for exceptions.

@lslezak
Copy link
Member Author

lslezak commented Sep 9, 2014

Before, the returned value would be an empty list

Not really, the empty list was returned because the exception was raised at the first item, but it can happen later and in that case the returned list would be incomplete (containing just the already processed items).

And in that case debugging would be even more difficult, with empty list it's obvious that something went wrong, but incomplete list is really nasty...

There may well be a code path where we rely on ignoring a zypp exception and work with the empty list. Nil would break that.

No, actually nil could be already returned in the existing code, see https://github.com/yast/yast-pkg-bindings/blob/master/src/Resolvable_Properties.cc#L641.

I'm not sure if there is such code which relies on ignoring libzypp errors (I'm not aware of any case), the pkg-bindings convention is use nil as the error value. If it suddenly fails because of nil then IHMO it's better then hiding a problem and use a wrong result value.

Also, the fix is incomplete. ResolvablePropertiesEx calls Resolvable2YCPMap which still contains a black hole for exceptions

No, if an exception is raised there it will caught here as well.

@lslezak
Copy link
Member Author

lslezak commented Sep 9, 2014

In normal conditions nil should be never returned, only in some bad situations, like in the referenced bug where there is a broken product contained in the repository.

So yes, I'd like to change it even in this stage.

@mvidner
Copy link
Member

mvidner commented Sep 9, 2014

actually nil could be already returned in the existing code

OK, but that is only for kind == "language" which is an uncommon case I think. Anyway, your voice has more weight, I've just wanted to make sure you have considered the consequences carefully.

if an exception is raised there it will caught here as well.

I don't think so. This code eats it:

@lslezak
Copy link
Member Author

lslezak commented Sep 9, 2014

Oh, I overlooked that part, thanks!

@mvidner
Copy link
Member

mvidner commented Sep 9, 2014

LGTM.

@lslezak
Copy link
Member Author

lslezak commented Sep 9, 2014

Thanks for review!

lslezak added a commit that referenced this pull request Sep 9, 2014
Do not hide libzypp exceptions in Pkg::ResolvableProperties()
@lslezak lslezak merged commit 5862dac into master Sep 9, 2014
@lslezak lslezak deleted the exception_handling branch September 9, 2014 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants