Bug 1775569 - Installer panic when selecting from an empty options list
Summary: Installer panic when selecting from an empty options list
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 4.3.0
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
: 4.5.0
Assignee: Joseph Callen
QA Contact: Yang Yang
URL:
Whiteboard:
Depends On:
Blocks: 1808094
TreeView+ depends on / blocked
 
Reported: 2019-11-22 10:27 UTC by Yang Yang
Modified: 2020-07-13 17:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1808094 (view as bug list)
Environment:
Last Closed: 2020-07-13 17:12:14 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift installer pull 3199 0 None closed Bug 1775569: Bump survey vendor for panic 2020-08-02 08:24:20 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:12:31 UTC

Description Yang Yang 2019-11-22 10:27:14 UTC
Description of problem:
Installer panic due to index out of range when selecting from an empty options list


Version-Release number of the following components:
# ./openshift-install version
./openshift-install v4.3.0
built from commit a702fd4beb593932067fe1b31f2d911feaa6d93e
release image registry.svc.ci.openshift.org/ocp/release@sha256:15132234d0b753aea0af00f5cfff429cf5eca57513e7cce530207b05167a999f


How reproducible:
100%

Steps to Reproduce:
1. Run installer by issuing below cli:
openshift-install create cluster --dir=./ipi_gcp

2. In the SSH Public Key part, type anything like /root, enter space key, enter any up/down arrow key

? SSH Public Key /root   [Use arrows to move, space to select, type to filter, ? for more help]

Actual results:
Installer panic: runtime error: index out of range

Expected results:
Installer works well

Additional info:
The root cause is that empty options list is not properly handled in below script.

vendor/gopkg.in/AlecAivazis/survey.v1/select.go
151     // if we are not pressing ent
152     if len(options) <= s.selectedIndex {

Please find prompted messages below.

panic: runtime error: index out of range 
 
goroutine 1 [running]: 


github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey%2ev1.(*Select).OnChange(0xc00104f450, 0x0, 0x0, 0x0, 0x0, 0x10, 0x13e23e20, 0x0, 0x0, 0x0, ...) 
    /go/src/github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey.v1/select.go:154 +0x6f3 
github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey%2ev1.(*Select).Prompt(0xc00104f450, 0x0, 0x0, 0x0, 0x0) 
    /go/src/github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey.v1/select.go:234 +0x3a0 
github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey%2ev1.Ask(0xc000afd150, 0x1, 0x1, 0x857f400, 0xc0010eb450, 0x0, 0x0, 0x0, 0x91f2b60, 0x1) 
    /go/src/github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey.v1/survey.go:148 +0x187 
github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey%2ev1.AskOne(0xb2c2f00, 0xc00104f450, 0x857f400, 0xc0010eb450, 0xc0010db700, 0x0, 0x0, 0x0, 0x0, 0xc000afd1c8) 
    /go/src/github.com/openshift/installer/vendor/gopkg.in/AlecAivazis/survey.v1/survey.go:94 +0xcd 
github.com/openshift/installer/pkg/asset/installconfig.(*sshPublicKey).Generate(0xc0010eb240, 0xc0010d9e30, 0x12, 0xc000afd598) 
    /go/src/github.com/openshift/installer/pkg/asset/installconfig/ssh.go:82 +0x4b2 
github.com/openshift/installer/pkg/asset/store.(*storeImpl).fetch(0xc0010b82a0, 0xb2b3f00, 0xc0010eb240, 0xc000d72710, 0x6, 0xc000d72710, 0x6) 
    /go/src/github.com/openshift/installer/pkg/asset/store/store.go:227 +0x7b1 
github.com/openshift/installer/pkg/asset/store.(*storeImpl).fetch(0xc0010b82a0, 0xb2b3d80, 0xc0010db540, 0xc000d7270c, 0x4, 0xc000d7270c, 0x4) 
    /go/src/github.com/openshift/installer/pkg/asset/store/store.go:221 +0x60c 
github.com/openshift/installer/pkg/asset/store.(*storeImpl).fetch(0xc0010b82a0, 0xb2b3d40, 0xc0010db4c0, 0xa147635, 0x2, 0xa147635, 0x2) 
    /go/src/github.com/openshift/installer/pkg/asset/store/store.go:221 +0x60c 
github.com/openshift/installer/pkg/asset/store.(*storeImpl).fetch(0xc0010b82a0, 0xb2b3c40, 0x13de3810, 0x0, 0x0, 0x409c25, 0x9167460) 
    /go/src/github.com/openshift/installer/pkg/asset/store/store.go:221 +0x60c 
github.com/openshift/installer/pkg/asset/store.(*storeImpl).Fetch(0xc0010b82a0, 0xb2b3c40, 0x13de3810, 0x13dade80, 0x6, 0x6, 0x0, 0xc000afdc20) 
    /go/src/github.com/openshift/installer/pkg/asset/store/store.go:77 +0x4b 
main.runTargetCmd.func1(0x7fff1fe3efad, 0x9, 0xc0010a0980, 0xc000afdc20) 
    /go/src/github.com/openshift/installer/cmd/openshift-install/create.go:155 +0x133 
main.runTargetCmd.func2(0x13db49e0, 0xc00104cb70, 0x0, 0x1) 
    /go/src/github.com/openshift/installer/cmd/openshift-install/create.go:180 +0x85 
github.com/openshift/installer/vendor/github.com/spf13/cobra.(*Command).execute(0x13db49e0, 0xc00104cb40, 0x1, 0x1, 0x13db49e0, 0xc00104cb40) 
    /go/src/github.com/openshift/installer/vendor/github.com/spf13/cobra/command.go:766 +0x2ae 
github.com/openshift/installer/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc00105a780, 0xc000afde78, 0x1, 0x1) 
    /go/src/github.com/openshift/installer/vendor/github.com/spf13/cobra/command.go:852 +0x2ec 
github.com/openshift/installer/vendor/github.com/spf13/cobra.(*Command).Execute(...) 
    /go/src/github.com/openshift/installer/vendor/github.com/spf13/cobra/command.go:800 
main.installerMain() 
    /go/src/github.com/openshift/installer/cmd/openshift-install/main.go:61 +0x21a 
main.main() 
    /go/src/github.com/openshift/installer/cmd/openshift-install/main.go:43 +0xc6

Comment 1 Yang Yang 2019-11-22 11:19:02 UTC
Updating steps as following:

1. Run installer by issuing below cli:
openshift-install create cluster --dir=./ipi_gcp

2. In the SSH Public Key part, do as following :
  1) enter: /root
  2) enter: space key, 
  3) enter: up/down arrow key

? SSH Public Key /root   [Use arrows to move, space to select, type to filter, ? for more help]

Comment 12 Joseph Callen 2020-02-26 14:33:35 UTC
Waiting on v1 to move pat 1.8.8
https://gopkg.in/AlecAivazis/survey.v1

Comment 15 Yang Yang 2020-03-09 02:11:11 UTC
Verified with openshift-install 4.5.0-0.nightly-2020-03-06-190457

Steps for verification:

1. Run installer by issuing below cli:
openshift-install create cluster --dir=./ipi_gcp

2. In the SSH Public Key part, do as following :
  1) enter: /root
  2) enter: space key, 
  3) enter: up/down arrow key

Installer does not panic hence moving it to verified state

Comment 17 errata-xmlrpc 2020-07-13 17:12:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2409


Note You need to log in before you can comment on or make changes to this bug.