Browse Source

docs: name the layers that match a -Filter dot, and the cmdlets that enable privileges for their command

The cmdlet page said that the AlphaFS enumeration alone decides which names match, while the code compares each returned name with the pattern again; both apply, and the page now says so. The comment of PipelineControl said that every Write method is noted, but WriteWarning is not, and it names ShouldProcess as an example of an unnoted call. The changelog entries about the privileges name the cmdlets that enable them for the duration of their command, because Enable-Privileges keeps them enabled by design.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: AI Assistant <ai@example.com>
pull/118/head
Raimund Andree 2 days ago
parent
commit
5a5d58b88c
  1. 20
      CHANGELOG.md
  2. 2
      Docs/Cmdlets/Get-ChildItem2.md
  3. 7
      NTFSSecurity/BaseCmdlets.cs
  4. 2
      NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml

20
CHANGELOG.md

@ -137,11 +137,11 @@ The format is based on
`Set-NTFSOwner`, and the errors of `Get-ChildItem2` for a folder that it
cannot read, for example with `4>&1` or `2>&1`. They now stop and write no
error, and the error of the later command reaches the caller
- Fix the cmdlets that enable the privileges, which left a privilege enabled
in the session and hid the exception of a later command when that command
took the debug message after the enabling, for example with
`5>&1 | Select-Object -First 2`; they now disable the privilege and pass
the exception on
- Fix the cmdlets that enable the privileges for the duration of their
command, which left a privilege enabled in the session and hid the
exception of a later command when that command took the debug message
after the enabling, for example with `5>&1 | Select-Object -First 2`; they
now disable the privilege and pass the exception on
- Fix `Get-ChildItem2 -Filter`, which read a bracket as the start of a
character class, so that it did not return a file with brackets in its name,
such as `Report[1].txt`, for that name; only `*` and `?` are wildcards. A
@ -336,10 +336,12 @@ The format is based on
for such a path, as in PowerShell 7, and writes the reason as a debug
message
- Fix the cmdlets that enable the Backup, Restore, Take Ownership, and
Security privileges, which left them enabled in the session when a later
command, such as `Select-Object -First`, or a terminating error stopped
the pipeline early; they now disable them also then
- Fix the cmdlets that enable the privileges, which stopped with the error
Security privileges for the duration of their command, which left them
enabled in the session when a later command, such as `Select-Object -First`,
or a terminating error stopped the pipeline early; they now disable them
also then. `Enable-Privileges` keeps them enabled by design
- Fix the cmdlets that enable the privileges for the duration of their
command, which stopped with the error
"Priviledge already disabled" and left the other privileges enabled when
another command in the pipeline, such as `Disable-Privileges`, had
disabled one of them; a privilege that they can't disable now gives a

2
Docs/Cmdlets/Get-ChildItem2.md

@ -319,7 +319,7 @@ Before 5.0.0, a `-Path` value that points to a file stopped the cmdlet with an `
Before 5.0.0, `-Filter` read a bracket as the start of a character class, so a file with brackets in its name, such as `Report[1].txt`, was not returned for its name, and a pattern of an asterisk, a dot, and an asterisk dropped the items without a dot in their names, most folders among them.
The enumeration of the AlphaFS library decides which names match, and its rules for a dot differ from those of `Get-ChildItem`: a pattern such as `Report.*` does not return the file `Report`, which has no dot, a pattern that ends in a dot returns nothing, and an empty value returns nothing. Only the pattern of an asterisk, a dot, and an asterisk is treated as a single asterisk.
The names are matched twice, by the enumeration of the AlphaFS library and by the cmdlet, which reads a dot as an ordinary character, and their rules for a dot differ from those of `Get-ChildItem`: a pattern such as `Report.*` does not return the file `Report`, which has no dot, a pattern that ends in a dot returns nothing, and an empty value returns nothing. Only the pattern of an asterisk, a dot, and an asterisk is treated as a single asterisk.
Before 5.0.0, a `break`, a `continue`, or a `throw` in a later command of the pipeline did not end the cmdlet for an item below the first folder, also when the later command took the error of a folder that the cmdlet cannot read, for example with `2>&1`.

7
NTFSSecurity/BaseCmdlets.cs

@ -13,9 +13,10 @@ namespace NTFSSecurity
/// pipeline, for example for Select-Object -First, and a break or continue in a script block. These exceptions pass
/// through a cmdlet while it writes to a stream. A catch-all for the failures of an item must pass them on: reported
/// as the error of that item, they would end nothing, and the cmdlet would go on with the next item. BaseCmdlet
/// notes the exception that each of its Write methods raises, which includes everything that a later command can
/// throw; this check by type is a second line of defense for the other calls into PowerShell, which also raise the
/// end of the pipeline. See BaseCmdlet.IsFromLaterCommand.
/// notes the exception that each of its Write methods but WriteWarning raises, which includes everything that a
/// later command can throw; this check by type is a second line of defense for calls into PowerShell that are not
/// noted, such as ShouldProcess in the try blocks of Remove-Item2, Copy-Item2, and Move-Item2. See
/// BaseCmdlet.IsFromLaterCommand.
/// </summary>
internal static class PipelineControl
{

2
NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml

@ -3867,7 +3867,7 @@ PS C:\&gt; Disable-Privileges</dev:code>
<maml:para>A folder that cannot be read produces a non-terminating error with the ID `DirUnauthorizedAccessError` for an access denial or `DirUnspecifiedError` for any other failure, and a path that does not exist produces the error `FileNotFound`. In each case the cmdlet continues with the next path. Failures that occur while `-Recurse` collects the subfolders of a folder are reported as verbose messages only, not as errors.</maml:para>
<maml:para>Before 5.0.0, a `-Path` value that points to a file stopped the cmdlet with an `InvalidCastException`, `-Attributes` returned only the items that had all the listed attributes, and an empty `-Attributes` value returned every item, also the hidden ones. Earlier builds, including the 5.0.0 prereleases, could also omit the first hidden item with `-Hidden` unless `-Force` was explicitly supplied.</maml:para>
<maml:para>Before 5.0.0, `-Filter` read a bracket as the start of a character class, so a file with brackets in its name, such as `Report[1].txt`, was not returned for its name, and a pattern of an asterisk, a dot, and an asterisk dropped the items without a dot in their names, most folders among them.</maml:para>
<maml:para>The enumeration of the AlphaFS library decides which names match, and its rules for a dot differ from those of `Get-ChildItem`: a pattern such as `Report.*` does not return the file `Report`, which has no dot, a pattern that ends in a dot returns nothing, and an empty value returns nothing. Only the pattern of an asterisk, a dot, and an asterisk is treated as a single asterisk.</maml:para>
<maml:para>The names are matched twice, by the enumeration of the AlphaFS library and by the cmdlet, which reads a dot as an ordinary character, and their rules for a dot differ from those of `Get-ChildItem`: a pattern such as `Report.*` does not return the file `Report`, which has no dot, a pattern that ends in a dot returns nothing, and an empty value returns nothing. Only the pattern of an asterisk, a dot, and an asterisk is treated as a single asterisk.</maml:para>
<maml:para>Before 5.0.0, a `break`, a `continue`, or a `throw` in a later command of the pipeline did not end the cmdlet for an item below the first folder, also when the later command took the error of a folder that the cmdlet cannot read, for example with `2&gt;&amp;1`.</maml:para>
</maml:alert>
</maml:alertSet>

Loading…
Cancel
Save