[remote_directory] Setting incorrect case for path with purge enabled causes managed files to be deleted
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 8.2k
- Forks
- 2.5k
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 23
Description
Description
Setting incorrect case for path with purge enabled causes managed files to be deleted.
For example:
intended path on disk: /Users/gbatye/test/Remote_Directory
chef resource:
remote_directory '/Users/gbatye/test/remote_directory' do
source 'remote_directory_test'
purge true
action :create
end
Will result in managed files to be created and then deleted.
Is this expected behavior?
Chef Version
chef 18.5
Platform Version
Windows 10 & Macos 15.3.2
Client Output
* remote_directory[/Users/gbatye/test/remote_directory] action create[2025-04-01T21:53:25.062-07:00] INFO: Processing remote_directory[/Users/gbatye/test/remote_directory] action create (cpe_the_beginning::default line 7)
Recipe: <Dynamically Defined Resource>
* cookbook_file[/Users/gbatye/test/remote_directory/test1.log] action create[2025-04-01T21:53:25.064-07:00] INFO: Processing cookbook_file[/Users/gbatye/test/remote_directory/test1.log] action create (dynamically defined)
[2025-04-01T21:53:25.066-07:00] INFO: cookbook_file[/Users/gbatye/test/remote_directory/test1.log] created file /Users/gbatye/test/remote_directory/test1.log
- create new file /Users/gbatye/test/remote_directory/test1.log[2025-04-01T21:53:25.075-07:00] INFO: cookbook_file[/Users/gbatye/test/remote_directory/test1.log] updated file contents /Users/gbatye/test/remote_directory/test1.log
- update content in file /Users/gbatye/test/remote_directory/test1.log from none to f2ca1b
--- /Users/gbatye/test/remote_directory/test1.log 2025-04-01 21:53:25.066286504 -0700
+++ /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/.chef-test120250401-10456-zvne4c.log 2025-04-01 21:53:25.065889515 -0700
@@ -1 +1,2 @@
+test[2025-04-01T21:53:25.075-07:00] INFO: cookbook_file[/Users/gbatye/test/remote_directory/test1.log] mode changed to 644
- change mode from '' to '0644'
* file[/Users/gbatye/test/Remote_Directory/test1.log] action delete[2025-04-01T21:53:25.076-07:00] INFO: Processing file[/Users/gbatye/test/Remote_Directory/test1.log] action delete (dynamically defined)
[2025-04-01T21:53:25.077-07:00] INFO: file[/Users/gbatye/test/Remote_Directory/test1.log] backed up to /var/chef/backup/Users/gbatye/test/Remote_Directory/test1.log.chef-20250401215325.077212
[2025-04-01T21:53:25.078-07:00] INFO: file[/Users/gbatye/test/Remote_Directory/test1.log] removed backup at /var/chef/backup/Users/gbatye/test/Remote_Directory/test1.log.chef-20250401211223.055846
[2025-04-01T21:53:25.078-07:00] INFO: file[/Users/gbatye/test/Remote_Directory/test1.log] deleted file at /Users/gbatye/test/Remote_Directory/test1.log
- delete file /Users/gbatye/test/Remote_Directory/test1.log
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the remote_directory recipe with purge enabled and a case-mismatched path on macOS or Windows, then trace the remote_directory purge behavior that schedules the delete. Done means managed files are not deleted solely because the configured path differs in case, with regression coverage for the reported scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100