Subject: Bug#1002944: build-rdeps: Shows unfriendly errors when deb-src lines are missing

From: Matthijs Kooijman <[email-masked]>
Date: Sat, 01 Jan 2022 17:33:59 +0100

Package: devscripts
Version: 2.21.7
Severity: normal

Hi,

when running build-rdeps without deb-src lines in sources.list, it
produces perl errors, rather than providing useful feedback. This also
happens when a deb-src line is present for the main packages, but
missing for debug packages.

E.g. with these sources:

  deb http://ftp.nl.debian.org/debian/ sid main non-free contrib
  deb http://deb.debian.org/debian-debug/ unstable-debug main

I get:

  $ sudo build-rdeps -d dh-cmake --distribution sid
  DEBUG: Package => dh-cmake
  DEBUG: running with dose-ceve resolver
  DEBUG: buildarch=amd64 hostarch=amd64
  DEBUG: Running 'apt-get' 'indextargets' 'DefaultEnabled: yes' 'Origin: Debian'
  Reverse Build-depends in main:
  ------------------------------

  Use of uninitialized value $source_file in concatenation (.) or string at /usr/bin/build-rdeps line 336.
  DEBUG: executing: dose-ceve -T debsrc -r dh-cmake -G pkg --deb-native-arch=amd64 deb:///var/lib/apt/lists/deb.debian.org_debian-debug_dists_unstable-debug_main_binary-amd64_Packages debsrc://Fatal error in module dose_common.input: 
   Input file  does not exist.
  No reverse build-depends found for dh-cmake.

  Reverse Build-depends in main:
  ------------------------------

  Use of uninitialized value $source_file in concatenation (.) or string at /usr/bin/build-rdeps line 336.
  DEBUG: executing: dose-ceve -T debsrc -r dh-cmake -G pkg --deb-native-arch=amd64 deb:///var/lib/apt/lists/ftp.nl.debian.org_debian_dists_sid_main_binary-amd64_Packages debsrc://Fatal error in module dose_common.input: 
   Input file  does not exist.
  No reverse build-depends found for dh-cmake.

  Reverse Build-depends in contrib:
  ------------------------------

  Use of uninitialized value $source_file in concatenation (.) or string at /usr/bin/build-rdeps line 336.
  DEBUG: executing: dose-ceve -T debsrc -r dh-cmake -G pkg --deb-native-arch=amd64 deb:///var/lib/apt/lists/ftp.nl.debian.org_debian_dists_sid_contrib_binary-amd64_Packages debsrc://Fatal error in module dose_common.input: 
   Input file  does not exist.
  No reverse build-depends found for dh-cmake.

  Reverse Build-depends in non-free:
  ------------------------------

  Use of uninitialized value $source_file in concatenation (.) or string at /usr/bin/build-rdeps line 336.
  DEBUG: executing: dose-ceve -T debsrc -r dh-cmake -G pkg --deb-native-arch=amd64 deb:///var/lib/apt/lists/ftp.nl.debian.org_debian_dists_sid_non-free_binary-amd64_Packages debsrc://Fatal error in module dose_common.input: 
   Input file  does not exist.
  No reverse build-depends found for dh-cmake.

Looking at the source, it seems that collectfiles() looks at Sources files, but
also Packages to find the arch. So for dists without a deb-src line, this lets
collectfiles() return entries that have an `Architecture` field, but no
`sources` field,

This is probably easy to fix by just letting findreversebuilddeps() check for
missing `sources` and showing an appropriate message.

Gr.

Matthijs

-- Package-specific info:

--- /etc/devscripts.conf ---
Empty.

--- ~/.devscripts ---
Not present

