Skip to content

Comments

pathExists: isDir when endswith /.#9022

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
hercules-ci:fix-issue-8838-pathExists-isDir-slash-dot
Sep 30, 2023
Merged

pathExists: isDir when endswith /.#9022
Ericson2314 merged 1 commit intoNixOS:masterfrom
hercules-ci:fix-issue-8838-pathExists-isDir-slash-dot

Conversation

@roberth
Copy link
Member

@roberth roberth commented Sep 21, 2023

Motivation

The more complicated cases with .. and such were already handled correctly, so most of the extra test cases already worked.

Context

Priorities

Add 👍 to pull requests you find important.

@roberth roberth requested a review from edolstra as a code owner September 21, 2023 11:09
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Sep 21, 2023
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

💯

@Ericson2314
Copy link
Member

I might make the test case a list so we can see individual failures?

@roberth roberth force-pushed the fix-issue-8838-pathExists-isDir-slash-dot branch from bf48d95 to 6eefc12 Compare September 21, 2023 16:27
@roberth
Copy link
Member Author

roberth commented Sep 21, 2023

@Ericson2314 would be nice to have a standard solution for this, but did it by hand this time, as I was able to reproduce the problem locally.

Seems like either I messed up when I wrote this before NixCon or something happened in the meanwhile. Anyway, the problem is that Nix appears to canonicalize the path without checking that all components actually resolve to something that exists.

@roberth
Copy link
Member Author

roberth commented Sep 21, 2023

canonicalize the path without checking that all components actually resolve to something that exists.

This is perhaps a better way to implement this function anyway. Check each path component, and check that it's a directory unless it's the last component.

@Ericson2314
Copy link
Member

Ericson2314 commented Sep 21, 2023

Not sure what you mean, but can do the list vs && && && && later.

@roberth roberth force-pushed the fix-issue-8838-pathExists-isDir-slash-dot branch from 6eefc12 to f8a3893 Compare September 30, 2023 01:35
@Ericson2314 Ericson2314 merged commit ea2f74c into NixOS:master Sep 30, 2023
@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Backport failed for 2.18-maintenance, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 2.18-maintenance
git worktree add -d .worktree/backport-9022-to-2.18-maintenance origin/2.18-maintenance
cd .worktree/backport-9022-to-2.18-maintenance
git checkout -b backport-9022-to-2.18-maintenance
ancref=$(git merge-base 9c84054f97f96ae6c6ea9ff24d3376c485b0f188 f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c)
git cherry-pick -x $ancref..f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Backport failed for 2.16-maintenance, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 2.16-maintenance
git worktree add -d .worktree/backport-9022-to-2.16-maintenance origin/2.16-maintenance
cd .worktree/backport-9022-to-2.16-maintenance
git checkout -b backport-9022-to-2.16-maintenance
ancref=$(git merge-base 9c84054f97f96ae6c6ea9ff24d3376c485b0f188 f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c)
git cherry-pick -x $ancref..f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Backport failed for 2.17-maintenance, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 2.17-maintenance
git worktree add -d .worktree/backport-9022-to-2.17-maintenance origin/2.17-maintenance
cd .worktree/backport-9022-to-2.17-maintenance
git checkout -b backport-9022-to-2.17-maintenance
ancref=$(git merge-base 9c84054f97f96ae6c6ea9ff24d3376c485b0f188 f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c)
git cherry-pick -x $ancref..f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Backport failed for 2.18-maintenance, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 2.18-maintenance
git worktree add -d .worktree/backport-9022-to-2.18-maintenance origin/2.18-maintenance
cd .worktree/backport-9022-to-2.18-maintenance
git checkout -b backport-9022-to-2.18-maintenance
ancref=$(git merge-base 9c84054f97f96ae6c6ea9ff24d3376c485b0f188 f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c)
git cherry-pick -x $ancref..f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Backport failed for 2.16-maintenance, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 2.16-maintenance
git worktree add -d .worktree/backport-9022-to-2.16-maintenance origin/2.16-maintenance
cd .worktree/backport-9022-to-2.16-maintenance
git checkout -b backport-9022-to-2.16-maintenance
ancref=$(git merge-base 9c84054f97f96ae6c6ea9ff24d3376c485b0f188 f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c)
git cherry-pick -x $ancref..f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Backport failed for 2.17-maintenance, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 2.17-maintenance
git worktree add -d .worktree/backport-9022-to-2.17-maintenance origin/2.17-maintenance
cd .worktree/backport-9022-to-2.17-maintenance
git checkout -b backport-9022-to-2.17-maintenance
ancref=$(git merge-base 9c84054f97f96ae6c6ea9ff24d3376c485b0f188 f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c)
git cherry-pick -x $ancref..f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Backport failed for 2.18-maintenance, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 2.18-maintenance
git worktree add -d .worktree/backport-9022-to-2.18-maintenance origin/2.18-maintenance
cd .worktree/backport-9022-to-2.18-maintenance
git checkout -b backport-9022-to-2.18-maintenance
ancref=$(git merge-base 9c84054f97f96ae6c6ea9ff24d3376c485b0f188 f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c)
git cherry-pick -x $ancref..f8a3893e8d77ce4a6e23719a0b2d88464cb84b9c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in builtins.pathExists

3 participants