[Bug]: `ImageStore.load` fails with "item with the same name already exists" when two index descriptors reach a blob already in the content store
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- docker, swift
調査の方向性
Start in ImageStore.load(from:) in ImageStore+OCILayout.swift (lines 74-109), which runs one ImportOperation per index.json descriptor into a shared ingest directory. The copy that fails is in ImportOperation.fetch in ImageStore+Import.swift (around lines 185-196). Reproduce with an archive that has two descriptors sharing one digest, then check that the load succeeds and both names are present.
索引モデルが issue の本文から書いたものです。
説明
I have done the following
- I have searched the existing issues
- If possible, I've reproduced the issue using the 'main' branch of this project
Not built from main, but ImageStore+OCILayout.swift and ImageStore+Import.swift on main (706cb51) are unchanged since 0.54.0.
Steps to reproduce
With container 1.7.1 (containerization 0.54.0):
container image pull alpine:3.22
container image tag alpine:3.22 repro:a
container image tag alpine:3.22 repro:b
container image save repro:a repro:b -o repro.tar
container image load -i repro.tar
repro.tar's index.json has two descriptors with the same digest, one per name:
sha256:49340b346798… docker.io/library/repro:a
sha256:49340b346798… docker.io/library/repro:b
Current behavior
Error: Error Domain=NSCocoaErrorDomain Code=516 "“49340b346798875b5592e5d420241f2f9cfba5f47e62ebb1446a1b34734e898f” couldn’t be copied to “180743FD-86FE-4424-B329-87ED09331F2B” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=~/Library/Application Support/com.apple.container/content/blobs/sha256/49340b346798875b5592e5d420241f2f9cfba5f47e62ebb1446a1b34734e898f, NSUserStringVariant=(
Copy
), NSDestinationFilePath=~/Library/Application Support/com.apple.container/content/ingest/180743FD-86FE-4424-B329-87ED09331F2B/49340b346798875b5592e5d420241f2f9cfba5f47e62ebb1446a1b34734e898f, NSFilePath=~/Library/Application Support/com.apple.container/content/blobs/sha256/49340b346798875b5592e5d420241f2f9cfba5f47e62ebb1446a1b34734e898f, NSURL=file:///~/Library/Application%20Support/com.apple.container/content/blobs/sha256/49340b346798875b5592e5d420241f2f9cfba5f47e62ebb1446a1b34734e898f, NSUnderlyingError=0x75190bdec0 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
container image save repro:a -o single.tar followed by container image load -i single.tar (one descriptor) succeeds.
Expected behavior
Both names load, as docker load does for the same archive.
Cause
ImageStore.load(from:) (ImageStore+OCILayout.swift, lines 74-109) opens one ingest session and runs an ImportOperation for every descriptor of index.json into the same ingest directory. ImportOperation.fetch (ImageStore+Import.swift, around lines 185-196) copies a blob the content store already has into that directory with FileManager.copyItem. When an earlier descriptor in the same load has already copied that blob, the copy fails with EEXIST.
So any multi-descriptor index whose descriptors share a stored blob fails, including:
container image saveof two tags of one image, as above;docker saveof several tags from Docker 25+, which writes one descriptor per tag (Mobyimage/tarexport/save.go);- BuildKit's OCI/Docker exporter with several names (
exporter/oci/export.go→ containerdarchive.WithManifest(desc, names...), one descriptor per name); - several images that share a base layer that is already stored.
A possible fix is to skip the copy when the destination already exists in the ingest directory, since the content is identical by digest.
Environment
- OS: macOS 27.2.1 (Apple Silicon)
- Xcode: 27.2
- Container: 1.7.1 (build: release, commit: a15b460), containerization 0.54.0
Code of Conduct
- I agree to follow this project's Code of Conduct
- 主要言語
- Swift
- スター
- 9k
- フォーク
- 412
- 平均マージ
- 3日 10時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apple/containerization のほかの issue
-
[Bug]: RegistryClient ignores credentials in HTTPS_PROXY, so image pulls fail with proxyAuthenticationRequired対応中かも @vishalhabib99 が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apple/containerization#1012 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: archive ownership changes clear set-ID permission bits対応中かも @maksim-romanov が 100 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apple/containerization#819 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: archive extraction strips special permission bits対応中かも @maksim-romanov が 100 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apple/containerization#818 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
LinuxContainer.create() leaks the VZ VM/XPC process when vm.start() throws — no do/catch around it対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apple/containerization#804 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: TimeSyncer steps the guest clock backward every 30 s, and the first sync steps it by up to ±0.5 s対応中かも @castlemilk が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 46/100
apple/containerization#1019 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
apple/containerization の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
fxios-coreexperience
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mozilla-mobile/firefox-ios#36661 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
manaflow-ai/cmux#45713 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Save the clothespinsオープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
alejandrobujan/tendedero#151 ·
メンテナーはふだん 2 日以内に返信