Skip to content

Some bits in the file attributes are masked out #8315

@sba923

Description

@sba923

Files in the OneDrive sync folder with the "Files on Demand" feature make use of a number of specific attribute bits, such as:

0x00000200 | SparseFile
0x00000400 | ReparsePoint
0x00001000 | Offline
0x00080000 | Pinned
0x00100000 | Unpinned

(non-exhaustive list)

In PowerShell 6.1, some of the bits are masked out, so code that runs in Windows PowerShell 5.1 will not run correctly under PowerShell 6.1.

(this might be related to underlying .NET Core behavior, but the PS6 user… doesn't care ;-) )

Steps to reproduce

Run the following commands under PowerShell 6.1:

"'{0:x}' -f (gi 'C:\Users\steph\OneDrive\Always keep on this device.txt').Attributes
"'{0:x}' -f (gi 'C:\Users\steph\OneDrive\Free up space.txt').Attributes

Expected behavior

The output should be:

00080420
00401620

like in Windows PowerShell 5.1.

Actual behavior

Instead, PowerShell 6.1 outputs:

00080020
00400020

Environment data

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions