Control: severity -1 normal Hi!
On Fri, 2018-04-06 at 07:18:49 +0200, Niels Thykier wrote: > Package: dpkg > Version: 126.96.36.199 > Severity: minor > There are some examples in Dpkg::Version that (if followed) would > imply that the problem will reject the version number "0" despite it > being valid. > > Example: > """ > boolean evaluation > When the Dpkg::Version object is used in a boolean evaluation (for > example in "if ($v)" or "$v || 'default'") it returns its string > representation if the > version stored is valid ($v->is_valid()) and undef otherwise. > """ > > This gives "surprising" results for version 0, which has a string > value that is considered false. To improve the correctness of the > examples. I have come to the following alternative examples: > > -> "if (defined($v) and $v->is_valid())" > -> "$v // 'default'" > > Sadly, the "if"-case is no longer elegant but that is the best I could > come up with that worked if $v is possibly undef and still have it > work. However, it no longer serves as a good example for "boolean > evaluation" (but neither did the original if you want to support the > version "0"). As mentioned on IRC, the current behavior is just broken, and it was changed from the correct and expected one to fix a problem in dpkg-shlibdeps, instead of fixing it there and avoiding breaking Dpkg::Version users. I've fixed this now locally, while also making the code emit a warning so that users can notice the semantic change, it will be possible to do a targetted silencing of the warning, once the code has been verified or fixed. Thanks, Guillem