Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-3526

oc fails to extract layers that set xattr on Darwin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • 4.13, 4.12, 4.11
    • oc
    • None
    • Moderate
    • None
    • False
    • Hide

      None

      Show
      None
    • N/A
    • Bug Fix
    • Done

      Description of problem:

      $ RELEASE_VERSION=4.10.37
      $ RELEASE_FOLDER=/tmp/release
      $ oc image extract quay.io/openshift-release-dev/ocp-release:${RELEASE_VERSION}-x86_64 --path /:${RELEASE_FOLDER} --confirm
      error: unable to extract layer sha256:213de71dc0c6c48e5d312a10913b966b471faa62153ba2bfcaaf5133101245f5 from quay.io/openshift-release-dev/ocp-release:4.10.37-x86_64: platform and architecture is not supported
      

      Version-Release number of selected component (if applicable):

      oc 4.11.13. Likely other versions too.

      How reproducible:

      100%

      Steps to Reproduce:

      1. Get a Darwin box.
      2. Run the earlier commands.

      Actual results:

      platform and architecture is not supported

      Expected results:

      Successful extraction.

      Additional info:

      • xattr extraction uses Lsetxattr.
      • On unsupported systems (apparently including Darwin), that can return ErrNotSupportedPlatform, which is the platform and architecture is not supported string.
      • A later LUtimesNano call has an explicit err != system.ErrNotSupportedPlatform guard. We probably want a similar guard around Lsetxattr.
      • And to make debugging easier, we probably want more error-wrapping so it's easier to see that it was xattr that were the issue.

      Pinning down the xattr-ness, this issue also crops up with the 4.11.13 oc attempting to extract 4.11.9, but not when extracting 4.11.8. Checking that third layer:

      $ oc image info -o json quay.io/openshift-release-dev/ocp-release:4.11.9-x86_64 | jq -c '.layers[]'
      {"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":79524639,"digest":"sha256:97da74cc6d8fa5d1634eb1760fd1da5c6048619c264c23e62d75f3bf6b8ef5c4"}
      {"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":1438,"digest":"sha256:d8190195889efb5333eeec18af9b6c82313edd4db62989bd3a357caca4f13f0e"}
      {"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":7273592,"digest":"sha256:a8765b0d2a13463f645e86802a0db82527462d13010d93ed87f01355e1dd3c56"}
      {"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":11913477,"digest":"sha256:371af7f94164b983de702832af58d083abd01f9ffc3b8255e33a5744fb6762b6"}
      {"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":25451521,"digest":"sha256:e834da016fb2cc8f360260f04309273aa5cd530944a3b24280874dbf128e64e9"}
      {"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":877877,"digest":"sha256:ad7878eb40a1ff52b2be26dcdc9bca1850fdfc71cdea20bf29aef1d4931fdc1b"}
      $ mkdir /tmp/release
      $ oc --v=8 image extract 'quay.io/openshift-release-dev/ocp-release:4.11.9-x86_64[2]' --path /:/tmp/release
      ...
      I1110 22:17:06.995981    9432 round_trippers.go:463] GET https://cdn02.quay.io/sha256/a8/a8765b0d2a13463f645e86802a0db82527462d13010d93ed87f01355e1dd3c56?...
      ...
      $ curl -s 'https://cdn02.quay.io/sha256/a8/a8765b0d2a13463f645e86802a0db82527462d13010d93ed87f01355e1dd3c56?...' >layer.tar.gz
      $ sha256sum layer.tar.gz 
      a8765b0d2a13463f645e86802a0db82527462d13010d93ed87f01355e1dd3c56  layer.tar.gz
      $ cat main.go 
      package main
      
      import (
              "archive/tar"
              "fmt"
              "io"
              "log"
              "os"
      )
      
      func main() {
              tr := tar.NewReader(os.Stdin)
              for {
                      hdr, err := tr.Next()
                      if err == io.EOF {
                              break // End of archive
                      }
                      if err != nil {
                              log.Fatal(err)
                      }
                      if len(hdr.Xattrs) > 0 {
                              fmt.Printf("%s: %v\n", hdr.Name, hdr.Xattrs)
                      }
              }
      }
      $ zcat layer.tar.gz | go run main.go
      etc/: map[user.overlay.impure:y]
      etc/dnf/: map[user.overlay.impure:y]
      root/: map[user.overlay.impure:y]
      root/buildinfo/: map[user.overlay.impure:y]
      usr/: map[user.overlay.impure:y]
      usr/share/: map[user.overlay.impure:y]
      usr/share/licenses/: map[user.overlay.impure:y]
      usr/share/zoneinfo/: map[user.overlay.impure:y]
      usr/share/zoneinfo/America/: map[user.overlay.impure:y]
      usr/share/zoneinfo/posix/: map[user.overlay.impure:y]
      usr/share/zoneinfo/posix/America/: map[user.overlay.impure:y]
      usr/share/zoneinfo/right/: map[user.overlay.impure:y]
      usr/share/zoneinfo/right/America/: map[user.overlay.impure:y]
      var/: map[user.overlay.impure:y]
      var/cache/dnf/rhel-8-appstream-rpms-aarch64-f4aa537d908d9fc4/repodata/cf0ed8b0-5d9d-4ce4-a514-d0919c8f9d90: map[user.Librepo.checksum.mtime:1665052295 user.Librepo.checksum.sha256:f31afeb2083e829831737e1976118486f181824396bb1dfa345ce837cfcd01db]
      var/cache/dnf/rhel-8-appstream-rpms-ppc64le-e6d00b111ed689e4/repodata/8805d47b-954c-4b0c-bd87-9cd232cae31e: map[user.Librepo.checksum.mtime:1665052278 user.Librepo.checksum.sha256:c207283703ed0689b7df803d2c7567d4f04bebc1056175403d6de005c7afa831]
      var/cache/dnf/rhel-8-appstream-rpms-s390x-440fe0b9951ab5ff/repodata/757936f1-08fa-4581-921a-3533f5f1ba22: map[user.Librepo.checksum.mtime:1665052286 user.Librepo.checksum.sha256:29e73b7588342db7b5cc8734d3261d922569bbe123492d9cb5e71ef41a7f5199]
      var/cache/dnf/rhel-8-appstream-rpms-x86_64-2eb21a16222429e8/repodata/c281b795-db8a-40e4-bb51-f5823d0a0d4e: map[user.Librepo.checksum.mtime:1665052267 user.Librepo.checksum.sha256:4cdbec83cf275d0dff9ed9c139759937d51cc7be757f3703c9e41f3544489920]
      var/cache/dnf/rhel-8-baseos-rpms-aarch64-cab14abc0aecab14/repodata/a9473675-b6c9-457e-8af7-d9991b7d671c: map[user.Librepo.checksum.mtime:1665052335 user.Librepo.checksum.sha256:f31afeb2083e829831737e1976118486f181824396bb1dfa345ce837cfcd01db]
      var/cache/dnf/rhel-8-baseos-rpms-ppc64le-a9d8a6aec787f57a/repodata/3100b901-7431-460f-8bc8-1407f9939106: map[user.Librepo.checksum.mtime:1665052315 user.Librepo.checksum.sha256:c207283703ed0689b7df803d2c7567d4f04bebc1056175403d6de005c7afa831]
      var/cache/dnf/rhel-8-baseos-rpms-s390x-0afe0eabb7bfab81/repodata/e32dfd89-51f1-418b-a2c7-da8f2a144e9f: map[user.Librepo.checksum.mtime:1665052326 user.Librepo.checksum.sha256:29e73b7588342db7b5cc8734d3261d922569bbe123492d9cb5e71ef41a7f5199]
      var/cache/dnf/rhel-8-baseos-rpms-x86_64-fc3934b38ea47b54/repodata/86fa7d79-ca60-420a-a4a2-7899b9b9a9e9: map[user.Librepo.checksum.mtime:1665052304 user.Librepo.checksum.sha256:4cdbec83cf275d0dff9ed9c139759937d51cc7be757f3703c9e41f3544489920]
      var/lib/: map[user.overlay.impure:y]
      var/lib/rhsm/: map[user.overlay.impure:y]
      var/lib/rpm/: map[user.overlay.impure:y]
      var/log/: map[user.overlay.impure:y]
      

      But looking at the third layer in 4.11.8, there were no xattr.

              aguclu@redhat.com Arda Guclu
              trking W. Trevor King
              ying zhou ying zhou
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: