Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourcePath::resolveSymlinks(): Fix handling of symlinks that start with '..' #8452

Merged
merged 1 commit into from Jun 6, 2023

Conversation

edolstra
Copy link
Member

@edolstra edolstra commented Jun 5, 2023

Motivation

Fixes #8437.

Context

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • documentation in the manual
  • documentation in the internal API docs
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or incompatible change: updated release notes

Priorities

Add 馃憤 to pull requests you find important.

@edolstra edolstra added the backport 2.16-maintenance Automatically creates a PR against the branch label Jun 5, 2023
@github-actions github-actions bot added fetching Networking with the outside (non-Nix) world with-tests Issues related to testing. PRs with tests have some priority labels Jun 5, 2023
@roberth roberth added the bug label Jun 5, 2023
src/libutil/canon-path.hh Outdated Show resolved Hide resolved
@fricklerhandwerk
Copy link
Contributor

Suggestion for commit message: Previously, when resolving a symlink, .. components would not be taken into account.

@github-actions github-actions bot removed the with-tests Issues related to testing. PRs with tests have some priority label Jun 5, 2023
@infinisil
Copy link
Member

Can you also add a test case to prevent against this bug in the future?

This fixes handling of symlinks that start with '..', and symlink
targets that contain symlinks themselves.
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Jun 6, 2023
@edolstra
Copy link
Member Author

edolstra commented Jun 6, 2023

Added a test.

@edolstra edolstra enabled auto-merge June 6, 2023 09:24
@edolstra edolstra merged commit f5ab40c into NixOS:master Jun 6, 2023
8 checks passed
@github-actions
Copy link

github-actions bot commented Jun 6, 2023

@edolstra edolstra deleted the fix-relative-symlinks branch June 6, 2023 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.16-maintenance Automatically creates a PR against the branch bug fetching Networking with the outside (non-Nix) world 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.

[2.16 regression] "Infinite symlink recursion" when evaluating nixos-hardware
4 participants