Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple file output does not work with symlinks #621

Open
pauloborges opened this issue Aug 8, 2024 · 0 comments
Open

Multiple file output does not work with symlinks #621

pauloborges opened this issue Aug 8, 2024 · 0 comments

Comments

@pauloborges
Copy link

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:

val resolvedPath = outputDir.resolve(pathSpec).normalize()
val realPath = if (resolvedPath.exists()) resolvedPath.toRealPath() else resolvedPath
if (!realPath.startsWith(outputDir)) {
throw CliException(
"Output file conflict: `output.files` entry `\"$pathSpec\"` in module `$moduleUri` resolves to file path `$realPath`, which is outside output directory `$outputDir`."
)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant