Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package apko for openSUSE:Factory checked in at 2026-11-23 12:26:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/apko (Old) and /work/SRC/openSUSE:Factory/.apko.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "apko" Mon Nov 23 12:26:51 2026 rev:149 rq:1399849 version:1.5.2 Changes: -------- --- /work/SRC/openSUSE:Factory/apko/apko.changes 2026-11-16 12:28:32.554833967 +0100 +++ /work/SRC/openSUSE:Factory/.apko.new.1340718/apko.changes 2026-11-23 12:31:53.493141494 +0100 @@ -1,0 +2,26 @@ +Mon Nov 23 05:48:28 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 1.5.2: + * build: render each planned file from its own path (#2687) + * chore(deps): apko no longer pulls in an SDK that depends on + apko (#2684) + * docs: update code of conduct contact to [email protected] + (#2683) + * fix(auth): match EnvAuth on the request Host like the other + authenticators (#2628) + * build(deps): bump chainguard.dev/sdk from 0.1.499 to 0.1.503 + (#2680) + * build(deps): bump google.golang.org/api from 0.314.0 to 0.315.0 + (#2681) + * build(deps): bump google.golang.org/api from 0.311.0 to 0.314.0 + (#2679) + * build(deps): bump chainguard.dev/sdk from 0.1.487 to 0.1.499 + (#2678) + * build(deps): bump gopkg.in/ini.v1 from 1.67.3 to 1.68.0 (#2677) + * cpio: preserve TAR UID/GID when converting to CPIO (#2645) + * build(deps): bump chainguard.dev/sdk from 0.1.481 to 0.1.487 + (#2671) + * build(deps): bump golang.org/x/term from 0.47.0 to 0.48.0 + (#2672) + +------------------------------------------------------------------- Old: ---- apko-1.5.1.obscpio New: ---- apko-1.5.2.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ apko.spec ++++++ --- /var/tmp/diff_new_pack.t7OFFh/_old 2026-11-23 12:31:56.254257731 +0100 +++ /var/tmp/diff_new_pack.t7OFFh/_new 2026-11-23 12:31:56.257257858 +0100 @@ -17,7 +17,7 @@ Name: apko -Version: 1.5.1 +Version: 1.5.2 Release: 0 Summary: Build OCI images from APK packages directly without Dockerfile License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.t7OFFh/_old 2026-11-23 12:31:56.362262278 +0100 +++ /var/tmp/diff_new_pack.t7OFFh/_new 2026-11-23 12:31:56.368262531 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/chainguard-dev/apko.git</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">refs/tags/v1.5.1</param> + <param name="revision">refs/tags/v1.5.2</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.t7OFFh/_old 2026-11-23 12:31:56.452266067 +0100 +++ /var/tmp/diff_new_pack.t7OFFh/_new 2026-11-23 12:31:56.466266656 +0100 @@ -3,6 +3,6 @@ <param name="url">https://github.com/chainguard-dev/apko</param> <param name="changesrevision">861f83f69e6fa9114405a2f7bb5cf6585ad00421</param></service><service name="tar_scm"> <param name="url">https://github.com/chainguard-dev/apko.git</param> - <param name="changesrevision">2af887e71025923c2c9db14cfa3d0be35946bd1d</param></service></servicedata> + <param name="changesrevision">ac841bac3ef36d4523ca80ec4182bbafcb32eba7</param></service></servicedata> (No newline at EOF) ++++++ apko-1.5.1.obscpio -> apko-1.5.2.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/CODE_OF_CONDUCT.md new/apko-1.5.2/CODE_OF_CONDUCT.md --- old/apko-1.5.1/CODE_OF_CONDUCT.md 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/CODE_OF_CONDUCT.md 2026-11-20 17:44:31.000000000 +0100 @@ -60,7 +60,7 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [email protected]. [email protected]. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/go.mod new/apko-1.5.2/go.mod --- old/apko-1.5.1/go.mod 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/go.mod 2026-11-20 17:44:31.000000000 +0100 @@ -3,7 +3,7 @@ go 1.27.0 require ( - chainguard.dev/sdk v0.1.481 + chainguard.dev/sdk v0.2.2 github.com/chainguard-dev/clog v1.8.1 github.com/charmbracelet/log v1.0.0 github.com/erofs/go-erofs v0.3.2 @@ -34,11 +34,11 @@ golang.org/x/oauth2 v0.38.0 golang.org/x/sync v0.25.0 golang.org/x/sys v0.50.0 - golang.org/x/term v0.47.0 + golang.org/x/term v0.48.0 golang.org/x/time v0.16.0 - google.golang.org/api v0.311.0 + google.golang.org/api v0.315.0 google.golang.org/protobuf v1.36.12 - gopkg.in/ini.v1 v1.67.3 + gopkg.in/ini.v1 v1.68.0 gopkg.in/yaml.v3 v3.0.1 k8s.io/apimachinery v0.37.2 sigs.k8s.io/release-utils v0.12.5 @@ -88,7 +88,7 @@ github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/s2a-go v0.1.11 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.24 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.25 // indirect github.com/googleapis/gax-go/v2 v2.27.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.4 // indirect @@ -139,7 +139,7 @@ golang.org/x/net v0.62.0 // indirect golang.org/x/text v0.43.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20261026165753-2ffab32bce7e // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab // indirect google.golang.org/grpc v1.85.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/go.sum new/apko-1.5.2/go.sum --- old/apko-1.5.1/go.sum 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/go.sum 2026-11-20 17:44:31.000000000 +0100 @@ -2,8 +2,8 @@ chainguard.dev/go-grpc-kit v0.20.0/go.mod h1:ocuwyRX9tqRRvJkS3/ZkDYGMnl+6FLC4bvF0cm6DGsk= chainguard.dev/go-oidctest v0.4.0 h1:B9YTfoa1WtsrEg0wnFeSP7i9tth0LO+GICm2j8HOgWI= chainguard.dev/go-oidctest v0.4.0/go.mod h1:IIic4S3je1I7Acy3bqPtaSPefGEsQDzUp7NJF35MPV4= -chainguard.dev/sdk v0.1.481 h1:OsnlAiaARErHBH6aU04zs7qbwqmdbQsaft8E+UNnj20= -chainguard.dev/sdk v0.1.481/go.mod h1:gAiGRAXL1YJSY+uEaB252MF/M9lQ6HUieIhorvPisMY= +chainguard.dev/sdk v0.2.2 h1:LrFlFvlr7MtGwF6wMIeO4wb4Ax9t0zRZlRoNQnfcq1w= +chainguard.dev/sdk v0.2.2/go.mod h1:0v7DhL1zPZlNba24mEh/iwVNHGJTgY7hpvsE7q0Keb4= cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a h1:jW1ZLFy9oa5ai8LOI40z6s+DL1cO/L1KSm9hVGnibn8= cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a/go.mod h1:1dmBXa9xfBvBr39ZnDUDkaaA91ccq9CcqENDgJA4d7c= cloud.google.com/go/auth/oauth2adapt v0.3.1 h1:BKLDdbWS7pafd820dsyFDF6fPEzIGqr7ny6hbTzCCgE= @@ -126,8 +126,8 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.24 h1:G9iCJIY+AYVmUskKdjX8FVy7sG+nbzjOQ41cvlmhcvg= -github.com/googleapis/enterprise-certificate-proxy v0.3.24/go.mod h1:hEjCmnoakQzv5ImLUp6alkY7XgLlNoAxwTXmhHHNIsI= +github.com/googleapis/enterprise-certificate-proxy v0.3.25 h1:n/6K8rCcoQQjGZ+o5irYrdwAFZIclQMXq0yeJyK2FaI= +github.com/googleapis/enterprise-certificate-proxy v0.3.25/go.mod h1:hEjCmnoakQzv5ImLUp6alkY7XgLlNoAxwTXmhHHNIsI= github.com/googleapis/gax-go/v2 v2.27.0 h1:qe2iQOUzxb3fd6x6ewpIEixPQhJ+0Ihc/RRZhKA/2g0= github.com/googleapis/gax-go/v2 v2.27.0/go.mod h1:RofiqDw3ehcG4L0H1zO3D2Itpwd3/uS/7wdmbNDF1DE= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= @@ -293,8 +293,8 @@ golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= golang.org/x/exp v0.0.0-20260727155853-b88d891fe743 h1:ex206bKw+v3K0dm3andkrIF+ijyQKJG1pLgwQ2PYdQM= golang.org/x/exp v0.0.0-20260727155853-b88d891fe743/go.mod h1:EdfpwwqSu+0Li0mzskwHU6FWDV3t9Q+RZDo3QMUtL3Q= -golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= -golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg= +golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= @@ -312,8 +312,8 @@ golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= -golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= +golang.org/x/term v0.48.0 h1:G6UU1eiSB8nl3DzeUGt7Mg+2SctI8tPS6Z5/mBt6cOk= +golang.org/x/term v0.48.0/go.mod h1:BRDLHCZr2SUjIeBHHpRyQeC9xzSAVbzY2rvKgafnHf4= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= @@ -324,14 +324,14 @@ golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -google.golang.org/api v0.311.0 h1:t9xGmC/+3kC75YmJldWrlVW2EZqS+PhxL0QMTdytlAY= -google.golang.org/api v0.311.0/go.mod h1:x9+Bc6l3cH1HItpSGqV2mZnbM1bk1VmpLJMwKEtsmgg= +google.golang.org/api v0.315.0 h1:77nwD4sln0GQQqQKb4CY+DJhRwA0AeQ4w0gkbLwRPms= +google.golang.org/api v0.315.0/go.mod h1:kn5kd1IMbs2x4hq99GcaTOumC0fnMYMwLNAfFxzpISU= google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941 h1:CXq2XEi5aEyLjjPZIwqrmQH8ZY4ctUwK7uyAx3mjX/U= google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941/go.mod h1:3gK0ehnhP0V7/x3ypGoLyT3d0n6TSi/EcsphIjHrcz4= google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941 h1:DS/w3N8rsfrwxwgGSj6WhMsPo7aNQGmDx74J81zd0NQ= google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941/go.mod h1:AuGAdi9KnXss7xbLxIKhCvk+Ro/SxpET/iS45DNYN+M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20261026165753-2ffab32bce7e h1:w3fy/G8OrJHYexn+u5y7hFyc8YRRIr7DCevtIOwAcGY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20261026165753-2ffab32bce7e/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab h1:8sYjjefPfQ+FZEh1ZwBAqK/NifJVhOxut8nRh3SJzZM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw= google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= @@ -340,8 +340,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/ini.v1 v1.67.3 h1:iM9Lhz5MRSGhHVGGwCuzG9KO8PoirCXj/m/qTmOJJQw= -gopkg.in/ini.v1 v1.67.3/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= +gopkg.in/ini.v1 v1.68.0 h1:Ml6Jlmf35dsiLcxJaRSjck7dxkxCOHd9T/E1f6jV9EE= +gopkg.in/ini.v1 v1.68.0/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/pkg/apk/auth/auth.go new/apko-1.5.2/pkg/apk/auth/auth.go --- old/apko-1.5.1/pkg/apk/auth/auth.go 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/pkg/apk/auth/auth.go 2026-11-20 17:44:31.000000000 +0100 @@ -66,7 +66,7 @@ return merr } -// EnvAuth adds HTTP basic auth to the request if the request URL matches the +// EnvAuth adds HTTP basic auth to the request if the request host matches the // HTTP_AUTH environment variable. type EnvAuth struct{} @@ -77,13 +77,13 @@ if len(parts) != 4 || parts[0] != "basic" { return nil } - if req.URL.Host == parts[1] { + if req.Host == parts[1] { req.SetBasicAuth(parts[2], parts[3]) } return nil } -// CGRAuth adds HTTP basic auth to the request if the request URL matches +// CGRAuth adds HTTP basic auth to the request if the request host matches // apk.cgr.dev and the `chainctl` command is available. // // It executes `chainctl` to get a token. If you need to assume an identity @@ -155,7 +155,7 @@ } // StaticAuth is an Authenticator that adds HTTP basic auth to the request if -// the request URL matches the given domain. +// the request host matches the given domain. func StaticAuth(domain, user, pass string) Authenticator { return staticAuth{domain, user, pass} } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/pkg/apk/auth/auth_test.go new/apko-1.5.2/pkg/apk/auth/auth_test.go --- old/apko-1.5.1/pkg/apk/auth/auth_test.go 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/pkg/apk/auth/auth_test.go 2026-11-20 17:44:31.000000000 +0100 @@ -76,6 +76,8 @@ tests := []struct { name string env string + host string // explicit req.Host, if different from the URL host + emptyHost bool // clear req.Host, as a hand-built request may have it expectAuth bool expectUser string expectPass string @@ -121,12 +123,38 @@ env: "", expectAuth: false, }, + { + name: "explicit request Host matches", + env: "basic:other.example.com:user:pass", + host: "other.example.com", + expectAuth: true, + expectUser: "user", + expectPass: "pass", + }, + { + name: "explicit request Host differs", + env: "basic:example.com:user:pass", + host: "other.example.com", + expectAuth: false, + }, + { + name: "empty request Host", + env: "basic:example.com:user:pass", + emptyHost: true, + expectAuth: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { t.Setenv("HTTP_AUTH", tt.env) req, _ := http.NewRequest("GET", "http://example.com", nil) + if tt.host != "" { + req.Host = tt.host + } + if tt.emptyHost { + req.Host = "" + } if err := (EnvAuth{}).AddAuth(context.Background(), req); err != nil { t.Fatalf("did not expect error but got: %v", err) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/pkg/build/layer_plan.go new/apko-1.5.2/pkg/build/layer_plan.go --- old/apko-1.5.1/pkg/build/layer_plan.go 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/pkg/build/layer_plan.go 2026-11-20 17:44:31.000000000 +0100 @@ -114,28 +114,29 @@ h.Write(b) } -// LayerContent provides content for a build's layer plans by digest. It -// reads files from the build filesystem and holds content generated during -// planning. It trusts digests reported by the filesystem to identify the -// content correctly. The filesystem must remain available and unchanged +// LayerContent provides content for a build's layer plans. It reads each +// file from its own path in the build filesystem and holds content generated +// during planning. The filesystem must remain available and unchanged // from planning until rendering completes. type LayerContent struct { fsys apkfs.FullFS - paths map[string]string - inline map[string][]byte + inline map[inlineID][]byte } -func (c *LayerContent) open(digest string) (io.ReadCloser, error) { - if b, ok := c.inline[digest]; ok { +// inlineID identifies content generated during planning by path and digest, +// so one path can have different generated content in each layer and a +// package file with the same bytes is still read from its own path. +type inlineID struct { + name, digest string +} + +func (c *LayerContent) open(e *PlanEntry) (io.ReadCloser, error) { + if b, ok := c.inline[inlineID{e.Header.Name, e.Digest}]; ok { return io.NopCloser(bytes.NewReader(b)), nil } - path, ok := c.paths[digest] - if !ok { - return nil, fmt.Errorf("no content for %s: %w", digest, fs.ErrNotExist) - } - f, err := c.fsys.Open(path) + f, err := c.fsys.Open(e.Header.Name) if err != nil { - return nil, fmt.Errorf("opening %s: %w", path, err) + return nil, fmt.Errorf("opening %s: %w", e.Header.Name, err) } return f, nil } @@ -175,7 +176,7 @@ if !hasContent(&hdr) { continue } - data, err := c.open(e.Digest) + data, err := c.open(e) if err != nil { return fmt.Errorf("%s: %w", hdr.Name, err) } @@ -218,20 +219,19 @@ type planner struct { plan *LayerPlan content *LayerContent - // files records entry indices and filesystem sources for digestFiles. + // files records entry indices and file info for digestFiles. files []plannedFile } // plannedFile is an entry with content from the build filesystem. type plannedFile struct { index int - path string info fs.FileInfo } func (pl *planner) add(f *file) error { if hasContent(f.header) { - pl.files = append(pl.files, plannedFile{index: len(pl.plan.entries), path: f.path, info: f.info}) + pl.files = append(pl.files, plannedFile{index: len(pl.plan.entries), info: f.info}) } pl.plan.entries = append(pl.plan.entries, PlanEntry{Header: *f.header}) return nil @@ -248,13 +248,13 @@ } d := h.String() pl.plan.entries = append(pl.plan.entries, PlanEntry{Header: *hdr, Digest: d}) - pl.content.inline[d] = data + pl.content.inline[inlineID{hdr.Name, d}] = data return nil } // planLayers walks fsys to plan one layer per group followed by the top layer. func planLayers(ctx context.Context, fsys apkfs.FullFS, groups []*group, pkgToDiff map[*apk.Package][]byte) ([]*LayerPlan, *LayerContent, error) { - content := &LayerContent{fsys: fsys, paths: map[string]string{}, inline: map[string][]byte{}} + content := &LayerContent{fsys: fsys, inline: map[inlineID][]byte{}} planners := make([]*planner, 0, len(groups)+1) sinks := make([]layerSink, 0, len(groups)+1) newPlanner := func(pkgs []*apk.Package) { @@ -269,7 +269,7 @@ if err := partitionLayers(ctx, fsys, groups, pkgToDiff, sinks); err != nil { return nil, nil, err } - if err := digestFiles(ctx, fsys, planners, content); err != nil { + if err := digestFiles(ctx, fsys, planners); err != nil { return nil, nil, err } plans := make([]*LayerPlan, len(planners)) @@ -280,9 +280,8 @@ } // digestFiles assigns content digests to planned files, processing each path -// once in parallel. It records the first planned path for each digest in -// content. -func digestFiles(ctx context.Context, fsys apkfs.FullFS, planners []*planner, content *LayerContent) error { +// once in parallel. +func digestFiles(ctx context.Context, fsys apkfs.FullFS, planners []*planner) error { var ( mu sync.Mutex digests = map[string]string{} @@ -292,17 +291,18 @@ queued := map[string]bool{} for _, pl := range planners { for _, f := range pl.files { - if queued[f.path] { + name := pl.plan.entries[f.index].Header.Name + if queued[name] { continue } - queued[f.path] = true + queued[name] = true g.Go(func() error { - d, err := fileDigest(gctx, fsys, f) + d, err := fileDigest(gctx, fsys, name, f.info) if err != nil { return err } mu.Lock() - digests[f.path] = d + digests[name] = d mu.Unlock() return nil }) @@ -313,40 +313,37 @@ } for _, pl := range planners { for _, f := range pl.files { - d := digests[f.path] - pl.plan.entries[f.index].Digest = d - if _, ok := content.paths[d]; !ok { - content.paths[d] = f.path - } + e := &pl.plan.entries[f.index] + e.Digest = digests[e.Header.Name] } pl.files = nil } return nil } -// fileDigest returns f's FileInfo.ContentDigest result if non-empty. -// Otherwise, it reads the file through fsys and returns its SHA-256 digest. -func fileDigest(ctx context.Context, fsys apkfs.FullFS, f plannedFile) (string, error) { +// fileDigest returns info's ContentDigest result if non-empty. +// Otherwise, it reads name through fsys and returns its SHA-256 digest. +func fileDigest(ctx context.Context, fsys apkfs.FullFS, name string, info fs.FileInfo) (string, error) { if err := ctx.Err(); err != nil { return "", err } - if cd, ok := f.info.(interface{ ContentDigest() (string, error) }); ok { + if cd, ok := info.(interface{ ContentDigest() (string, error) }); ok { d, err := cd.ContentDigest() if err != nil { - return "", fmt.Errorf("naming %s: %w", f.path, err) + return "", fmt.Errorf("naming %s: %w", name, err) } if d != "" { return d, nil } } - r, err := fsys.Open(f.path) + r, err := fsys.Open(name) if err != nil { - return "", fmt.Errorf("opening %s: %w", f.path, err) + return "", fmt.Errorf("opening %s: %w", name, err) } defer r.Close() h, _, err := v1.SHA256(r) if err != nil { - return "", fmt.Errorf("hashing %s: %w", f.path, err) + return "", fmt.Errorf("hashing %s: %w", name, err) } return h.String(), nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/pkg/build/layer_plan_test.go new/apko-1.5.2/pkg/build/layer_plan_test.go --- old/apko-1.5.1/pkg/build/layer_plan_test.go 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/pkg/build/layer_plan_test.go 2026-11-20 17:44:31.000000000 +0100 @@ -339,6 +339,30 @@ } } +// TestRenderReadsEachPath checks that Render reads each file from its own +// path. Every package file reports the same digest, so the digest alone +// cannot tell the files apart, and Render still matches BuildLayers. +func TestRenderReadsEachPath(t *testing.T) { + same := func(string, []byte) string { return "test:same" } + want, err := newContext(t, same).BuildLayers(t.Context()) + if err != nil { + t.Fatal(err) + } + plans, content := planLayers(t, newContext(t, same)) + if len(plans) != len(want) { + t.Fatalf("planned %d layers, BuildLayers wrote %d", len(plans), len(want)) + } + for i, p := range plans { + wantDigest, err := want[i].Digest() + if err != nil { + t.Fatal(err) + } + if _, d := render(t, p, content); d.Digest != wantDigest { + t.Errorf("layer %d: Render digest = %s, want %s", i, d.Digest, wantDigest) + } + } +} + func planDigests(t *testing.T, plans []*build.LayerPlan) [][sha256.Size]byte { t.Helper() out := make([][sha256.Size]byte, 0, len(plans)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/pkg/cpio/layer.go new/apko-1.5.2/pkg/cpio/layer.go --- old/apko-1.5.1/pkg/cpio/layer.go 2026-11-12 23:19:11.000000000 +0100 +++ new/apko-1.5.2/pkg/cpio/layer.go 2026-11-20 17:44:31.000000000 +0100 @@ -19,6 +19,7 @@ "bytes" "fmt" "io" + "math" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/u-root/u-root/pkg/cpio" @@ -42,6 +43,31 @@ return w.WriteRecord(cpio.TrailerRecord) } +// preserveOwnership copies numeric UID/GID from a TAR header onto a CPIO +// record. newc stores ownership in 32-bit fields, so values outside that +// range are rejected rather than truncated. +func preserveOwnership(rec cpio.Record, hdr *tar.Header) (cpio.Record, error) { + if hdr.Uid < 0 || hdr.Gid < 0 { + return cpio.Record{}, fmt.Errorf("negative uid/gid on %q: %d:%d", + hdr.Name, hdr.Uid, hdr.Gid) + } + if uint64(hdr.Uid) > math.MaxUint32 || uint64(hdr.Gid) > math.MaxUint32 { + return cpio.Record{}, fmt.Errorf("uid/gid outside newc range on %q: %d:%d", + hdr.Name, hdr.Uid, hdr.Gid) + } + rec.UID = uint64(hdr.Uid) + rec.GID = uint64(hdr.Gid) + return rec, nil +} + +func writeRecord(w cpio.RecordWriter, rec cpio.Record, hdr *tar.Header) error { + rec, err := preserveOwnership(rec, hdr) + if err != nil { + return err + } + return cpio.WriteRecordsAndDirs(w, []cpio.Record{rec}) +} + // recordsFromLayer reads tar entries from a layer and writes them as CPIO records. func recordsFromLayer(layer v1.Layer, w cpio.RecordWriter) error { // Open the filesystem layer to walk through the file. @@ -67,16 +93,12 @@ // Determine CPIO file mode based on TAR typeflag switch header.Typeflag { case tar.TypeDir: - if err := cpio.WriteRecordsAndDirs(w, []cpio.Record{ - cpio.Directory(header.Name, uint64(header.Mode)), - }); err != nil { + if err := writeRecord(w, cpio.Directory(header.Name, uint64(header.Mode)), header); err != nil { return err } case tar.TypeSymlink: - if err := cpio.WriteRecordsAndDirs(w, []cpio.Record{ - cpio.Symlink(header.Name, header.Linkname), - }); err != nil { + if err := writeRecord(w, cpio.Symlink(header.Name, header.Linkname), header); err != nil { return err } @@ -92,16 +114,12 @@ return err } - if err := cpio.WriteRecordsAndDirs(w, []cpio.Record{ - cpio.StaticFile(header.Name, original.String(), uint64(header.Mode)), - }); err != nil { + if err := writeRecord(w, cpio.StaticFile(header.Name, original.String(), uint64(header.Mode)), header); err != nil { return err } case tar.TypeChar: - if err := cpio.WriteRecordsAndDirs(w, []cpio.Record{ - cpio.CharDev(header.Name, uint64(header.Mode), uint64(header.Devmajor), uint64(header.Devminor)), - }); err != nil { + if err := writeRecord(w, cpio.CharDev(header.Name, uint64(header.Mode), uint64(header.Devmajor), uint64(header.Devminor)), header); err != nil { return err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apko-1.5.1/pkg/cpio/layer_test.go new/apko-1.5.2/pkg/cpio/layer_test.go --- old/apko-1.5.1/pkg/cpio/layer_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/apko-1.5.2/pkg/cpio/layer_test.go 2026-11-20 17:44:31.000000000 +0100 @@ -0,0 +1,181 @@ +// Copyright 2026 Chainguard, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cpio + +import ( + "archive/tar" + "bytes" + "errors" + "io" + "math" + "strings" + "testing" + + "github.com/google/go-containerregistry/pkg/v1/static" + v1types "github.com/google/go-containerregistry/pkg/v1/types" + urootcpio "github.com/u-root/u-root/pkg/cpio" +) + +func TestFromLayerPreservesUIDGID(t *testing.T) { + const uid, gid = 10001, 10002 + + var input bytes.Buffer + tw := tar.NewWriter(&input) + headers := []*tar.Header{ + { + Name: "srv/state/", + Typeflag: tar.TypeDir, + Mode: 0o750, + Uid: uid, + Gid: gid, + }, + { + Name: "srv/state/config", + Typeflag: tar.TypeReg, + Mode: 0o640, + Uid: uid, + Gid: gid, + Size: 4, + }, + { + Name: "srv/state/link", + Typeflag: tar.TypeSymlink, + Linkname: "config", + Mode: 0o777, + Uid: uid, + Gid: gid, + }, + { + Name: "dev/nullish", + Typeflag: tar.TypeChar, + Mode: 0o666, + Uid: uid, + Gid: gid, + Devmajor: 1, + Devminor: 3, + }, + { + Name: "root-owned", + Typeflag: tar.TypeReg, + Mode: 0o644, + Uid: 0, + Gid: 0, + Size: 3, + }, + } + for _, hdr := range headers { + if err := tw.WriteHeader(hdr); err != nil { + t.Fatal(err) + } + if hdr.Typeflag == tar.TypeReg { + payload := "data" + if hdr.Name == "root-owned" { + payload = "own" + } + if _, err := tw.Write([]byte(payload)); err != nil { + t.Fatal(err) + } + } + } + if err := tw.Close(); err != nil { + t.Fatal(err) + } + + layer := static.NewLayer(input.Bytes(), v1types.OCIUncompressedLayer) + var output bytes.Buffer + if err := FromLayer(layer, &output); err != nil { + t.Fatal(err) + } + + reader := urootcpio.Newc.Reader(bytes.NewReader(output.Bytes())) + want := map[string][2]uint64{ + "srv/state": {uid, gid}, + "srv/state/config": {uid, gid}, + "srv/state/link": {uid, gid}, + "dev/nullish": {uid, gid}, + "root-owned": {0, 0}, + } + seen := make(map[string]bool, len(want)) + for { + rec, err := reader.ReadRecord() + if errors.Is(err, io.EOF) { + break + } + if err != nil { + t.Fatal(err) + } + expected, ok := want[rec.Name] + if !ok { + continue + } + seen[rec.Name] = true + if rec.UID != expected[0] || rec.GID != expected[1] { + t.Errorf("%s: got uid:gid %d:%d; want %d:%d", + rec.Name, rec.UID, rec.GID, expected[0], expected[1]) + } + } + for path := range want { + if !seen[path] { + t.Errorf("missing output CPIO entry %q", path) + } + } +} + +func TestFromLayerRejectsInvalidOwnership(t *testing.T) { + tests := []struct { + name string + uid int + gid int + want string + }{ + {name: "negative uid", uid: -1, gid: 100, want: "negative uid/gid"}, + {name: "negative gid", uid: 100, gid: -1, want: "negative uid/gid"}, + {name: "uid past newc", uid: math.MaxUint32 + 1, gid: 1, want: "outside newc range"}, + {name: "gid past newc", uid: 1, gid: math.MaxUint32 + 1, want: "outside newc range"}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var input bytes.Buffer + tw := tar.NewWriter(&input) + hdr := &tar.Header{ + Name: "bad-owner", + Typeflag: tar.TypeReg, + Mode: 0o644, + Uid: tt.uid, + Gid: tt.gid, + Size: 1, + } + if err := tw.WriteHeader(hdr); err != nil { + t.Fatal(err) + } + if _, err := tw.Write([]byte("x")); err != nil { + t.Fatal(err) + } + if err := tw.Close(); err != nil { + t.Fatal(err) + } + + layer := static.NewLayer(input.Bytes(), v1types.OCIUncompressedLayer) + err := FromLayer(layer, io.Discard) + if err == nil { + t.Fatal("expected error, got nil") + } + if !strings.Contains(err.Error(), tt.want) { + t.Fatalf("got error %q; want substring %q", err.Error(), tt.want) + } + }) + } +} ++++++ apko.obsinfo ++++++ --- /var/tmp/diff_new_pack.t7OFFh/_old 2026-11-23 12:31:57.820323659 +0100 +++ /var/tmp/diff_new_pack.t7OFFh/_new 2026-11-23 12:31:57.825323870 +0100 @@ -1,5 +1,5 @@ name: apko -version: 1.5.1 -mtime: 1794521951 -commit: 2af887e71025923c2c9db14cfa3d0be35946bd1d +version: 1.5.2 +mtime: 1795193071 +commit: ac841bac3ef36d4523ca80ec4182bbafcb32eba7 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/apko/vendor.tar.gz /work/SRC/openSUSE:Factory/.apko.new.1340718/vendor.tar.gz differ: char 133, line 1
