Debian Bug report logs - #984719
lintian: add check for incomplete XS-Go-Import-Path

Package: lintian; Maintainer for lintian is Debian Lintian Maintainers <[email protected]>; Source for lintian is src:lintian (PTS, buildd, popcon).

Reported by: Alexandre Viau <[email protected]>

Date: Sun, 7 Mar 2021 16:54:02 UTC

Severity: wishlist

Reply or subscribe to this bug.

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


Report forwarded to [email protected], [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#984719; Package lintian. (Sun, 07 Mar 2021 16:54:04 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <[email protected]>:
New Bug report received and forwarded. Copy sent to [email protected], Debian Lintian Maintainers <[email protected]>. (Sun, 07 Mar 2021 16:54:04 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Alexandre Viau <[email protected]>
To: [email protected]
Subject: lintian: add check for incomplete XS-Go-Import-Path
Date: Sun, 7 Mar 2021 11:51:50 -0500
Package: lintian
Severity: wishlist
X-Debbugs-CC: [email protected]


Intro
=====

Go packages use the d/control `XS-Go-Import-Path` field to document the
import paths that they provide. This corresponds with files installed
under /usr/share/gocode/src. It would be great if lintian validated that
`XS-Go-Import-Path` was correct.

Xs-Go-Import-Path is used by tools in the Go packaging ecosystem for
useful things like finding the debian packages required to build a
program given its import paths.


XS-Go-Import-Path Usage
=======================

Most packages provide only one import path.

For example, `golang-github-bmizerany-pat` provides `XS-Go-Import-Path:
github.com/bmizerany/pat` and it installs files under
`/usr/share/gocode/src/github.com/bmizernany`.

Some packages provide more import paths. Sometimes via symlinks for
alternate names but sometimes simply because they actually provide two
different packages.

For example, `golang-gopkg-asn1-ber.v1` provides two import paths:
```
XS-Go-Import-Path: gopkg.in/asn1-ber.v1,
                   github.com/go-asn1-ber/asn1-ber
```

And it installs files at both
`/usr/share/gocode/src/gopkg.in/asn1-ber.v1` and
`/usr/share/gocode/src/github.com/go-asn1-ber`



Implementing the check
======================

I am unfamiliar with Lintian internals, and with Perl, but I do have
some pointers:

- If the package installs N directories under `/usr/share/gocode/src` It
should have exactly N import paths.

This package would have one import path (github.com/aviau/project):
 * /usr/share/gocode/src/github.com/aviau/project/aa.go
 * /usr/share/gocode/src/github.com/aviau/project/bb.go


This package would have two import paths (github.com/aviau/project and
gitlab.com/aviau/project):
 * /usr/share/gocode/src/github.com/aviau/project/aa.go
 * /usr/share/gocode/src/github.com/aviau/project/bb.go
 * /usr/share/gocode/src/gitlab.com/aviau/project (symlink)

- If the package installs files under
`/usr/share/gocode/src/FOO.com/BAR`, one of its import paths should
start with `foo.com/bar`.


aviau/identify-incomplete-xs-go-import-path
===========================================

I have written a python program to try and detect those mistakes, but it
only covers some use cases and depends on Debian Code Search. However it
may be useful for anyone trying to write a lintian check:
- https://salsa.debian.org/aviau/identify-incomplete-xs-go-import-path


Thank you for Lintian and thanks for taking a look at this :)

-- 
Aleaxandre Viau
[email protected]



Information forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#984719; Package lintian. (Sun, 07 Mar 2021 18:33:03 GMT) (full text, mbox, link).


Acknowledgement sent to Felix Lechner <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>. (Sun, 07 Mar 2021 18:33:03 GMT) (full text, mbox, link).


Message #10 received at [email protected] (full text, mbox, reply):

From: Felix Lechner <[email protected]>
To: Alexandre Viau <[email protected]>
Cc: [email protected]
Subject: Re: Bug#984719: lintian: add check for incomplete XS-Go-Import-Path
Date: Sun, 7 Mar 2021 10:28:23 -0800
Hi Alexandre,

On Sun, Mar 7, 2021 at 8:54 AM Alexandre Viau <[email protected]> wrote:
>
> XS-Go-Import-Path: gopkg.in/asn1-ber.v1,
>                    github.com/go-asn1-ber/asn1-ber
>
> And it installs files at both
> `/usr/share/gocode/src/gopkg.in/asn1-ber.v1` and
> `/usr/share/gocode/src/github.com/go-asn1-ber`

Should the second path be
/usr/share/gocode/src/github.com/go-asn1-ber/asn1-ber instead? (Please
note the extra final component in the file list at the very bottom of
this message.) Also, why is it a symbolic link, please? Should Lintian
merely verify that the path is present so we catch when there is a
link and not a folder?

As a side note, I had to download the installable package

    golang-gopkg-asn1-ber.v1-dev_1.5.1-1_all.deb

in order to take a look at it. I tried examining the paths on
packages.d.o [1] but only saw "No such package in this suite on this
architecture." Do you know why that might be happening? Thanks!

Kind regards
Felix Lechner

[1] https://packages.debian.org/sid/all/golang-gopkg-asn1-ber.v1-dev/filelist

* * *

➤ dpkg -c /tmp/golang-gopkg-asn1-ber.v1-dev_1.5.1-1_all.deb
drwxr-xr-x root/root         0 2020-08-29 13:08 ./
drwxr-xr-x root/root         0 2020-08-29 13:08 ./usr/
drwxr-xr-x root/root         0 2020-08-29 13:08 ./usr/share/
drwxr-xr-x root/root         0 2020-08-29 13:08 ./usr/share/doc/
drwxr-xr-x root/root         0 2020-08-29 13:08
./usr/share/doc/golang-gopkg-asn1-ber.v1-dev/
-rw-r--r-- root/root       769 2020-08-29 13:08
./usr/share/doc/golang-gopkg-asn1-ber.v1-dev/changelog.Debian.gz
-rw-r--r-- root/root      1494 2020-08-29 13:08
./usr/share/doc/golang-gopkg-asn1-ber.v1-dev/copyright
drwxr-xr-x root/root         0 2020-08-29 13:08 ./usr/share/gocode/
drwxr-xr-x root/root         0 2020-08-29 13:08 ./usr/share/gocode/src/
drwxr-xr-x root/root         0 2020-08-29 13:08
./usr/share/gocode/src/github.com/
drwxr-xr-x root/root         0 2020-08-29 13:08
./usr/share/gocode/src/github.com/go-asn1-ber/
drwxr-xr-x root/root         0 2020-08-29 13:08 ./usr/share/gocode/src/gopkg.in/
drwxr-xr-x root/root         0 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/
-rw-r--r-- root/root     14751 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/ber.go
-rw-r--r-- root/root      4856 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/ber_test.go
-rw-r--r-- root/root       310 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/content_int.go
-rw-r--r-- root/root      2505 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/generalizedTime.go
-rw-r--r-- root/root      1819 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/generalizedTime_test.go
-rw-r--r-- root/root        48 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/go.mod
-rw-r--r-- root/root       793 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/header.go
-rw-r--r-- root/root      3477 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/header_test.go
-rw-r--r-- root/root      2603 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/identifier.go
-rw-r--r-- root/root     10997 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/identifier_test.go
-rw-r--r-- root/root      2026 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/length.go
-rw-r--r-- root/root      4174 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/length_test.go
-rw-r--r-- root/root      3150 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/real.go
-rw-r--r-- root/root       536 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/real_test.go
-rw-r--r-- root/root      2151 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/string_test.go
-rw-r--r-- root/root      7574 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/suite_test.go
drwxr-xr-x root/root         0 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/
-rw-r--r-- root/root        13 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc1.ber
-rw-r--r-- root/root         9 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc10.ber
-rw-r--r-- root/root        11 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc11.ber
-rw-r--r-- root/root         3 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc12.ber
-rw-r--r-- root/root        11 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc13.ber
-rw-r--r-- root/root         7 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc14.ber
-rw-r--r-- root/root        14 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc15.ber
-rw-r--r-- root/root        14 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc16.ber
-rw-r--r-- root/root        22 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc17.ber
-rw-r--r-- root/root         5 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc18.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc19.ber
-rw-r--r-- root/root        10 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc2.ber
-rw-r--r-- root/root        11 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc20.ber
-rw-r--r-- root/root         8 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc21.ber
-rw-r--r-- root/root        18 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc22.ber
-rw-r--r-- root/root         8 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc23.ber
-rw-r--r-- root/root        23 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc24.ber
-rw-r--r-- root/root         5 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc25.ber
-rw-r--r-- root/root         5 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc26.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc27.ber
-rw-r--r-- root/root         3 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc28.ber
-rw-r--r-- root/root         3 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc29.ber
-rw-r--r-- root/root        10 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc3.ber
-rw-r--r-- root/root         5 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc30.ber
-rw-r--r-- root/root         4 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc31.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc32.ber
-rw-r--r-- root/root         4 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc33.ber
-rw-r--r-- root/root         3 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc34.ber
-rw-r--r-- root/root        16 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc35.ber
-rw-r--r-- root/root        20 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc36.ber
-rw-r--r-- root/root        14 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc37.ber
-rw-r--r-- root/root        16 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc38.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc39.ber
-rw-r--r-- root/root        11 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc4.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc40.ber
-rw-r--r-- root/root        16 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc41.ber
-rw-r--r-- root/root        14 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc42.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc43.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc44.ber
-rw-r--r-- root/root         2 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc45.ber
-rw-r--r-- root/root        11 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc46.ber
-rw-r--r-- root/root        16 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc47.ber
-rw-r--r-- root/root        16 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc48.ber
-rw-r--r-- root/root         4 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc49.ber
-rw-r--r-- root/root        13 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc5.ber
-rw-r--r-- root/root        10 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc50.ber
-rw-r--r-- root/root         7 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc51.ber
-rw-r--r-- root/root         9 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc6.ber
-rw-r--r-- root/root         9 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc7.ber
-rw-r--r-- root/root         5 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc8.ber
-rw-r--r-- root/root         5 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/tests/tc9.ber
-rw-r--r-- root/root       452 2020-08-29 13:08
./usr/share/gocode/src/gopkg.in/asn1-ber.v1/util.go
lrwxrwxrwx root/root         0 2020-08-29 13:08
./usr/share/gocode/src/github.com/go-asn1-ber/asn1-ber ->
../../gopkg.in/asn1-ber.v1



Information forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#984719; Package lintian. (Mon, 08 Mar 2021 01:09:05 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>. (Mon, 08 Mar 2021 01:09:05 GMT) (full text, mbox, link).


Message #15 received at [email protected] (full text, mbox, reply):

From: Alexandre Viau <[email protected]>
To: Felix Lechner <[email protected]>
Cc: [email protected]
Subject: Re: Bug#984719: lintian: add check for incomplete XS-Go-Import-Path
Date: Sun, 7 Mar 2021 20:06:56 -0500
On 2021-03-07 1:28 p.m., Felix Lechner wrote:
> Hi Alexandre,
>
> On Sun, Mar 7, 2021 at 8:54 AM Alexandre Viau <[email protected]> wrote:
>> XS-Go-Import-Path: gopkg.in/asn1-ber.v1,
>>                    github.com/go-asn1-ber/asn1-ber
>>
>> And it installs files at both
>> `/usr/share/gocode/src/gopkg.in/asn1-ber.v1` and
>> `/usr/share/gocode/src/github.com/go-asn1-ber`
> Should the second path be
> /usr/share/gocode/src/github.com/go-asn1-ber/asn1-ber instead? (Please
> note the extra final component in the file list at the very bottom of
> this message.) 

Ideally yes, but both paths are technically correct. I don't think
Lintian should go so far as it will probably be hard (or impossible) to
get right.


> Also, why is it a symbolic link, please? 

In this case the package changed name, so both folders point to the same
source for backwards-compatibility. When the Go compiler imports both
paths it will find the same source code.


> Should Lintian
> merely verify that the path is present so we catch when there is a
> link and not a folder?


I don't think Lintian should distinguish between links and folders.


> in order to take a look at it. I tried examining the paths on
> packages.d.o [1] but only saw "No such package in this suite on this
> architecture." Do you know why that might be happening? Thanks!

No, sorry.


Cheers :)


