[Bug]: `ImageStore.load` fails with "item with the same name already exists" when two index descriptors reach a blob already in the content store
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- docker, swift
- Lĩnh vực
- infrastructure
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Swift
- Star
- 9k
- Fork
- 412
- Merge trung bình
- 3 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apple/containerization
-
[Bug]: RegistryClient ignores credentials in HTTPS_PROXY, so image pulls fail with proxyAuthenticationRequiredCó thể đã có người làm @vishalhabib99 đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apple/containerization#1012 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: archive ownership changes clear set-ID permission bitsCó thể đã có người làm @maksim-romanov đã nhận 100 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apple/containerization#819 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: archive extraction strips special permission bitsCó thể đã có người làm @maksim-romanov đã nhận 100 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apple/containerization#818 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
LinuxContainer.create() leaks the VZ VM/XPC process when vm.start() throws — no do/catch around itCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apple/containerization#804 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: TimeSyncer steps the guest clock backward every 30 s, and the first sync steps it by up to ±0.5 sCó thể đã có người làm @castlemilk đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 46/100
apple/containerization#1019 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của apple/containerization
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Switch to new string APIĐang mởfxios-coreexperience
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
mozilla-mobile/firefox-ios#36661 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
manaflow-ai/cmux#45713 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Save the clothespinsĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
alejandrobujan/tendedero#151 ·
Maintainer thường phản hồi trong vòng 2 ngày