PowerShell / PowerShell

PowerShell for every system!
https://microsoft.com/PowerShell
MIT License
45.6k stars 7.31k forks source link

Repair-Volume adds explicit CR+LF at the end of each of every message in the Verbose stream #12542

Closed skycommand closed 11 months ago

skycommand commented 4 years ago

Bug summary

The Repair-Volume cmdlet adds explicit CR+LF at the end of each of every message in the Verbose stream. As a result, the verbose report is very difficult to read.

This issue is a regression from PowerShell 5.1.

Steps to reproduce

Repair-Volume -DriveLetter D -Scan -Verbose

Expected behavior

VERBOSE: Volume label is "Cayotte's plans to catch the roadrunner".
VERBOSE: Stage 1: Examining basic file system structure ...
VERBOSE:
VERBOSE:   ##### file records processed.
VERBOSE: File verification completed.
VERBOSE:
VERBOSE:   # large file records processed.
VERBOSE:
VERBOSE:   # bad file records processed.
VERBOSE: Stage 2: Examining file name linkage ...
VERBOSE:
VERBOSE:   #### reparse records processed.
VERBOSE:
VERBOSE:   ##### index entries processed.
VERBOSE:
VERBOSE: Index verification completed.
VERBOSE:
VERBOSE:   #### reparse records processed.
VERBOSE: Stage 3: Examining security descriptors ...
VERBOSE: Security descriptor verification completed.
VERBOSE:
VERBOSE:   ### data files processed.
VERBOSE: CHKDSK is verifying Usn Journal...
VERBOSE:
VERBOSE:   ######## USN bytes processed.
VERBOSE: Usn Journal verification completed.
VERBOSE: Windows has scanned the file system and found no problems.
VERBOSE: No further action is required.
VERBOSE:   ######## KB total disk space.
VERBOSE:   ######## KB in 5308 files.
VERBOSE:   ######## KB in 724 indexes.
VERBOSE:   ######## KB in use by the system.
VERBOSE:   ######## KB occupied by the log file.
VERBOSE:   ######## KB available on disk.
VERBOSE:   ######## bytes in each allocation unit.
VERBOSE:   ######## total allocation units on disk.
VERBOSE:   ######## allocation units available on disk.
NoErrorsFound

Actual behavior

VERBOSE: Volume label is "Cayotte's plans to catch the roadrunner".
VERBOSE:
VERBOSE: Stage 1: Examining basic file system structure ...
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   ##### file records processed.
VERBOSE:
VERBOSE: File verification completed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   # large file records processed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   # bad file records processed.
VERBOSE:
VERBOSE: Stage 2: Examining file name linkage ...
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   #### reparse records processed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   ##### index entries processed.
VERBOSE:
VERBOSE: Index verification completed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   #### reparse records processed.
VERBOSE:
VERBOSE: Stage 3: Examining security descriptors ...
VERBOSE:
VERBOSE: Security descriptor verification completed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   ### data files processed.
VERBOSE:
VERBOSE: CHKDSK is verifying Usn Journal...
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:   ######## USN bytes processed.
VERBOSE:
VERBOSE: Usn Journal verification completed.
VERBOSE:
VERBOSE: Windows has scanned the file system and found no problems.
VERBOSE:
VERBOSE: No further action is required.
VERBOSE:
VERBOSE:   ######## KB total disk space.
VERBOSE:
VERBOSE:   ######## KB in 5308 files.
VERBOSE:
VERBOSE:   ######## KB in 724 indexes.
VERBOSE:
VERBOSE:   ######## KB in use by the system.
VERBOSE:
VERBOSE:   ######## KB occupied by the log file.
VERBOSE:
VERBOSE:   ######## KB available on disk.
VERBOSE:
VERBOSE:   ######## bytes in each allocation unit.
VERBOSE:
VERBOSE:   ######## total allocation units on disk.
VERBOSE:
VERBOSE:   ######## allocation units available on disk.
VERBOSE:
NoErrorsFound

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
iSazonov commented 4 years ago

/cc @anmenaga I guess it comes from WinCompat feature.

anmenaga commented 4 years ago

not related to WinCompat; at least v2 of the Storage module declares compatibility with PS Core CompatiblePSEditions = @('Desktop', 'Core') and is loaded directly into PS Core with repro:

...
VERBOSE:       4096 bytes in each allocation unit.

VERBOSE:   58170335 total allocation units on disk.

VERBOSE:   43118095 allocation units available on disk.

NoErrorsFound
PS C:\> Get-Module -Name Storage

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   2.0.0.0               Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-StorageFaultDomain…}

PS C:\> (Get-Module -Name Storage).Path
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Storage\Storage.psd1

Looks like CIM object is calling some native app and transimts its output as Verbose message. Here is a repro using CIM cmdlets:

$VerbosePreference = 'Continue';
$Volume = Get-CimInstance -Namespace "root\Microsoft\Windows\Storage" -ClassName "MSFT_Volume" | Select-Object -First 1
Invoke-CimMethod -InputObject $Volume -Arguments @{Scan=$True} -MethodName "Repair"
iSazonov commented 4 years ago

Should we fix this in Engine? Escape '\n' in verbose out?

microsoft-github-policy-service[bot] commented 1 year ago

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

microsoft-github-policy-service[bot] commented 11 months ago

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.