[Pkg-rust-maintainers] Bug#995419: rust-utf-8: autopkgtest regression: crate directory not found: /usr/share/cargo/registry/utf-8-0.7.6

peter green plugwash at p10link.net
Thu Sep 30 23:07:52 BST 2021


> It passes when run with only packages from testing.

This is not entirely correct, the version of rust-utf-8 in testing
has no autopkgtests at all. So this is a case of a newly added
(by a newer version of debcargo) test failing, not a case of an
existing test regressing.

Investigating, it seems the reason for the failure is that
the crate is installed in the wrong place. It is installed
in /usr/share/cargo/registry/utf-0.7.6/ when it should be
installed in /usr/share/cargo/registry/utf-8-0.7.6/

The reason it's installed in the wrong place is that
dh-cargo by default determines the crate name from the
source package name, but source package names are ambiguous
"rust-utf-8" could mean a crate called "utf" with a major
version of 8 or it could (and actually does in this case)
mean a crate called utf-8.

dh-cargo allows a package to specify an explicit crate name
through X-Cargo-Crate in the source section of the control
file but debcargo seems to offer no way to set this other
than overriding the complete control file. There is no mention
of X-Cargo-Crate in the debcargo source and the mechanism
for adding arbitrary lines to the generated control file only
applies to binary package sections.

This also affects rust-md-5 and rust-sha-1, though neither
of those packages are currently in testing and rust-sha-1
has not had an upload since debcargo started doing
autopkgtests

I see a number of possible ways of solving the issue.

1. Just override the whole control file
    (debcargo rightly discourages this due to the maintenance
    burden it creates, but OTOH this issue only affects
    three crates)
2. Add support for adding arbitrary lines to the source
    section of debian/control in debcargo and use it to
    manually add X-Cargo-Crate
3. Modify dh-cargo to obtain the crate name from Cargo.toml
    instead of the package name.
    (would presumablly mean dragging in a perl toml parser
    which may not be desirable)
4. Modify debcargo to generate X-Cargo-Crate lines in
    cases where dh-cargo would otherwise get the wrong
    crate name.
5. Modify debcargo to generate X-Cargo-Crate lines
    unconditionally



More information about the Pkg-rust-maintainers mailing list