fix golang post install and post uninstall sriptlets #12026
+14
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-static
subpackages, etc.) have had theirRelease
tag incremented../cgmanifest.json
,./toolkit/scripts/toolchain/cgmanifest.json
,.github/workflows/cgmanifest.json
)./LICENSES-AND-NOTICES/SPECS/data/licenses.json
,./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md
,./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON
)*.signatures.json
filessudo make go-tidy-all
andsudo make go-test-coverage
passSummary
NOTE: This change obviates #11343
golang
-- both the primary (1.23) package and the 1.22 package -- has warnings during both package install and package uninstall.For package install, we things like:
This is caused by #10654, which added the use of
alternatives
in both the post install and post uninstall scriptlets. The issue is:By putting an executable in the
%post
line, it makes the scriptlet be run with that executable rather thansh
. But because there's then a script after the%post
line, it means the parameters are totally wrong forldconfig
-- it ends up being a temporary file containing those lines and an extra, special parameter used in the scriptlet. This causesldconfig
to fail, which gives us that warning.This isn't the end of the world -- linkers will still work and everything, but it's definitely wrong and looks bad.
One may think that we could fix this by moving
ldconfig
into the script, like this:However, this exposes a bug in how
go_priority
is set -- it usesversion
before it's declared, which results in a completely wrong string. The good news is that we don't realistically needalternatives
. And since it isn't actually being called now, we can safely remove it and if we ever think we do need it, we can add it back correctly.So to fix this, we remove all uses of
alternatives
and thego_priority
variable, which is now unused.The warning during uninstall seems to have been there "forever":
This happens because
%postun
callsrm %{_sysconfdir}/profile.d/go-exports.sh
. However, that file is in the%files
section, so the package manager itself removes it -- there's no reason to have this statement. Fix is to remove it.Change Log
alternatives
, which also makes the%post -p /sbin/ldconfig
run as expected.go-exports.sh
Does this affect the toolchain?
NO
Associated issues
Test Methodology