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

When a file exists, and matches checksum, the cache still considers it invalid #723

Open
XVII opened this issue Jul 5, 2021 · 2 comments
Labels
bug The issue is a bug.

Comments

@XVII
Copy link

XVII commented Jul 5, 2021

The Test-TargetResource returns $false even though the file may match the checksum. This is because when deploying a new configuration, it clears the "attribute cache" that's used to tell whether it matches the source or not (as documented).

In my eyes, it's more important that the contents match over the attributes matching the cache. -MatchSource should work with the CheckSum rather than just the cached file attributes alone.

I propose the $fileExists -eq True is removed as it should check the file checksum, no matter if it's in the attribute cache or otherwise. I guess this would mean an extra hash calculation, but if -MatchSource is set, the file hashes should match too.

For Files:

if ($ChecksumType -ine 'None' `
-and -not [String]::IsNullOrEmpty($Checksum) `
-and $fileExists -eq $true)
{

and for Directories:

if ($ChecksumType -ine 'None' `
-and -not [String]::IsNullOrEmpty($Checksum) `
-and $fileExists -eq $true)
{

We use this for a file that gets copied onto a server which becomes locked. We've noticed that DSC xRemoteFile is trying to update this file, even though it shouldn't be touching it -- the hash matches.

@PlagueHO PlagueHO added bug The issue is a bug. in progress The issue is being actively worked on by someone. labels Jul 10, 2021
@brwilkinson
Copy link

was this abandoned, since I shows assigned?

@johlju
Copy link
Member

johlju commented Aug 11, 2023

It seems there were no one in the community to reviewed the PR so it could be merge, and the contributor eventually removed the working branch so the PR closed. If someone send in a new PR then someone in the community have a chance to reviewed and we can merge it. 🙂

@johlju johlju removed the in progress The issue is being actively worked on by someone. label Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants