-
Notifications
You must be signed in to change notification settings - Fork 72
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
resolve TempDir paths before passing them to the flake bin #233
Conversation
Regarding the CI test failures: These are also present on |
@@ -51,7 +51,10 @@ impl Assets { | |||
// We explicitly specify `path:` instead of letting Nix resolve | |||
// automatically, which would involve checking parent directories | |||
// for a git repository. | |||
let uri = format!("path:{}", temp_dir.path().to_str().unwrap()); | |||
let uri = format!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a few usages of this: #236
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if those are relevant, but my thinking was that it might resolve other future regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this near the point where the data (the temp path) leaves our control as this isn't a bug in the Rust side of things but at the boundary to a different system.
This only affects paths that we pass to nix (so ideally we would canonicalize the paths in FlakeMetadata::resolve). We could do that by passing something like a FlakePath to that function instead of the str.
enum FlakePath<'s> {
Path(&'s Path),
Git(&'s str)
}
<Display impl that canonicalizes before creating the `path:{}` string>
This would allow us to keep the simple temp dir paths in places where it could get debug printed without causing any irritation why the tmp dir looks weird. The symlinks for tempdirs on macos are an implementation detail and should not be exposed in level-1 debug output (such as a dbg!()) print, IMHO.
On MacOS /tmp is a symlink to /private/tmp. TempDir creates a dir and returns the path as /tmp. nix is unhappy with symlink dirs when calling nix flake metadata --json To fix this we canonicalize the path first, resolving any symlinks on the way. Fixes zhaofengli#190.
815328f
to
00fd486
Compare
Sadly it breaks CI in fork-originated PRs if the author doesn't enable Actions on the fork itself. This reverts commit ce1aa41.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested that it fixes evaluation on macOS. Will add a test to keep it working later.
On macOS
/tmp
is a symlink to/private/tmp
.TempDir creates a dir and returns the path as
/tmp/...
. nix is unhappy with symlink dirs when callingnix flake metadata --json path:...
To fix this we canonicalize the path first, resolving any symlinks on the way.