[Logcheck-devel] Bug#408901: Bug#400112: [PROPOSAL] forbid source/binary package name conflicts

Roger Leigh rleigh at whinlatter.ukfsn.org
Sat Feb 3 22:21:58 UTC 2007


On Tue, Jan 23, 2007 at 01:57:19PM +0100, Lucas Nussbaum wrote:
> On 19/01/07 at 12:47 +0100, Goswin von Brederlow wrote:
> > Kurt Roeckx <kurt at roeckx.be> writes:
> > 
> > > On Thu, Jan 18, 2007 at 03:12:12PM +0100, Goswin von Brederlow wrote:
> > >> 
> > >> In the initial report you mentioned that sbuild has a problem with
> > >> confusing names like this. Afaik sbuild solely works on source package
> > >> name and version and that is always unique. Where do you get a
> > >> conflict?
> > >
> > > It uses apt-cache to check for available versions, which as you show
> > > gives both results. And sbuild's behaviour depends on the order
> > > apt-cache returns those.
> > 
> > Reading the source sbuild is prepared to parse multiple returns from
> > apt-cache just fine. But it ignores the package name and only uses the
> > version to keep them apart.
> > 
> > So a case that would screw up sbuild would have to look something like
> > this:
> > 
> > Package: foo
> > Binary: bar, foo
> > Version: 1.2-3
> > 
> > Package: bar
> > Binary: bar
> > Version: 1.2-3
> > 
> > Too bad apt-cache doesn't have a --only-source option. Sbuild has to
> > use package name and version.
> > 
> > Something like this (untested):
> > 
> > Line 424...
> > 
> >                           while( <PIPE> ) {
> > +                                 $package = $1 if /^Package:\s+(\S+)\s*$/mi;
> >                                   $ver = $1 if /^Version:\s+(\S+)\s*$/mi;
> >                                   $tfile = $1 if /^Files:\s*\n((\s+.*\s*\n)+)/mi;
> >                           }
> > -                          if (defined $ver && defined $tfile) {
> > +                          if (defined $package && defined $ver && defined $tfile) {
> > -                                  @{$entries{$ver}} = map { (split( /\s+/, $_ ))[3] }
> > +                                  @{$entries{"$package $ver"}} = map { (split( /\s+/, $_ ))[3] }
> >                                           split( "\n", $tfile );
> >                           } else {
> >                                   print PLOG "apt-cache returned no information about $pkg source\n";
> >                                   print PLOG "Are there any deb-src lines in your /etc/apt/sources.list?\n";
> >                                   return ("ERROR");
> >                           }
> >                   }
> >                         close( PIPE );
> >                         if ($?) {
> >                                 print PLOG "$conf::apt_cache failed\n";
> >                                 return ("ERROR");
> >                         }
> > 
> > -                        if (!defined($entries{$version})) {
> > +                        if (!defined($entries{"$pkg $version"})) {

I have attached a tested version of this patch which fixes a bug in the
while loop.  This applies to the current SVN version of sbuild:

  svn://svn.debian.org/svn/buildd-tools/trunk/sbuild

but will also apply to the testing/unstable version.

> > But I don't yet see a problem here. The apt-cache check is purely
> > informational. As long as it finds an entry with the right version it
> > is happy and the "apt-get --only-source source" below that will always
> > do the right thing. So the worst you get is that the "Can't find
> > source" message is skipped and apt-get fails.
> > 
> > Or not?
> 
> No, the problem is that sbuild only keeps the *last* version it sees
> (see the while (<PIPE>) loop above). Anyway, that part is clearly an sbuild
> problem. See that log, after asking sbuild to build qd 2.1.200-1:

> Build started at 20070103-0339
> ******************************************************************************
> Checking available source versions...
> Checking available source versions...
> Can't find source for qd_2.1.200-1
> (only different version(s) 1.0.0-rc2-5 found)

  % sbuild -s -A qd_2.1.200-1

works for me, but I can't build kfolding:

  % sbuild -s -A kfolding_1.0.0-rc2-5

  Automatic build of kfolding_1.0.0-rc2-5 on hardknott by sbuild/powerpc 0.52
  Build started at 20070203-2218
  ******************************************************************************
  Checking available source versions...
  apt-cache returned no information about kfolding source
  Are there any deb-src lines in your /etc/apt/sources.list?
  ******************************************************************************
  Finished at 20070203-2218
  Build needed 00:00:00, 0k disk space

This is without the above patch applied.  After applying the patch, I
get:

  Automatic build of kfolding_1.0.0-rc2-5 on hardknott by sbuild/powerpc 0.52
  Build started at 20070203-2219
  ******************************************************************************
  Checking available source versions...
  Checking available source versions...
  Can't find source for kfolding_1.0.0-rc2-5
  ******************************************************************************
  Finished at 20070203-2219
  Build needed 00:00:00, 0k disk space

This fixes the while loop problem, but I've not yet figured out what's
still failing.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sbuild-aptcache-parse.patch
Type: text/x-diff
Size: 1859 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/logcheck-devel/attachments/20070203/8f5573a5/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/logcheck-devel/attachments/20070203/8f5573a5/attachment.pgp 


More information about the Logcheck-devel mailing list