Multiple file output does not work with symlinks #196

Open
opened 2025-12-30 01:22:02 +01:00 by adam · 0 comments
Owner

Originally created by @pauloborges on GitHub (Aug 8, 2024).

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:

8e15556201/pkl-cli/src/main/kotlin/org/pkl/cli/CliEvaluator.kt (L221-L227)

Originally created by @pauloborges on GitHub (Aug 8, 2024). Using a regular output directory: ```shell $ 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](https://pkl-lang.org/main/current/language-reference/index.html#multiple-file-output). 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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#196