Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process denied when deleting lock files for package installs #46

Closed
5 tasks done
AdmiringWorm opened this issue Aug 1, 2023 · 1 comment · Fixed by #47
Closed
5 tasks done

Process denied when deleting lock files for package installs #46

AdmiringWorm opened this issue Aug 1, 2023 · 1 comment · Fixed by #47
Assignees
Labels
Bug Issues where something has happened which was not expected or intended
Milestone

Comments

@AdmiringWorm
Copy link
Member

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.
  • I confirm I am using official, and not unofficial, or modified, Chocolatey products.

What You Are Seeing?

When in installing packages, in some cases with the latest development version of Chocolatey CLI and Chocolatey.NuGet.Client 3.4.1 there is a message about the process being unable to delete a file.

This file is one of the lock files that gets created during file and directory operations.

What is Expected?

There should be no mention about deleting lock files (or files looking like lock files).

How Did You Get This To Happen?

  1. Pull in the changes from (#3291) Update Chocolatey.NuGet.Client libraries to 3.4.2 choco#3288
  2. Run choco install pester --version 5.3.0
  3. Notice the NuGet mention of a process locking a file

System Details

  • Operating System: windows 10
  • Windows PowerShell version: 7
  • Chocolatey CLI Version: vNext
  • Chocolatey Licensed Extension version: N/A
  • Chocolatey License type: N/A
  • Terminal/Emulator: Tabby

Installed Packages

Installed packages does not matter.

Output Log

Available internally on test server.

Additional Context

I currently believe we are using the wrong path as the basis of getting the location to create a lock file.

@AdmiringWorm AdmiringWorm self-assigned this Aug 1, 2023
@AdmiringWorm AdmiringWorm added the Bug Issues where something has happened which was not expected or intended label Aug 1, 2023
@AdmiringWorm AdmiringWorm added this to the 3.4.2 milestone Aug 1, 2023
AdmiringWorm added a commit that referenced this issue Aug 2, 2023
A couple of places in the package extractor we incorrectly uses
the target nupkg as the basis of where to store any lock files that
are related to these files.

This causes an issue due to the lock files being created in the same
directory that NuGet.Client removes all files from before downloading
the nupkg file, and causes a unauthorized exception.

Instead, this commit changes it to use the target path that will be set
to the directory instead, which causes the lock files to be created in its
parent directory.
AdmiringWorm added a commit that referenced this issue Aug 2, 2023
In some rare cases the use of the BasePath property to store the
original location before overriding it will throw an exception when
this original location is not writable by the current process.

Instead, this commit changes to store the value directly from the
field with a similar name instead to prevent these exceptions from
occuring in these cases.
gep13 added a commit that referenced this issue Aug 2, 2023
…g-lock-files-for-package-installs

(#46) Fix issues when lock files are attempted to be written in restricted directories
@gep13 gep13 closed this as completed Aug 2, 2023
AdmiringWorm added a commit to AdmiringWorm/Chocolatey.Nuget.Client that referenced this issue Aug 2, 2023
* hotfix/3.4.2:
  (chocolatey#46) Fix use of BasePath throwing exception
  (chocolatey#46) Fix incorrect variable used as lock directory base
  (build) Starhing building 3.4.2 on new hotfix branch
AdmiringWorm added a commit that referenced this issue Aug 3, 2023
* master:
  (#46) Fix use of BasePath throwing exception
  (#46) Fix incorrect variable used as lock directory base
  (build) Starhing building 3.4.2 on new hotfix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues where something has happened which was not expected or intended
Projects
None yet
3 participants