You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
System.DivideByZeroException within pwsh on linux #618
# pwsh -c '
& {
"PS version: $($PSVersionTable.PSVersion)"
"PSReadline version: $((Get-Module PSReadline).Version)"
if ($IsLinux -or $IsOSX) {
"os: $(uname -a)"
} else {
"os: $((dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion)"
}
"PS file version: $((dir $pshome\powershell.exe).VersionInfo.FileVersion)"
}'
PS version: 6.0.0-rc.2
PSReadline version:
os: Linux 18227f8f3aba 4.4.108-boot2docker #1 SMP Wed Dec 27 23:32:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
dir : Cannot find path '/opt/microsoft/powershell/6.0.0-rc.2/powershell.exe' because it does not exist.
At line:10 char:26
+ "PS file version: $((dir $pshome\powershell.exe).VersionInfo.File ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (/opt/microsoft/.../powershell.exe:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Steps to reproduce or exception report
docker run -it microsoft/vsts-agent
in separate shell
docker exec -it <id of the container just started> /bin/bash
pwsh
PowerShell v6.0.0-rc.2
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /vsts>
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 0 Keys:
Exception:
System.DivideByZeroException: Attempted to divide by zero.
at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
I didn't see any obvious places where this division could take place. If it's easy for you to debug and find the exact line, that would expedite a fix.
My hands are a bit full at the moment, and this is not blocking me, but i see older closed issues with the same exception type in PSReadline. I'm not a dotnet guy, so i'm not sure how to debug this... Any pointers welcome.
PowerShell v6.0.1
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /home/jenkins>
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 0 Keys:
Exception:
System.DivideByZeroException: Attempted to divide by zero.
at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
PS version: 6.0.1
PSReadline version: 1.2
os: Linux 12d4c04b1f0f 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 GNU/Linux
Debian 9 Stretch
Also, there isn't powershell.exe in linux version, it is called pwsh
I am not sure if it is the situation, but in Completion.cs, there is Rows = (matches.Count + columns - 1) / columns which could result in 0 if columns = 1. And then later on is ColumnWidth * (selectedItem / Rows), which would result in a division by 0.
I did not see anything specific in PSConsoleReadLine.
I will add, this does seem promising, because completion of arguments is not working.
More information.
It only happens if I launch directly in to pwsh. if I launch /bin/bash then pwsh, i do not get the error.
joachimaumann I cannot reproduce the crash with the docker image microsoft/vsts-agent.
Could this be related to the host OS? Can you please provide detailed repro steps?
Please see the screenshot below:
Activity
lzybkr commentedon Jan 16, 2018
I didn't see any obvious places where this division could take place. If it's easy for you to debug and find the exact line, that would expedite a fix.
lestephane commentedon Jan 18, 2018
My hands are a bit full at the moment, and this is not blocking me, but i see older closed issues with the same exception type in PSReadline. I'm not a dotnet guy, so i'm not sure how to debug this... Any pointers welcome.
camalot commentedon Jan 26, 2018
Also running into this with Debian 9
Debian 9 Stretch
Also, there isn't
powershell.exein linux version, it is calledpwshI am not sure if it is the situation, but in Completion.cs, there is
Rows = (matches.Count + columns - 1) / columnswhich could result in0ifcolumns = 1. And then later on isColumnWidth * (selectedItem / Rows), which would result in adivision by 0.I did not see anything specific in
PSConsoleReadLine.I will add, this does seem promising, because completion of arguments is not working.
More information.
It only happens if I launch directly in to
pwsh. if I launch/bin/bashthenpwsh, i do not get the error.joachimaumann commentedon Mar 16, 2018
Have the same issue with the vsts container as described by Le Stephane (@lestephane) .
Container I use getting the issue: https://github.com/microsoft/vsts-agent-docker/blob/3a81525044b23e87b75d3f6b4c7e4feb2d0dca3e/ubuntu/16.04/tfs/2017-u1/standard/Dockerfile
Its blocking us because we could not use azure powershell sdk https://docs.microsoft.com/de-de/powershell/azure/install-azurermps-maclinux?view=azurermps-5.5.0
could you please look into this
daxian-dbw commentedon Mar 16, 2018
I tried on a Debian 9 container, and couldn't reproduce the crash. Never tried on VSTS container though.
One thing to point out, the crash posted by Ryan Conrad (@camalot) at #618 (comment) is with PSReadline 1.2.
joachimaumann commentedon Mar 19, 2018
Dongbo Wang (@daxian-dbw) I added the container link which I can reproduce the issue
daxian-dbw commentedon Mar 31, 2018
joachimaumann I cannot reproduce the crash with the docker image
microsoft/vsts-agent.Could this be related to the host OS? Can you please provide detailed repro steps?
Please see the screenshot below:
lestephane commentedon Apr 1, 2018
I'm not longer able to reproduce with the latest image
lzybkr commentedon Apr 1, 2018
So OK to close?
lestephane commentedon Apr 2, 2018
lzybkr commentedon Apr 3, 2018
OK, closing.