Debian Bug report logs - #14341
dpkg-genchanges files-to-be-present logic wrong

Package: dpkg; Maintainer for dpkg is Dpkg Developers <debian-dpkg@lists.debian.org>; Source for dpkg is src:dpkg (PTS, buildd, popcon).

Reported by: Mark Eichin <eichin@cygnus.com>

Date: Sun, 2 Nov 1997 23:33:00 UTC

Severity: normal

Merged with 20192

Done: Anthony Towns <ajt@master.debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>:
Bug#14341; Package dpkg-dev. (full text, mbox, link).


Acknowledgement sent to Mark Eichin <eichin@cygnus.com>:
New bug report received and forwarded. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Mark Eichin <eichin@cygnus.com>
To: submit@bugs.debian.org
Subject: dpkg-genchanges: is this logic wrong? [oops, mis-aimed the first time]
Date: 02 Nov 1997 18:25:16 -0500
Package: dpkg-dev
Version: 1.4.0.19

line 138:
	$i=$1; $p=$fi{"C$i Package"}; $a=$fi{"C$i Architecture"};
	if (!defined($p2f{$p})) {
	    if (!$archspecific || $a eq $substvar{'Arch'}) {
		&error("package $p in control file but not in files list");
	    }

Doing "dpkg-buildpackage -rsudo" on an i386 just runs dpkg-genchanges
with no arguments, and it tells me

dpkg-genchanges: error: package xserver-fbdev in control file but not in files list

xserver-fbdev has
	Package: xserver-fbdev
	Architecture: m68k

The &error is happening because $archspecific is not set at all, so is
false...  Perhaps that part of the test should be left out, or maybe
it should be &&?  Changing the || to && does fix the immediate problem
but I don't really understand the use of -B/-b as I've never needed
them, so I'm not sure how they'd apply here.  I'm uploading an X
release using dpkg-genchanges with that change, since it doesn't
affect *unpacking* the upload at all...



Information forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>:
Bug#14341; Package dpkg-dev. (full text, mbox, link).


Acknowledgement sent to Roman.Hodek@informatik.uni-erlangen.de:
Extra info received and forwarded to list. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>. (full text, mbox, link).


Message #10 received at 14341@bugs.debian.org (full text, mbox, reply):

From: Roman Hodek <rnhodek@immd2.informatik.uni-erlangen.de>
To: 14341@bugs.debian.org
Cc: mdorman@debian.org
Subject: Re: Bug#14341: dpkg-genchanges: is this logic wrong? [oops,mis-aimed the first time]
Date: Wed, 11 Feb 1998 16:31:00 +0100 (MET)
> line 138:
> 		  $i=$1; $p=$fi{"C$i Package"}; $a=$fi{"C$i Architecture"};
> 		  if (!defined($p2f{$p})) {
> 			  if (!$archspecific || $a eq $substvar{'Arch'}) {
> 				  &error("package $p in control file but not in files list");
> 			  }
> 
> Doing "dpkg-buildpackage -rsudo" on an i386 just runs dpkg-genchanges
> with no arguments, and it tells me
> 
> dpkg-genchanges: error: package xserver-fbdev in control file but not in files list
> 							
> xserver-fbdev has		  
> 		  Package: xserver-fbdev
> 		  Architecture: m68k
> 
> The &error is happening because $archspecific is not set at all, so is
> false...  Perhaps that part of the test should be left out, or maybe
> it should be &&?  Changing the || to && does fix the immediate problem
> but I don't really understand the use of -B/-b as I've never needed
> them, so I'm not sure how they'd apply here.  I'm uploading an X
> release using dpkg-genchanges with that change, since it doesn't
> affect *unpacking* the upload at all...

I've just encountered the same problem with my atari-fdisk package.
IMHO the condition for reporting an error is completely wrong. For my
part, I'd suggest something like

  if (file not present) {
    if ($a eq 'any' || ($a eq 'all && !$archspecific) ||
        grep( $_ eq $substvar{'Arch'}, split(/\s+/,$a))) {
      &error(...);
    }
  }

This implements the following strategy: A .deb file must be present if
on of the following is true:

 - The Arch: field in the control file is 'any', which means it
   can/should be built for any architecture.

 - The Arch: field is 'all' (.deb is common to all archs), except if the
   -B flag is used (that means to build only arch-dependent files and
   no Arch: all things)

 - The current build architecture ($substvar{'Arch'}) is a member of
   the list in the Arch: field. Note that Architecture: in the control
   file is defined to be a list of architectures the package can be
   built on, not only a single arch word.

Below is a real patch. Its integration is easy and somehow important,
because the bug makes it impossible to build source packages that contain
binary packages with Arch: != any on a machine not matching the one
after Arch:. Not to mention that Arch: lists are completely ignored by
dpkg-genchanges currently :-)

Another problem I've noticed: Current dpkg-genchanges uses the value
of the control file Arch: field for the .changes file directly, and
just changes 'any' to $substvar{'Arch'}. This does the wrong thing if
Arch: is a list. The patch fixes this, too.

Roman

------------------------------------------------------------------------------
--- dpkg-genchanges.orig	Sat Jan 10 01:31:08 1998
+++ dpkg-genchanges	Wed Feb 11 16:23:27 1998
@@ -137,7 +137,8 @@
 #print STDERR "P key >$_< value >$v<\n";
 	$i=$1; $p=$fi{"C$i Package"}; $a=$fi{"C$i Architecture"};
 	if (!defined($p2f{$p})) {
-	    if (!$archspecific || $a eq $substvar{'Arch'}) {
+	    if ($a eq 'any' || ($a eq 'all' && !$archspecific) ||
+	        grep($_ eq $substvar{'Arch'}, split(/\s+/, $a))) {
 		&error("package $p in control file but not in files list");
 	    }
 	} else {
@@ -153,8 +154,12 @@
 	    } elsif (s/^X[BS]*C[BS]*-//i) {
 		$f{$_}= $v;
 	    } elsif (m/^Architecture$/) {
-		$v= $arch if $v eq 'any';
-		push(@archvalues,$v) unless $archadded{$v}++;
+		if ($v eq 'any' || grep($_ eq $arch, split(/\s+/, $v))) {
+		    $v= $arch;
+		} else {
+		    $v= '';
+		}
+		push(@archvalues,$v) unless !$v || $archadded{$v}++;
 	    } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ ||
 		     m/^(Recommends|Suggests|Optional|Conflicts|Replaces)$/ ||
 		     m/^X[CS]+-/i) {


Information forwarded to debian-bugs-dist@lists.debian.org, Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>:
Bug#14341; Package dpkg-dev. (full text, mbox, link).


Acknowledgement sent to Roman.Hodek@informatik.uni-erlangen.de:
Extra info received and forwarded to list. Copy sent to Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>. (full text, mbox, link).


Message #15 received at 14341@bugs.debian.org (full text, mbox, reply):

From: Roman Hodek <rnhodek@immd2.informatik.uni-erlangen.de>
To: 14341@bugs.debian.org
Cc: mdorman@debian.org
Subject: Re: Bug#14341: dpkg-genchanges: is this logic wrong? [oops,mis-aimed the first time]
Date: Mon, 16 Feb 1998 11:39:06 +0100 (MET)
Sorry, my last patch contained a bug. It omitted 'all' from the
architecture list. Below is a modified patch without the problem.
(Forget the old patch and use this one :-)

Roman

------------------------------------------------------------------------------
--- dpkg-genchanges.orig	Sat Jan 10 01:31:08 1998
+++ dpkg-genchanges	Mon Feb 16 11:34:09 1998
@@ -137,7 +137,8 @@
 #print STDERR "P key >$_< value >$v<\n";
 	$i=$1; $p=$fi{"C$i Package"}; $a=$fi{"C$i Architecture"};
 	if (!defined($p2f{$p})) {
-	    if (!$archspecific || $a eq $substvar{'Arch'}) {
+	    if ($a eq 'any' || ($a eq 'all' && !$archspecific) ||
+	        grep($_ eq $substvar{'Arch'}, split(/\s+/, $a))) {
 		&error("package $p in control file but not in files list");
 	    }
 	} else {
@@ -153,8 +154,12 @@
 	    } elsif (s/^X[BS]*C[BS]*-//i) {
 		$f{$_}= $v;
 	    } elsif (m/^Architecture$/) {
-		$v= $arch if $v eq 'any';
-		push(@archvalues,$v) unless $archadded{$v}++;
+		if ($v eq 'any' || grep($_ eq $arch, split(/\s+/, $v))) {
+		    $v= $arch;
+		} elsif ($v ne 'all') {
+		    $v= '';
+		}
+		push(@archvalues,$v) unless !$v || $archadded{$v}++;
 	    } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ ||
 		     m/^(Recommends|Suggests|Optional|Conflicts|Replaces)$/ ||
 		     m/^X[CS]+-/i) {


Changed bug title. Request was from James Troup <james@nocrew.org> to control@bugs.debian.org. (full text, mbox, link).


Severity set to `fixed'. Request was from Adam Di Carlo <apharris@burrito.onshore.com> to control@bugs.debian.org. (full text, mbox, link).


Severity set to `normal'. Request was from Ian Jackson <ian@davenant.greenend.org.uk> to control@bugs.debian.org. (full text, mbox, link).


Changed bug title. Request was from Ian Jackson <ian@davenant.greenend.org.uk> to control@bugs.debian.org. (full text, mbox, link).


Merged 14341 20192. Request was from Ian Jackson <ian@davenant.greenend.org.uk> to control@bugs.debian.org. (full text, mbox, link).


Bug reassigned from package `dpkg-dev' to `dpkg-iwj'. Request was from Ben Collins <bcollins@debian.org> to control@bugs.debian.org. (full text, mbox, link).


Bug reassigned from package `dpkg-iwj' to `dpkg'. Request was from Anthony Towns <ajt@master.debian.org> to control@bugs.debian.org. (full text, mbox, link).


Bug closed, ack sent to submitter - they'd better know why ! Request was from Anthony Towns <ajt@master.debian.org> to control@bugs.debian.org. (full text, mbox, link).


Bug reassigned from package `dpkg' to `dpkg'. Request was from Anthony Towns <ajt@master.debian.org> to control@bugs.debian.org. (full text, mbox, link).


Bug reassigned from package `dpkg' to `dpkg'. Request was from Anthony Towns <ajt@master.debian.org> to control@bugs.debian.org. (full text, mbox, link).


Bug reassigned from package `dpkg' to `dpkg'. Request was from Anthony Towns <ajt@master.debian.org> to control@bugs.debian.org. (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 25 10:20:53 2024; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.