Bug#368066: [Buildd-tools-devel] Bug#368066: sbuild: version strings should be allowed to be "0"

Roger Leigh rleigh at whinlatter.ukfsn.org
Sat May 27 13:04:16 UTC 2006


tags 368066 + fixed-upstream pending
thanks

Santiago Vila <sanvila at unex.es> writes:

>> if (!defined $version || $version eq "")
>>
>> Would that be OK?
>
> I don't speak perl, but an undefined string seems to be already caught
> by the above check. I tried this simple script to see:
>
> #!/usr/bin/perl
> if ($version eq "") {
>   print "parse error\n";
> }
>
> so I think ($version eq "") does the job well enough for now.
>
> Maybe things would be different if sbuild invoked perl using -w,
> but if you go that route, there would be a lot more lines to change,
> not just this completely minor thing about 0 as a version string.

We are already using "use warnings" (see the top of the program), so
we do need to cope with undefined variables (I already fixed all the
warnings, so no further changes are needed).

I've committed the following patch to SVN, and I'll make a new release
shortly.


Regards,
Roger


Index: debian/changelog
===================================================================
--- debian/changelog	(revision 583)
+++ debian/changelog	(working copy)
@@ -3,6 +3,9 @@
   * sbuild:
     - fetch_source_files: Only print "apt-get update" invocation in debug
       mode.
+    - get_dpkg_status: Make sure $version is defined before checking its
+      value, to ensure the Debian version can have a value of 0.  Thanks
+      to Santiago Vila for this fix (Closes: #368066).
   * Update svn::ignore properties to ignore generated files.
 
  --
Index: sbuild
===================================================================
--- sbuild	(revision 582)
+++ sbuild	(working copy)
@@ -1724,7 +1724,7 @@
 					 $result{$pkg}->{'Version'} eq '=*=PROVIDED=*=');
 			next;
 		}
-		if (!$version) {
+		if (!defined $version || $version eq "") {
 			print PLOG "sbuild: parse error in $main::chroot_dir/var/lib/dpkg/status: ",
 					   "no Version: field for package $pkg\n";
 			next;

-- 
Roger Leigh
                Printing on GNU/Linux?  http://gutenprint.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20060527/028953d3/attachment.pgp


More information about the Buildd-tools-devel mailing list