deb: skip dh_strip_nondeterminism and dh_shlibdeps when disabled#1132
Conversation
disable_strip and disable_auto_requires only overrode dh_strip and
dropped ${shlibs:Depends}, leaving dh_strip_nondeterminism and
dh_shlibdeps to run. Both fail on some inputs (corrupt archive and
foreign-arch ELF test fixtures) on newer dpkg, where override targets
appended mid-build are no longer honored. Emit empty override targets
at generation time so these helpers are skipped up front.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes disable_strip and disable_auto_requires on newer dpkg (e.g. Ubuntu 26.04 / dpkg 1.22.13+), where mid-build override appends are silently ignored because debhelper parses override targets only at startup. By emitting empty override targets at generation time, the skips are honored regardless of dpkg version, preventing failures in dh_strip_nondeterminism and dh_shlibdeps (whose output is discarded when auto-requires is disabled).
Changes:
disable_stripnow also skipsdh_strip_nondeterminismin addition todh_strip.disable_auto_requiresnow also skipsdh_shlibdepsvia a newOverrideAutoRequiresrules method wired into the template.- Tests refactored into subtests with a
newRulesWrapperhelper covering both enabled/disabled paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packaging/linux/deb/templates/debian_rules.tmpl | Adds {{ .OverrideAutoRequires }} to the generated rules file |
| packaging/linux/deb/template_rules.go | Extends OverrideStrip to skip dh_strip_nondeterminism and adds OverrideAutoRequires to skip dh_shlibdeps |
| packaging/linux/deb/template_rules_test.go | Refactors strip test into subtests, adds auto-requires tests and a newRulesWrapper helper |
| } | ||
|
|
||
| func TestRules_OverrideStrip(t *testing.T) { | ||
| w := &rulesWrapper{ |
There was a problem hiding this comment.
Do we have some integration test scenarios which would cover those?
There was a problem hiding this comment.
We have tests to validate the strip behavior.
We have tests to validate auto-requirement sniffing is disabled when that's toggled.
We don't have tests that validate that each specific debhelper program.
e.g., dh_strip will error out on a mangled ELF header or dh_strip_non_determinism errors out on a managed png file -- stuff that's within golang's corpus of test data that also gets shipped in GOROOT when packaging.
disable_stripanddisable_auto_requiresare meant to turn off stripping and automatic dependency discovery, but each only covers part of what debhelper runs:disable_stripoverridesdh_stripbut leavesdh_strip_nondeterminismrunning.disable_auto_requiresdrops${shlibs:Depends}from the control file but leavesdh_shlibdepsrunning (its output is then discarded).Those leftover helpers can fail on inputs the user has explicitly opted out of processing (e.g. corrupt archive fixtures, foreign-arch ELF fixtures — hit when building msft-golang). The existing options should already cover them, and there's no good spec-level workaround since mid-build
debian/rulesoverrides aren't honored on newer dpkg.This extends the existing options to emit the matching empty override targets at generation time:
disable_stripalso skipsdh_strip_nondeterminismdisable_auto_requiresalso skipsdh_shlibdeps