-
Notifications
You must be signed in to change notification settings - Fork 411
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
'import' relative path issue when run symbol linked self-executbale justfile #1977
Comments
I tried using a symlinked import source file, and I was able to get it to work:
Can you provide steps to reproduce the issue you're getting? |
Yes, here is the steps for reproducing this issue (make sure you use bash or bash-compatible shells. cd /tmp
mkdir ./issue-reproduce
cd ./issue-reproduce/
# write justfile
cat > justfile << EOF
#!/usr/bin/env -S just --working-directory . --justfile
pwd:
pwd
import 'foo.just'
EOF
chmod +x ./justfile
# write foo.just
cat > foo.just << EOF
foo:
pwd
EOF Then cd .. # go back to /tmp
ln -s /tmp/issue-reproduce/justfile ./justfile
./justfile Finally we can see the error: ❯ ./justfile
error: Could not find source file for import.
——▶ justfile:5:8
│
5 │ import 'foo.just'
│ ^^^^^^^^^^ |
Ahh gotcha, I see the issue. This could be fixed by interpreting imports relative to the canonicalized path to the current justfile, since canonicalization resolves symlinks. However, I worry that this would be somewhat unexpected behavior. I.e., if you didn't want this behavior, and you had a justfile which was symlinked from somewhere else, you would get a pretty confusing error. I could see enabling this with a setting. |
I have these content in my justfile:
I can run the file normally. However, when I symbol linked file (for example
ln -sf
) and run the symbol link, it promptserror: Could not find source file for import.
. (Note the symbol link is at the different directory than targeted justfile)The text was updated successfully, but these errors were encountered: