canonical / canonical/chisel

Cannot create empty file (for mutable)

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
424
Forks
65
Avg merge
12d 19h
Merged PRs (30d)
1

Description

In order to write a file, it has to be listed in `contents` as `mutable`. However, if the file doesn't exist in package archive, it has to be created with non-empty text, otherwise chisel fails with `no content` error.

Demonstration:

```
$ cat slices/ca-certificates.yaml
package: ca-certificates
slices:
data:
contents:
/etc/ssl/certs/ca-certificates.crt: { text: "", mutable: true }
mutate: |
content.write("/etc/ssl/certs/ca-certificates.crt", "foobar")
$ chisel cut --release $PWD --root ~/tmp/chisel-out ca-certificates_data
...
2022/06/10 09:07:38 Extracting files from package "ca-certificates"...
error: cannot extract from package "ca-certificates": no content at /etc/ssl/certs/ca-certificates.crt
```

It works when I explicitly set file text to non-empty value, e.g.:

```
$ cat slices/ca-certificates.yaml
package: ca-certificates
slices:
data:
contents:
/etc/ssl/certs/ca-certificates.crt: { text: "todo", mutable: true }
mutate: |
content.write("/etc/ssl/certs/ca-certificates.crt", "foobar")
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.