`mode` of a generated directory is random when it has a generated child
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 80/100
Hướng nghiên cứu
Đọc internal/slicer/slicer.go quanh vòng lặp relPaths và internal/fsutil/create.go quanh createDir. Tái hiện chế độ thư mục xảy ra không thường xuyên bằng ví dụ YAML, sau đó kiểm tra cách các đường dẫn được tạo ra và sắp xếp. Hoàn thành khi các lần cắt lặp lại luôn áp dụng chế độ được yêu cầu cho /dir/, kể cả khi có một phần tử con được tạo ra.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
the mode listed for a make: true directory is applied on some cuts and not on others, when something else generated lands under that directory. same release, same archive, same slice, different rootfs.
# test-package.yaml
package: test-package
slices:
myslice:
contents:
/dir/: {make: true, mode: 0700}
/dir/file: {text: data}
generated content is created by ranging over a map (relPaths in internal/slicer/slicer.go), so the order differs from run to run. when /dir/file comes first, fsutil.Create makes its parent with the default 0755 (MakeParents: true). when /dir/ then gets its turn, createDir in internal/fsutil/create.go sees os.IsExist and returns without touching the mode. it's the same map order that makes the generated case in #332 come and go.
this is live in chisel-releases. python3.14-minimal_bins on ubuntu-26.04 lists both /usr/local/lib/python3.14/ and /usr/local/lib/python3.14/dist-packages/ as {make: true, mode: 02775}:
$ git clone -q --depth 1 -b ubuntu-26.04 https://github.com/canonical/chisel-releases
$ for i in $(seq 10); do
rm -rf ./rootfs && mkdir ./rootfs
chisel cut --release ./chisel-releases --arch amd64 --root ./rootfs python3.14-minimal_bins 2> /dev/null
stat -c '%a' ./rootfs/usr/local/lib/python3.14
done | sort | uniq -c
1 755
9 775
repro
a minimal one using chisel-proxy:
$ alias chisel-proxy='go run github.com/lczyk/chisel-proxy/cmd/[email protected]'
$ mkdir -p test-package/usr/share/doc/test-package
$ echo readme > test-package/usr/share/doc/test-package/README
$ for i in $(seq 10); do
rm -rf ./rootfs && mkdir ./rootfs
chisel-proxy cut --arch amd64 ./test-package ./test-package.yaml \
-- --root ./rootfs test-package_myslice > /dev/null 2>&1
stat -c '%a' ./rootfs/dir
done | sort | uniq -c
7 700
3 755
obv a bit random, go's map order is not an even shuffle.
a child copied from the deb in place of the generated one (/dir/file: with /dir/file in the package) is not random, but the listed mode never applies: 4 cuts out of 4 gave 755, since extraction always runs first.
proposal
sort the paths before creating them, so a directory is always made before what goes in it:
for _, relPath := range slices.Sorted(maps.Keys(relPaths)) {
slices := relPaths[relPath]
with that, all ten cuts print 700.
- Ngôn ngữ chính
- Go
- Star
- 434
- Fork
- 74
- Merge trung bình
- 1 ngày 30 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không 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 canonical/chisel
-
cut fails on uncompressed debCó thể đã có người làm @yuminn-k đã nhận 29 ngày trước. Đang mởBug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
-
`prefer` drops a path when the preferred package lists it `until: mutate`Có thể đã có người làm @18Abhinav07 đã nhận 8 ngày trước. Đang mởBug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của canonical/chisel
Issue tương tự
-
mcpx scan: flag unsafe tool namesCó thể đã có người làm @zeyadbadawyy đã nhận hôm nay. Đang mởarea/scan enhancement good first issue priority/medium size/small
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rohitgollarahalli/mcpx#45 · 1 bình luận · 1 người được giao ·
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 68/100
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Windows 主机
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Lee-xeo/Claude-Cage#1550 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
(bug) ui: spanPaint can index spans past their end (panic: index out of range)Có thể đã có người làm @MaxMiksa đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày