Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container terminal crashes for powershell - System.IndexOutOfRangeException: Index was outside the bounds of the array. #3774

Closed
3 tasks done
qinl-li opened this issue Aug 8, 2023 · 2 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@qinl-li
Copy link

qinl-li commented Aug 8, 2023

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.2.6
PowerShell: 7.3.6
OS: Linux 5.15.0-1035-azure #42-Ubuntu SMP Tue Feb 28 19:41:23 UTC 2023
BufferWidth: 0
BufferHeight: 0

Last 1 Keys:

 t

### Exception

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Text.StringBuilder.get_Chars(Int32 index)
   at Microsoft.PowerShell.PSConsoleReadLine.ConvertOffsetToPoint(Int32 offset)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Render()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Screenshot

image

Environment data

PS Version: 7.3.6
PS HostName: ConsoleHost
PSReadLine Version: 2.2.6
PSReadLine EditMode: Emacs
OS: Linux toolbox10 5.15.0-1035-azure #42-Ubuntu SMP Tue Feb 28 19:41:23 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
BufferWidth: 0
BufferHeight: 0

Steps to reproduce

  1. Create a container use the following command:
    k run toolbox10 --image=azuresearchlab.azurecr.io/toolbox:0.0.4-qinl -- /bin/pwsh -NoLogo -NoExit -Command Start-Sleep -Seconds 9999

  2. using @kubernetes/client-node to create interactive session

  3. const kc = new k8s.KubeConfig();
    kc.loadFromDefault();

    const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
    const exec_command2 = [
    '/bin/bash',
    '-c',
    'export TERM=xterm-256color;printenv;pwsh -NoLogo']
    const exec = new k8s.Exec(kc);

    socket = await exec.exec(namespace, podName, containerName, exec_command2, stdout, stdout, stdin, true,
    (status: k8s.V1Status) => {
    console.log('Exited with status:');
    console.log(JSON.stringify(status, null, 2));
    })

Expected behavior

It should create an interactive session and pipe the input to container

Actual behavior

Terminal crashes when typing in powershell session. However, it works fine for bash
image

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Aug 8, 2023
@daxian-dbw
Copy link
Member

@qinl-li Can you please provide repro steps with the docker commands only? The repro steps you provided cannot execute directly. We need simple repros to run locally for investigation.

@daxian-dbw daxian-dbw added the Needs-Repro There is no sufficient information on repro steps. label Aug 8, 2023
@daxian-dbw
Copy link
Member

Chatted with @qinl-li offline and this is a duplicate of #2844. See #2844 (comment) for details.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Aug 8, 2023
@daxian-dbw daxian-dbw added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Repro There is no sufficient information on repro steps. labels Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

2 participants