HomePhorge

(#10614) Fix setting and clearing read-only attribute on Windows
1371dbd81dc2Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#10614) Fix setting and clearing read-only attribute on Windows

Previously, we were incorrectly checking the return value of
SetFileAttributes. In cases where we didn't own the file, the call to
set/clear the readonly attribute would fail, but we were not raising
an error.

In fixing this, I uncovered ordering issues whereby we needed to set
the file attributes before setting the owner, both in the tests and
the Puppet::Util::Windows::Security module. I also modified the code
to only call SetFileAttributes if it would actually result in a
change, such as when changing the mode, but not the owner or group.

Paired-with: Nick Lewis <nick@puppetlabs.com>

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU7eb0197f33bc: (#10614) Fix error checking for Windows BOOL return values
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPU1371dbd81dc2: (#10614) Fix setting and clearing read-only attribute on Windows (authored by Josh Cooper <josh@puppetlabs.com>).Nov 10 2011, 7:06 PM