#3144·choco

File locked with read and delete permissions behave differently between client and server OS

Author: AdmiringWormCreated May 2, 2023Updated Sep 2, 2026
LabelsBug0 - TriagingClickUp - QA

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.

What You Are Seeing?

On a client system with the latest code we are working against allows a backup folder to be deleted if it contains a file that has been read and delete locked, even if that file was moved from a different location. On a server it is not possible to delete this file when it is read and delete locked, it is still allowed to be moved to any new location.

What is Expected?

The expectation is that behavior is consistent, and it will be removed on both client and server or kept on both.

How Did You Get This To Happen?

  1. Install the package upgradepackage version 1.0.0.
  2. Lock a file in the directory using $LockedFile = [System.IO.File]::Open("C:\ProgramData\chocolatey\lib\\\upgradepackage\tools\chocolateyInstall.ps1", "OpenOrCreate", "ReadWrite", "Read,Delete").
  3. Upgrade the package upgradepackage (ignore any warnings).
  4. Verify whether the directory lib-bkp\\\upgradepackage\1.0.0 exist or not (will not exist on client systems, but exist on server systems).

System Details

  • Operating System: Windows 10 and Windows 2019
  • Windows PowerShell version: 5.1.19041.2673 (Server: 5.1.17763.1852)
  • Chocolatey CLI Version: 2.0.0-vNext
  • Chocolatey Licensed Extension version: N/A
  • Chocolatey License type: N/A
  • Terminal/Emulator: PowerShell

Installed Packages

bash
chocolatey 2.0.0-PROJ615bef
installpackage 1.0.0
upgradepackage 1.1.0

Output Log

bash
https://gist.github.com/AdmiringWorm/cf023056f77e45be24d19a196b4c686d

Additional Context

The included log includes the full log from upgrading 1.2.1 until the end of the v2 testing.

┆Issue is synchronized with this Clickup task by Unito