Package: devscripts
Version: 2.25.2
Severity: normal
X-Debbugs-Cc: stu...@debian.org

Dear Maintainer,

Debian has an unusual and often problematic corner case: a binary
package and a source package can have the same name but be completely
unrelated. As a result, any code that accepts both source and binary
package names as input needs extreme care.

debcheckout allows apt to guess whether the name given to it is a binary
package or a source package, and apt will guess differently depending on
the tool that is invoked:
- "apt-cache showsrc $pkg" will find all source packages and binary
  packages that match $pkg
- "apt-get source $pkg" will try a binary package first unless
  --only-source is specified.

If we try debcheckout with packages where there is both a binary and
source package with the same name then weird behaviour occurs. If I ask
for the package "ply" for instance, then debcheckout will find the
correct VCS URL and git clone it, but then fail to obtain the source of
the unrelated source package ply-probe (that ships the ply binary
package).

$ debcheckout --source=always ply
declared git repository at https://salsa.debian.org/jcfp/ply.git
git clone https://salsa.debian.org/jcfp/ply.git ply ...
Cloning into 'ply'...
remote: Enumerating objects: 1674, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 1674 (delta 13), reused 25 (delta 13), pack-reused 1649 (from 1)
Receiving objects: 100% (1674/1674), 535.37 KiB | 611.00 KiB/s, done.
Resolving deltas: 100% (1005/1005), done.
Reading package lists... Done
Picking 'ply-probe' as source package instead of 'ply'
E: Can not find version '3.11-7' of package 'ply'
E: Unable to find a source package for ply-probe
apt-get source failed

Curiously, the failure is the same if one uses the binary package name,
meaning that debcheckout has gone from binary package name to source
package name and then accidentally used the source package name in an
ambigious "binary or source" context:

$ debcheckout --source=always python3-ply
declared git repository at https://salsa.debian.org/jcfp/ply.git
git clone https://salsa.debian.org/jcfp/ply.git python3-ply ...
Cloning into 'python3-ply'...
remote: Enumerating objects: 1674, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 1674 (delta 13), reused 25 (delta 13), pack-reused 1649 (from 1)
Receiving objects: 100% (1674/1674), 535.37 KiB | 551.00 KiB/s, done.
Resolving deltas: 100% (1005/1005), done.
Reading package lists... Done
Picking 'ply-probe' as source package instead of 'ply'
E: Can not find version '3.11-7' of package 'ply'
E: Unable to find a source package for ply-probe
apt-get source failed

Given that debcheckout has figured out the correct source package name
by the time it tries to use apt-get source (contrary to the comments in
the code there), it could use --only-source to ensure that it picks the
right package.

regards
Stuart

Reply via email to