chocolatey / chocolatey/choco

File System provider copy_directory method blindly tries to copy a directory into a subdirectory

Open
#2,748 0 comments 0 reactions 0 assignees View on GitHub
0 - Backlog Bug
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### What You Are Seeing?

If the `copy_directory` method of the File System provider is provided a target directory of a subdirectory of the source, it will copy things recursively until it runs out of path length.

### What is Expected?

Honestly, not 100% sure what would be best. I suspect throwing an exception with the explicit reason would be better than silently swallowing the error.

### How Did You Get This To Happen? (Steps to Reproduce)

A bug fixed in Chocolatey Licensed Extension 4.2.0 where we were inadvertently copying an msi installer directory recursively into itself.

### Output Log

There are no output logs for this.

Contributor guide

Open the contributing guide

Research direction

Start by locating the File System provider's copy_directory method and tracing how it handles a target that lies beneath the source. Clarify the intended failure behavior, then add regression coverage showing that copying into a source subdirectory does not recurse indefinitely and that the chosen error is reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.