Bug 285151 - lang/go*: Stop installing Linux test binaries
Summary: lang/go*: Stop installing Linux test binaries
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Golang Team (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-04 06:56 UTC by Gleb Popov
Modified: 2025-03-07 06:05 UTC (History)
4 users (show)

See Also:
arrowd: maintainer-feedback? (go)


Attachments
Patch (2.94 KB, patch)
2025-03-04 06:56 UTC, Gleb Popov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gleb Popov freebsd_committer freebsd_triage 2025-03-04 06:56:30 UTC
Created attachment 258273 [details]
Patch
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2025-03-05 16:42:50 UTC
Adam, since you're caring for go ports, maybe you can approve this?
Comment 2 Adam Weinberger freebsd_committer freebsd_triage 2025-03-05 18:34:37 UTC
This certainly LGTM and you've got my +1 on it.

But what about the other targets? Do none of the others cause trouble?

[1332.58 adamw@apnoea /usr/local/go123/src/debug] du -h -d 1 **/testdata
163K    dwarf/testdata/
154K    elf/testdata/
131K    gosym/testdata/
 66K    macho/testdata/
173K    pe/testdata/
 42K    plan9obj/testdata/
Comment 3 Gleb Popov freebsd_committer freebsd_triage 2025-03-05 18:35:54 UTC
All other files are probably statically linked. But I'd also like to remove them, if they are in fact unused on the target machine.
Comment 4 Adam Weinberger freebsd_committer freebsd_triage 2025-03-05 19:42:53 UTC
In reality, we install tons of go stuff that are never used; a big one there are test files. /usr/local/go123/test is 15MB, and all ~300 testdata dirs in go123/src/ are unused.

As far as I can tell, the reasoning behind packagers included those dirs centers around, "*shrug*." I'd be perfectly happy to see all that stuff disappear, but I'm only 95% confident that they're useless and that's not enough.
Comment 5 Gleb Popov freebsd_committer freebsd_triage 2025-03-06 07:07:41 UTC
Then let's stay on safe side and land the patch as-is?
Comment 6 Adam Weinberger freebsd_committer freebsd_triage 2025-03-06 13:51:03 UTC
(In reply to Gleb Popov from comment #5)

I'm on board with that. I say, go for it.
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-03-06 13:53:51 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a9d50d18293658481ab9badf19ddc0dda84628b0

commit a9d50d18293658481ab9badf19ddc0dda84628b0
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2025-03-04 06:53:36 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2025-03-06 13:52:57 +0000

    lang/go{120,121,122,123,-devel}: Stop install Linux test binaries

    With pkg's improved shared library tracking these [useless anyways] files
    started to confuse Poudriere.

    Reported by:    bdrewery
    Approved by:    adamw
    PR:             285151

 lang/go-devel/Makefile | 3 ++-
 lang/go120/Makefile    | 2 +-
 lang/go121/Makefile    | 2 +-
 lang/go122/Makefile    | 2 +-
 lang/go123/Makefile    | 1 +
 5 files changed, 6 insertions(+), 4 deletions(-)
Comment 8 Piotr Kubaj freebsd_committer freebsd_triage 2025-03-06 14:31:18 UTC
"-f" is not necessary. ${RM} already does that.
Comment 9 commit-hook freebsd_committer freebsd_triage 2025-03-06 14:37:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fd78d64546872a69da9e3ce11400f115e3428d25

commit fd78d64546872a69da9e3ce11400f115e3428d25
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2025-03-06 14:36:24 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2025-03-06 14:36:24 +0000

    lang/go-devel: Remove -f from the ${RM} invocation

    PR:             285151
    Reported by:    pkubaj
    Fixes:  a9d50d18293658481ab9badf19ddc0dda84628b0

 lang/go-devel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 10 Robert Clausecker freebsd_committer freebsd_triage 2025-03-06 15:32:17 UTC
The test data is needed if you want to run the unit tests of standard library packages.  I strongly advice against removing random bits of the source distribution in our package; Debian has done the same before and it caused weird issues.  Please revert.
Comment 11 Gleb Popov freebsd_committer freebsd_triage 2025-03-06 15:34:07 UTC
(In reply to Robert Clausecker from comment #10)
It seems strange to me that an end user would want to run go unit tests against an installed package. Aren't tests supposed to be run during the port build?
Comment 12 Robert Clausecker freebsd_committer freebsd_triage 2025-03-06 15:47:25 UTC
(In reply to Gleb Popov from comment #11)

The Go tool permits running unit tests of all standard library packages.  A user might e.g. want to run unit tests of all packages in his project and all dependencies recursively, which includes some standard library packages.  If you delete test files, these tests will fail.

This should be fixed by fixing pkg, not by removing random test files from the distribution.
Comment 13 Gleb Popov freebsd_committer freebsd_triage 2025-03-06 17:00:04 UTC
(In reply to Robert Clausecker from comment #12)
> The Go tool permits running unit tests of all standard library packages.  A user might e.g. want to run unit tests of all packages in his project and all dependencies recursively, which includes some standard library packages.  If you delete test files, these tests will fail.

Makes sense, although I still find it a bit strange and unusual.
Comment 14 Baptiste Daroussin freebsd_committer freebsd_triage 2025-03-06 17:18:55 UTC
there is nothing to be fixed in pkg ;)

pkg reports that testdata/gcc-386-freebsd-exec is a freebsd 32 bit binary required libc.so.6 (readelf -d on it you will see it is true)

pkg can be instrumented not to analyse this file: like in this review:

https://reviews.freebsd.org/D49260
Comment 15 commit-hook freebsd_committer freebsd_triage 2025-03-07 06:05:16 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=aa6c40debfb19e4d0dcf6b5b400287cfad2aecb3

commit aa6c40debfb19e4d0dcf6b5b400287cfad2aecb3
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2025-03-07 06:01:03 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2025-03-07 06:04:45 +0000

    lang/go{120,121,122,123,-devel}: Revert "Stop install Linux test binaries"

    This reverts commit a9d50d18293658481ab9badf19ddc0dda84628b0.

    A better solution was committed in a4327166148114c314ae5dd6f9c7e6776178e0ac

    PR:             285151
    Reported by:    fuz

 lang/go-devel/Makefile | 3 +--
 lang/go120/Makefile    | 2 +-
 lang/go121/Makefile    | 2 +-
 lang/go122/Makefile    | 2 +-
 lang/go123/Makefile    | 2 +-
 lang/go124/Makefile    | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)