Files
c42462355e fix(apk): normalize file modes before writing tar headers (#1113)
* fix(apk): Normalize file modes before writing tar headers

Go file type flags do not fit APK tar mode fields and force
archive/tar to use GNU base-256 encoding that apk-tools rejects.
Convert to Unix mode bits at the writer boundary while preserving
configured and Go-encoded special permissions.

Constraint: APK mode fields accept Unix permission bits, not Go type flags.
Rejected: Normalize tree metadata globally | special-file type detection uses it
Confidence: high
Scope-risk: narrow
Directive: Keep APK tar modes free of Go file type flags.
Tested: Go 1.26.4 full race suite, lint, vet, APK acceptance, Alpine install
Not-tested: Full multi-architecture acceptance matrix
Fixes #1112

* test: Account for the package umask in tree modes

Windows reports broader source permissions than Unix. Compare the tar header with source permissions after the package umask, matching the preparation path on every platform.

Tested: go test ./apk -run ^TestTreeDirectoryMode$ -count=1

Tested: go test -race ./apk -count=1

---------

Co-authored-by: ychampion <ychampion@users.noreply.github.com>
2026-08-08 14:54:37 -03:00
..