Skip to content

Parser: Respect the accessor of the source file for relative paths#12430

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
DeterminateSystems:relative-path-literals
Feb 10, 2025
Merged

Parser: Respect the accessor of the source file for relative paths#12430
Ericson2314 merged 1 commit intoNixOS:masterfrom
DeterminateSystems:relative-path-literals

Conversation

@edolstra
Copy link
Member

@edolstra edolstra commented Feb 6, 2025

Motivation

Previously we only returned paths in rootFS, which is wrong and only worked because currently all our source trees are in rootFS. However, starting in #12421, this is no longer the case. (Namely, the initial parse of flake.nix uses a lazy source tree.)

Context

Cherry-picked from #12421 and slightly adapted from lazy-trees.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Previously we only returned paths in rootFS, which is wrong and only
worked because currently all our source trees are in rootFS.
@edolstra edolstra requested a review from roberth February 6, 2025 15:37
: PATH {
Path path(absPath(std::string_view{$1.p, $1.l}, state->basePath.path.abs()));
std::string_view literal({$1.p, $1.l});
Path path(absPath(literal, state->basePath.path.abs()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This absPath is only needed in one of the new branches below, can you move it down?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always needed because it canonicalizes the path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I think we need to canonicalize with respect to the accessor, but this is a bit of long-standing separate technical debt, so fine for now.

@Ericson2314 Ericson2314 merged commit 1f485b6 into NixOS:master Feb 10, 2025
13 checks passed
@cole-h cole-h deleted the relative-path-literals branch February 10, 2025 15:32
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

Successfully merging this pull request may close these issues.

2 participants