pkl
pkl copied to clipboard
Multiple file output does not work with symlinks
Using a regular output directory:
$ pkl eval -m output birds.pkl
output/birds/pigeon.json
output/birds/parrot.yaml
$ pkl eval -m output birds.pkl
output/birds/pigeon.json
output/birds/parrot.yaml
birds.pkl
has the same content as the example in the documentation.
Using a symlink:
$ DIR=$(mktemp -d)
$ pkl eval -m $DIR birds.pkl
../../../../../var/folders/p2/m6p8_spd68j2jbdnzwxxrvgr0000gn/T/tmp.ZMUU0W8BMv/birds/pigeon.json
../../../../../var/folders/p2/m6p8_spd68j2jbdnzwxxrvgr0000gn/T/tmp.ZMUU0W8BMv/birds/parrot.yaml
$ pkl eval -m $DIR birds.pkl
Output file conflict: `output.files` entry `"birds/pigeon.json"` in module `file:///[redacted]/birds.pkl` resolves to file path `/private/var/folders/p2/m6p8_spd68j2jbdnzwxxrvgr0000gn/T/tmp.ZMUU0W8BMv/birds/pigeon.json`, which is outside output directory `/var/folders/p2/m6p8_spd68j2jbdnzwxxrvgr0000gn/T/tmp.ZMUU0W8BMv`.
macOS symlinks /var
to /private/var
.
The related code path is the following:
https://github.com/apple/pkl/blob/8e15556201625bc1d37bb47666dbe225c7d3ebd9/pkl-cli/src/main/kotlin/org/pkl/cli/CliEvaluator.kt#L221-L227