Package: dpkg Version: 1.19.0.5 Severity: minor Hi,
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"). I have used the below to experiment/find the bug: """ use v5.20; use Dpkg::Version; my $v = Dpkg::Version->new("0"); my $v_or_fallback = $v || 'default'; my $v_dor_fallback = $v // 'default'; say "$v is valid" if $v->is_valid; if ($v) { say "$v is true"; } else { say "$v is false"; } say "\$v || 'default' = $v_or_fallback"; say "\$v // 'default' = $v_dor_fallback"; """ Result: """ 0 is valid 0 is false $v || 'default' = default $v // 'default' = 0 """ Thanks, ~Niels