-- System Information:
Debian Release: 11.0
  APT prefers impish-updates
  APT policy: (500, 'impish-updates'), (500, 'impish-security'), (500, 'impish'), (100, 'impish-backports'), (50, 'testing-debug'), (50, 'stable-security'), (50, 'stable-debug'), (50, 'unstable'), (50, 'testing'), (50, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.13.0-22-generic (SMP w/4 CPU threads)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages devscripts depends on:
ii  dpkg-dev              1.20.9ubuntu2
ii  fakeroot              1.25.3-1.1ubuntu2
ii  file                  1:5.39-3
ii  gnupg                 2.2.20-1ubuntu4
ii  gnupg2                2.2.20-1ubuntu4
ii  gpgv                  2.2.20-1ubuntu4
ii  libc6                 2.34-0ubuntu3
ii  libfile-dirlist-perl  0.05-2
ii  libfile-homedir-perl  1.006-1
ii  libfile-touch-perl    0.11-1
ii  libfile-which-perl    1.23-1
ii  libipc-run-perl       20200505.0-1
ii  libmoo-perl           2.004004-1
ii  libwww-perl           6.53-1
ii  patchutils            0.4.2-1
ii  perl                  5.32.1-3ubuntu3
ii  python3               3.9.4-1build1
ii  sensible-utils        0.0.14
ii  wdiff                 1.2.2-2build2

Versions of packages devscripts recommends:
ii  apt                         2.3.9
ii  curl                        7.74.0-1.3ubuntu2
ii  dctrl-tools                 2.24-3
ii  debian-keyring              2021.09.25
ii  dput                        1.1.0ubuntu2
ii  dupload                     2.9.6
ii  equivs                      2.3.1
ii  libdistro-info-perl         1.0
ii  libdpkg-perl                1.20.9ubuntu2
ii  libencode-locale-perl       1.05-1.1
ii  libgit-wrapper-perl         0.048-1
ii  libgitlab-api-v4-perl       0.26-1
ii  liblist-compare-perl        0.55-1
ii  liblwp-protocol-https-perl  6.10-1
ii  libsoap-lite-perl           1.27-1
ii  libstring-shellquote-perl   1.04-1
ii  libtry-tiny-perl            0.30-1
ii  liburi-perl                 5.08-1
ii  licensecheck                3.1.1-2
ii  lintian                     2.114.0
ii  man-db                      2.9.4-2
ii  patch                       2.7.6-7
ii  pristine-tar                1.49
ii  python3-apt                 2.2.1
ii  python3-debian              0.1.39ubuntu1
ii  python3-magic               2:0.4.20-3
ii  python3-requests            2.25.1+dfsg-2
ii  python3-unidiff             0.5.5-2
ii  python3-xdg                 0.27-2
ii  strace                      5.13-0ubuntu1
ii  unzip                       6.0-26ubuntu1
ii  wget                        1.21-1ubuntu3
ii  xz-utils                    5.2.5-2

Versions of packages devscripts suggests:
pn  adequate                                  <none>
pn  at                                        <none>
pn  autopkgtest                               <none>
pn  bls-standalone                            <none>
pn  bsd-mailx | mailx                         <none>
ii  build-essential                           12.9ubuntu2
pn  check-all-the-things                      <none>
pn  cvs-buildpackage                          <none>
ii  debhelper                                 13.5.2ubuntu1~bpo20.04.1
ii  diffoscope                                180
pn  disorderfs                                <none>
ii  dose-extra                                6.0.1-2
pn  duck                                      <none>
pn  elpa-devscripts                           <none>
pn  faketime                                  <none>
pn  gnuplot                                   <none>
pn  how-can-i-help                            <none>
ii  libauthen-sasl-perl                       2.1600-1.1
pn  libdbd-pg-perl                            <none>
ii  libfile-desktopentry-perl                 0.22-2
pn  libnet-smtps-perl                         <none>
pn  libterm-size-perl                         <none>
ii  libtimedate-perl                          2.3300-2
pn  libyaml-syck-perl                         <none>
pn  mmdebstrap                                <none>
pn  mozilla-devscripts                        <none>
pn  mutt                                      <none>
ii  openssh-client [ssh-client]               1:8.4p1-6ubuntu2
pn  piuparts                                  <none>
ii  postgresql-client-11 [postgresql-client]  11.7-0ubuntu0.19.10.1
pn  pristine-lfs                              <none>
ii  quilt                                     0.66-2.1
pn  ratt                                      <none>
pn  reprotest                                 <none>
pn  svn-buildpackage                          <none>
ii  w3m                                       0.5.3+git20210102-6build1

-- no debconf information