File locked with read and delete permissions behave differently between client and server OS
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
### Checklist
- [X] I have verified this is the correct repository for opening this issue.
- [X] I have verified no other issues exist related to my problem.
- [X] I have verified this is not an issue for a specific package.
- [X] 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](https://app.clickup.com/t/868m0agke) by [Unito](https://www.unito.io)
Contributor guide
Research direction
Reproduce the upgradepackage scenario on Windows 10 and Windows Server 2019 using the PowerShell file-locking command and compare whether lib-bkp\upgradepackage\1.0.0 is created. Read the linked output log while tracing the package upgrade and backup handling. Done means file-lock behavior is consistent on client and server systems, with the expected backup result verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100