Skip to content

Fix profile install for symlinked directories#93

Merged
bartolli merged 3 commits into
bartolli:mainfrom
jasantunes:fix-90-profile-symlink-dir-install
Mar 14, 2026
Merged

Fix profile install for symlinked directories#93
bartolli merged 3 commits into
bartolli:mainfrom
jasantunes:fix-90-profile-symlink-dir-install

Conversation

@jasantunes

@jasantunes jasantunes commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

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

@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
@bartolli

Copy link
Copy Markdown
Owner

Thanks for your patience. I was dealing with some health issues over the past couple of months and couldn’t spend much time reviewing PRs or bug reports. I’m back now and will start going through them shortly.

jasantunes and others added 3 commits March 14, 2026 19:40
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.
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.
@bartolli bartolli force-pushed the fix-90-profile-symlink-dir-install branch from a4aa970 to 5fc5d07 Compare March 14, 2026 23:41
@bartolli bartolli merged commit 0819a1d into bartolli:main Mar 14, 2026
1 check passed
@bartolli

Copy link
Copy Markdown
Owner

Thanks for the fix and for your patience waiting on the review. Merged with a few small additions on our end: reverted the version bump (we handle versioning during releases) and added the path_owned_by_profile check to check_all_conflicts for consistency with install_files. Appreciate the contribution.

@jasantunes jasantunes deleted the fix-90-profile-symlink-dir-install branch March 15, 2026 05:42
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

2 participants