-- 

Aleaxandre Viau
[email protected]




Information forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#984719; Package lintian. (Thu, 11 Mar 2021 20:39:06 GMT) (full text, mbox, link).


Acknowledgement sent to Felix Lechner <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>. (Thu, 11 Mar 2021 20:39:06 GMT) (full text, mbox, link).


Message #20 received at [email protected] (full text, mbox, reply):

From: Felix Lechner <[email protected]>
To: Alexandre Viau <[email protected]>, [email protected]
Subject: Re: Bug#984719: lintian: add check for incomplete XS-Go-Import-Path
Date: Thu, 11 Mar 2021 12:34:49 -0800
Hi Alexandre,

On Sun, Mar 7, 2021 at 8:54 AM Alexandre Viau <[email protected]> wrote:
>
> It would be great if lintian validated that `XS-Go-Import-Path` was correct.

I implemented it on an unreleased branch, but it will not work well
unless the field is propagated into the control files of installed
packages (for your example, golang-github-bmizerany-pat-dev). I see
the field only in the dsc, but not in CONTROL [1]. Is that possible,
please?

Kind regards
Felix Lechner

[1] https://binarycontrol.debian.net/cache/unstable/golang-github-bmizerany-pat-dev/control



Information forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#984719; Package lintian. (Sat, 13 Mar 2021 01:51:03 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>. (Sat, 13 Mar 2021 01:51:03 GMT) (full text, mbox, link).


