Skip to content

Segmentation fault when running "gp ports list" in a task command #11990

@AppSecAmael

Description

@AppSecAmael

Bug description

I started a workspace with two simple tasks :

tasks:
  # Console for the user with a welcome message
  - name: Console
    command: |
      sleep 10
      echo "========================================"
      echo "Welcome to this repository ! Hugo server should start automatically and show both drafts and future posts, see below for the URL."
      gp ports list
      echo "========================================"
  # Dedicated terminal to display the logs
  - name: Logs
    command: |
      hugo serve --buildDrafts --buildFuture
    openMode: split-right

When opening gitpod I see a segmentation fault in the first console, when running "gp ports list" :

HISTFILE=/workspace/.gitpod/cmd-0 history -r; {
> echo "========================================"
> echo "Welcome to this repository ! Hugo server should start automatically and show both drafts and future posts, see below for the URL."
> gp ports list
> echo "========================================"
> 
> }
========================================
Welcome to this repository ! Hugo server should start automatically and show both drafts and future posts, see below for the URL.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x95560e]

goroutine 1 [running]:
github.com/gitpod-io/gitpod/gitpod-cli/cmd.glob..func11(0xf70c80, {0xa9a3e2, 0x0, 0x0})
        /tmp/build/components-gitpod-cli--app.6b8796aa57fed8a61e36573e2558f89f4aa872c2/cmd/ports-list.go:86 +0x3ae
github.com/spf13/cobra.(*Command).execute(0xf70c80, {0xfb1318, 0x0, 0x0})
        /home/gitpod/go-packages/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xf70780)
        /home/gitpod/go-packages/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x39d
github.com/spf13/cobra.(*Command).Execute(...)
        /home/gitpod/go-packages/pkg/mod/github.com/spf13/[email protected]/command.go:897
github.com/gitpod-io/gitpod/gitpod-cli/cmd.Execute()
        /tmp/build/components-gitpod-cli--app.6b8796aa57fed8a61e36573e2558f89f4aa872c2/cmd/root.go:35 +0x325
main.main()
        /tmp/build/components-gitpod-cli--app.6b8796aa57fed8a61e36573e2558f89f4aa872c2/main.go:12 +0x17
========================================

Trying to run the command manually after the workspace as fully setup is OK :

gitpod /workspace/information-platform (master) $ gp ports list
| PORT |     STATUS     |                                URL                                 | NAME & DESCRIPTION |
|------|----------------|--------------------------------------------------------------------|--------------------|
| 1313 | open (private) | https://1313-[REDACTED].ws-eu59.gitpod.io | hugo-server        |

Steps to reproduce

My .gitpod.io file is very basic.

tasks:
  # Console for the user with a welcome message
  - name: Console
    command: |
      sleep 10
      echo "========================================"
      echo "Welcome to this repository ! Hugo server should start automatically and show both drafts and future posts, see below for the URL."
      gp ports list
      echo "========================================"
  # Dedicated terminal to display the logs
  - name: Logs
    command: |
      hugo serve --buildDrafts --buildFuture
    openMode: split-right

# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
ports:
  - port: 1313
    name: hugo-server
    onOpen: open-browser

Workspace affected

No response

Expected behavior

The gp ports list command should display the open ports

Example repository

No response

Anything else?

No response

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions