Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926841 - go-module.eclass: Consider removing RESTRICT=strip
Summary: go-module.eclass: Consider removing RESTRICT=strip
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-12 14:32 UTC by Xiami
Modified: 2024-03-16 14:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xiami 2024-03-12 14:32:20 UTC
I have been packaging Go programs and noticed that the executables remain `not stripped` after src_install.

Found `RESTRICT+=" strip"` in go-module.eclass .

Despite searching, I have not uncovered the rationale behind this restriction. However, based on my investigation, I propose that this restriction be reconsidered and potentially removed.

======BEGIN CLUES======

1) Debian Go packages
I have examined debian/rules for etcd-server, git-lfs, libpod, restic. None of them disable stripping.

Notably, git-lfs previously included a dh_override_strip to disable stripping.
But this is no longer the case, as evidenced by this commit:
https://salsa.debian.org/go-team/packages/git-lfs/-/commit/7d8ec4e303ca9535c7e5a7479660a7f2856803ac .


2) Web search
There are historical reports suggesting that stripping might break Go compiler.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717172
https://bugs.launchpad.net/ubuntu/+source/golang/+bug/1200255

However, this seems outdated, as recent debian/rules only disable stripping for testdata.

https://salsa.debian.org/go-team/compiler/golang/-/commit/4e9a859347c7d8e0ad860a6e4e390d132f178ea1
https://salsa.debian.org/go-team/compiler/golang/-/commit/5202f80135a371661199132170de3f3578591347

Further, dev-lang/go does not inherit go-module.eclass .

There is a discussion thread talking about stripping. But provides no conclusive evidence that stripping issues persist.

https://groups.google.com/g/golang-dev/c/ABppMOjYP6w


3) Gentoo Git History
The RESTRICT=strip directive was part of the initial version of go-module.eclass, yet such a restriction does not appear in the earlier golang-build.eclass.

======END CLUES======

While I cannot definitively claim that stripping will never cause issues, there seems to be a lack of current evidence to support such concerns.

Given the potential impact on numerous ebuilds from modifying the eclass file, I suggest introducing an eclass variable to allow for optional stripping.

```bash
if [[ ! ${GO_ALLOW_STRIP} ]]; then
    RESTRICT=" +strip"
fi
```

Based on further observation and feedback, we can remove it in future.
Comment 1 Ionen Wolkens gentoo-dev 2024-03-12 15:32:46 UTC
Not super familiar with Go and potential issues but I second this. It was the main reason I did not use go-module.eclass for x11-terms/kitty (a mixed Go, C, and python package) "for now". Lacked any way to override RESTRICT="strip" for non-Go bits (even dostrip did not work due to bug #697960), not to mention other defaults that assumed everything is Go (like QA_FLAGS_IGNORED='.*', albeit can override that one), and the unwanted dependency on unzip.

Found out that it didn't even seem to matter if the Go-written tool is stripped as well so ultimately didn't restrict stripping for anything and haven't received bug report on that.
Comment 2 William Hubbs gentoo-dev 2024-03-16 14:42:03 UTC
There used to be a very big warning in the past about stripping go
binaries, but it looks like that may have changed.

I'll take a look at dropping this.

Thanks,

William