Message #25 received at [email protected] (full text, mbox, reply):

From: Alexandre Viau <[email protected]>
To: Felix Lechner <[email protected]>, [email protected]
Subject: Re: Bug#984719: lintian: add check for incomplete XS-Go-Import-Path
Date: Fri, 12 Mar 2021 20:47:10 -0500
On 2021-03-11 3:34 p.m., Felix Lechner wrote:
> Hi Alexandre,
>
> On Sun, Mar 7, 2021 at 8:54 AM Alexandre Viau <[email protected]> wrote:
>> It would be great if lintian validated that `XS-Go-Import-Path` was correct.
> I implemented it on an unreleased branch, but it will not work well
> unless the field is propagated into the control files of installed
> packages (for your example, golang-github-bmizerany-pat-dev). I see
> the field only in the dsc, but not in CONTROL [1]. Is that possible,
> please?


There is already a lintian warning that checks for the presence of
XS-Go-Import-Path, maybe you can take a look at how this one works?

-
https://lintian.debian.org/tags/missing-xs-go-import-path-for-golang-package.html


If we can check for XS-Go-Import-Path then I think that we can read it?


I hope that helps! Cheers!


-- 

Aleaxandre Viau
[email protected]




Information forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#984719; Package lintian. (Sat, 13 Mar 2021 02:21:02 GMT) (full text, mbox, link).


Acknowledgement sent to Felix Lechner <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>. (Sat, 13 Mar 2021 02:21:02 GMT) (full text, mbox, link).


Message #30 received at [email protected] (full text, mbox, reply):

From: Felix Lechner <[email protected]>
To: Alexandre Viau <[email protected]>
Cc: [email protected]
Subject: Re: Bug#984719: lintian: add check for incomplete XS-Go-Import-Path
Date: Fri, 12 Mar 2021 18:15:38 -0800
Hi Alexandre,

On Fri, Mar 12, 2021 at 5:47 PM Alexandre Viau <[email protected]> wrote:
>
> If we can check for XS-Go-Import-Path then I think that we can read it?

The check you are referring to reads Debian sources (dsc), but the
field is not present in the *installable* packages (*.deb) that place
the sources in /usr/share/gocode/src. Your tag cannot be implemented
unless the field is also present in the installable (aka "binary")
packages.

Kind regards
Felix Lechner



Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 09:17:27 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General 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.