bug(tasks): cache glob doesn't work with relative paths pointing out of workspace
Checks
-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible example
[tasks]
cmd = "mkdir -p ../folder_a && echo Hello >> ../folder_a/a.txt"
outputs = ["../folder_a/a.txt"]
pixi --version
0.39.4
Issue description
Following the same example given in #1237 Not sure if expected, but the glob doesn't work if the folder is out of the project:
[tasks]
cmd = "mkdir -p ../folder_a && echo Hello >> ../folder_a/a.txt"
outputs = ["../folder_a/a.txt"]
✨ Pixi task (start in cxx): mkdir -p ../folder_a && echo Hello >> ../folder_a/a.txt
WARN No files matched the output globs for task` 'start'
WARN Output globs: ["../folder_a/a.txt"]
But the folder is indeed there:
ls ../folder_a
a.txt
These out of source folders are specially useful for CMake projects, where the build folder is strongly recommended to not be nested with the source (project) folder.
Something odd with the glob:
These two give different results:
This works ✅
[tasks]
cmd = "mkdir -p folder_a && echo Hello >> folder_a/a.txt"
outputs = ["folder_a/a.txt"]
This doesn't ❌
[tasks]
cmd = "mkdir -p folder_a && echo Hello >> folder_a/a.txt"
outputs = ["./folder_a/a.txt"]
Expected behavior
I expect that the glob works with relative paths:
[tasks]
cmd = "mkdir -p ../folder_a && echo Hello >> ../folder_a/a.txt"
outputs = ["../folder_a/a.txt"]
@nichmor is this also fixed with your latest PR that made changes to the GlobHashCache?
@nichmor is this also fixed with your latest PR that made changes to the GlobHashCache?
I'm not sure without testing it ( but I'm inclined to say that no )
Is there a way I can help? The current broken behavior is a bit surprising, and I don't think it should be a huge fix. Relative globs don't work, can we workaround somehow? if the glob is relative... do something else?
hey @phcerdan ! Sorry for such a long reply time - I will take a look tomorrow at this as I've touched something similar and will let you know
hey @phcerdan ! I've checked the issue on the pixi 0.54.2 with this example:
[workspace]
authors = ["nichmor <[email protected]>"]
channels = ["conda-forge"]
name = "relative-paths-tasks"
platforms = ["osx-arm64"]
version = "0.1.0"
[tasks.jora]
cmd = "mkdir -p ../folder_a && echo Hello >> ../folder_a/a.txt"
outputs = ["../folder_a/a.txt"]
[dependencies]
And I can confirm that running it twice indeed caches it:
graf@Nichitas-MacBook-Pro relative-paths-tasks % pixi run jora
✨ Pixi task (jora): mkdir -p ../folder_a && echo Hello >> ../folder_a/a.txt Task 'jora' can be skipped (cache hit) 🚀
Could you please check on your side? If it works, then we can happily close it
Closing, feel free to re-open it case it doesn't work on your side