Skip to content

Fix profile install for symlinked directories#93

Open
jasantunes wants to merge 2 commits intobartolli:mainfrom
jasantunes:fix-90-profile-symlink-dir-install
Open

Fix profile install for symlinked directories#93
jasantunes wants to merge 2 commits intobartolli:mainfrom
jasantunes:fix-90-profile-symlink-dir-install

Conversation

@jasantunes
Copy link

@jasantunes jasantunes commented Feb 25, 2026

Description

Fixes issue #90 where profile installation fails when a profile contains a symlink to a directory.

It fixes the bug in two core ways:

  1. Directory symlink targets are now copied recursively instead of treated like a single file.
    - Previously, install used std::fs::copy(...) directly, which fails when source resolves to a directory.
    - Now it routes through copy_source_entry(...), which detects directories and calls copy_directory_contents(...) with WalkDir::new(...).follow_links(true).
  2. Lockfile/conflict logic now handles directory-owned paths correctly on reinstall.
    - Copied nested files are tracked in installed (so lockfile gets actual file paths under the symlinked dir).
    - Conflict handling treats a path as owned if any tracked child file is under that path (path_owned_by_profile), avoiding false sidecar creation during --force reinstall.

Fixes #90

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests pass locally (cargo test symlinked_directory)
  • Added new tests
  • Performance verified

Performance impact

No material impact expected for normal installs.
The change applies to profile entries that resolve to directories.

Breaking changes

None.

Examples

  • Added test_install_profile_supports_symlinked_directory
  • Added test_force_reinstall_symlinked_directory_overwrites_owned_files

Checklist

  • Code follows guidelines
  • Self-reviewed
  • Documentation updated (no user-facing doc changes required for this bug fix)
  • No new warnings

Support profile installs when entries resolve to symlinked directories

and track copied nested files in the lockfile.

Also avoid a panic in walkdir path handling by returning a

structured IO error, keeping failures recoverable.

Adds regression tests for install and forced reinstall behavior.
@jasantunes jasantunes force-pushed the fix-90-profile-symlink-dir-install branch from be27778 to b2c6aef Compare February 25, 2026 19:40
@jasantunes jasantunes marked this pull request as ready for review February 25, 2026 19:59
Updates crate version from 0.9.14 to 0.9.15 in Cargo.toml and\nCargo.lock so this branch and its PR carry the next patch release.
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.

codanna profile install fails when profile contains symlink to a directory

1 participant