`mode` of a generated directory is random when it has a generated child
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 80/100
Direzione di ricerca
Leggi internal/slicer/slicer.go intorno all’iterazione di relPaths e internal/fsutil/create.go intorno a createDir. Riproduci la modalità di directory intermittente con l’esempio YAML, poi esamina come vengono creati e ordinati i percorsi generati. Il lavoro è completato quando tagli ripetuti applicano in modo coerente la modalità richiesta a /dir/, anche quando è presente un elemento figlio generato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 434
- Fork
- 74
- Merge medio
- 1g 30m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di canonical/chisel
-
cut fails on uncompressed debForse già presa @yuminn-k l’ha presa 29 giorni fa. ApertaBug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 42/100
-
`prefer` drops a path when the preferred package lists it `until: mutate`Forse già presa @18Abhinav07 l’ha presa 8 giorni fa. ApertaBug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di canonical/chisel
Issue simili
-
mcpx scan: flag unsafe tool namesForse già presa @zeyadbadawyy l’ha presa oggi. Apertaarea/scan enhancement good first issue priority/medium size/small
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rohitgollarahalli/mcpx#45 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Windows 主机
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Lee-xeo/Claude-Cage#1550 ·
I maintainer di solito rispondono entro 1 giorno
-
(bug) ui: spanPaint can index spans past their end (panic: index out of range)Forse già presa @MaxMiksa l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno