-
-
Notifications
You must be signed in to change notification settings - Fork 2k
file-system: drop redundant quotes around PathFmt and assert relative paths
#15329
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,18 +53,24 @@ public: | |
|
|
||
| Setting<std::filesystem::path> stateDir{ | ||
| this, | ||
| rootDir.get() ? *rootDir.get() + "/nix/var/nix" : getDefaultStateDir(), | ||
| rootDir.get() ? *rootDir.get() / "nix/var/nix" : std::filesystem::path(getDefaultStateDir()), | ||
| "state", | ||
| "Directory where Nix stores state."}; | ||
| "Directory where Nix stores state.", | ||
| }; | ||
|
|
||
| Setting<std::filesystem::path> logDir{ | ||
| this, | ||
| rootDir.get() ? *rootDir.get() + "/nix/var/log/nix" : getDefaultLogDir(), | ||
| rootDir.get() ? *rootDir.get() / "nix/var/log/nix" : std::filesystem::path(getDefaultLogDir()), | ||
| "log", | ||
| "directory where Nix stores log files."}; | ||
| "directory where Nix stores log files.", | ||
| }; | ||
|
|
||
| Setting<std::filesystem::path> realStoreDir{ | ||
| this, rootDir.get() ? *rootDir.get() + "/nix/store" : storeDir, "real", "Physical path of the Nix store."}; | ||
| this, | ||
| rootDir.get() ? *rootDir.get() / "nix/store" : std::filesystem::path(storeDir), | ||
| "real", | ||
| "Physical path of the Nix store.", | ||
| }; | ||
| }; | ||
|
|
||
| struct alignas(8) /* Work around ASAN failures on i686-linux. */ | ||
|
|
@@ -114,7 +120,7 @@ struct alignas(8) /* Work around ASAN failures on i686-linux. */ | |
| Path toRealPath(const Path & storePath) | ||
| { | ||
| assert(isInStore(storePath)); | ||
| return getRealStoreDir() + "/" + std::string(storePath, storeDir.size() + 1); | ||
| return (getRealStoreDir() / std::string(storePath, storeDir.size() + 1)).string(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems quite janky. What if storePath has some trailing slashes after storeDir? This would discard the LHS.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason we can't accept StorePath here? I guess it would be a rather big change though...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we could though I guess it would be a much larger change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe not, because there's one call by derivation-builder.cc on line 1866 that passes in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah right, it's not exactly a valid store path I suppose, but maybe we can hack it in in a way that's not that janky
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, made it a separate commit
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh this is very nice outcome! |
||
| } | ||
|
|
||
| std::optional<std::string> getBuildLogExact(const StorePath & path) override; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.