Skip to content

deb: skip dh_strip_nondeterminism and dh_shlibdeps when disabled#1132

Merged
cpuguy83 merged 1 commit into
project-dalec:mainfrom
cpuguy83:cpuguy83-deb-skip-strip-nondeterminism-shlibdeps
Jul 7, 2026
Merged

deb: skip dh_strip_nondeterminism and dh_shlibdeps when disabled#1132
cpuguy83 merged 1 commit into
project-dalec:mainfrom
cpuguy83:cpuguy83-deb-skip-strip-nondeterminism-shlibdeps

Conversation

@cpuguy83

@cpuguy83 cpuguy83 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

disable_strip and disable_auto_requires are meant to turn off stripping and automatic dependency discovery, but each only covers part of what debhelper runs:

  • disable_strip overrides dh_strip but leaves dh_strip_nondeterminism running.
  • disable_auto_requires drops ${shlibs:Depends} from the control file but leaves dh_shlibdeps running (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/rules overrides aren't honored on newer dpkg.

This extends the existing options to emit the matching empty override targets at generation time:

  • disable_strip also skips dh_strip_nondeterminism
  • disable_auto_requires also skips dh_shlibdeps

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>
Copilot AI review requested due to automatic review settings July 6, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_strip now also skips dh_strip_nondeterminism in addition to dh_strip.
  • disable_auto_requires now also skips dh_shlibdeps via a new OverrideAutoRequires rules method wired into the template.
  • Tests refactored into subtests with a newRulesWrapper helper 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{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have some integration test scenarios which would cover those?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cpuguy83 cpuguy83 merged commit abade2e into project-dalec:main Jul 7, 2026
46 of 51 checks passed
@cpuguy83 cpuguy83 deleted the cpuguy83-deb-skip-strip-nondeterminism-shlibdeps branch July 7, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants