diff --git a/CHANGELOG.md b/CHANGELOG.md index e4a4a2f..98d03e8 100644 --- a/CHANGELOG.md +++ b/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 diff --git a/Docs/Cmdlets/Get-ChildItem2.md b/Docs/Cmdlets/Get-ChildItem2.md index 6226b4e..4e3b5a4 100644 --- a/Docs/Cmdlets/Get-ChildItem2.md +++ b/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`. diff --git a/NTFSSecurity/BaseCmdlets.cs b/NTFSSecurity/BaseCmdlets.cs index 0d319c7..30ae06a 100644 --- a/NTFSSecurity/BaseCmdlets.cs +++ b/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. /// internal static class PipelineControl { diff --git a/NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml b/NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml index 3fc7a58..7a38946 100644 --- a/NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml +++ b/NTFSSecurity/en-US/NTFSSecurity.dll-Help.xml @@ -3867,7 +3867,7 @@ PS C:\> Disable-Privileges 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. 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. 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`.