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

Fix slice bounds out of range panic in fixupPath #16575

Merged
merged 4 commits into from
Jul 8, 2024

Conversation

mlafeldt
Copy link
Contributor

@mlafeldt mlafeldt commented Jul 3, 2024

I noticed that sst currently panics if an environment variable's name is shorter than 5 characters. This fixes the root cause.

V=1 sst deploy --stage=dev 
SST ❍ ion 0.0.416  ready!

➜  App:        myapp
   Stage:      dev

~  Deploying

panic: runtime error: slice bounds out of range [:5] with length 3

goroutine 1 [running]:
github.com/pulumi/pulumi/sdk/v3/go/auto.fixupPath({0x140018ec408, 0xb1, 0x1400013dfc0?}, {0x1400013dfc0, 0x32})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/cmd.go:324 +0x270
github.com/pulumi/pulumi/sdk/v3/go/auto.pulumiCommand.Run({{0x3, 0x73, 0x2, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}}, {0x1400013dfc0, ...}}, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/cmd.go:273 +0x394
github.com/pulumi/pulumi/sdk/v3/go/auto.(*LocalWorkspace).runPulumiInputCmdSync(0x14001494000, {0x106fb2b28, 0x1400061c0f0}, {0x0, 0x0}, {0x14000aeba00, 0x4, 0x4})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/local_workspace.go:776 +0x1f4
github.com/pulumi/pulumi/sdk/v3/go/auto.(*LocalWorkspace).runPulumiCmdSync(...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/local_workspace.go:790
github.com/pulumi/pulumi/sdk/v3/go/auto.(*LocalWorkspace).SelectStack(0x14001494000, {0x106fb2b28, 0x1400061c0f0}, {0x16b392623, 0x3})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/local_workspace.go:568 +0x160
github.com/pulumi/pulumi/sdk/v3/go/auto.SelectStack({0x106fb2b28?, 0x1400061c0f0?}, {0x16b392623, 0x3}, {0x106fcd6e0, 0x14001494000})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/stack.go:179 +0x5c
github.com/pulumi/pulumi/sdk/v3/go/auto.UpsertStack({0x106fb2b28, 0x1400061c0f0}, {0x16b392623, 0x3}, {0x106fcd6e0, 0x14001494000})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/stack.go:191 +0x34
github.com/sst/ion/pkg/project.(*stack).Run(0x14000a42058, {0x106fb2b28, 0x1400061c0f0}, 0x140000bbcc0)
        /home/runner/work/ion/ion/pkg/project/stack.go:283 +0x1cf4
main.init.func3(0x14000064550)
        /home/runner/work/ion/ion/cmd/sst/main.go:458 +0x2c8
main.run()
        /home/runner/work/ion/ion/cmd/sst/main.go:160 +0x6cc
main.main()
        /home/runner/work/ion/ion/cmd/sst/main.go:52 +0x12c

@mlafeldt mlafeldt requested a review from a team as a code owner July 3, 2024 12:47
Copy link

github-actions bot commented Jul 3, 2024

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@pulumi-bot
Copy link
Contributor

pulumi-bot commented Jul 3, 2024

Changelog

[uncommitted] (2024-07-08)

Bug Fixes

  • [sdk/go] Fix out-of-range panic when sanitizing PATH env var

Copy link
Collaborator

@tgummerer tgummerer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks obviously correct!

Would you be willing to add a changelog entry (using make changelog), and a test in sdk/go/auto/cmd_test.go? Then we can get this merged.

@tgummerer
Copy link
Collaborator

/run-acceptance-tests

@mlafeldt
Copy link
Contributor Author

mlafeldt commented Jul 3, 2024

Thanks, this looks obviously correct!

Would you be willing to add a changelog entry (using make changelog), and a test in sdk/go/auto/cmd_test.go? Then we can get this merged.

Sure, just made the changes.

@Frassle Frassle enabled auto-merge July 3, 2024 13:22
Copy link

github-actions bot commented Jul 3, 2024

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

2 similar comments
Copy link

github-actions bot commented Jul 3, 2024

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

Copy link

github-actions bot commented Jul 3, 2024

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@lunaris lunaris closed this Jul 8, 2024
auto-merge was automatically disabled July 8, 2024 08:59

Pull request was closed

@lunaris lunaris reopened this Jul 8, 2024
Copy link

github-actions bot commented Jul 8, 2024

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@lunaris lunaris added this pull request to the merge queue Jul 8, 2024
Merged via the queue into pulumi:master with commit bbf5b0d Jul 8, 2024
14 of 17 checks passed
This was referenced Jul 10, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 10, 2024
Tentative changelog:

### Features

- [docs] Add ability to constrain supported languages of resource and
function overlays

- [engine] Guess references to properties 'name' and 'arn' between
dependant resources during import
  [#16234](#16234)

- [sdk/nodejs] Add `dependsOn` to `InvokeOptions` in the NodeJS SDK
  [#16560](#16560)


### Bug Fixes

- [cli/new] Use default values for language specific prompts when using
--yes
  [#16595](#16595)

- [docs] Fix generating constructor syntax examples for kubernetes
  [#16574](#16574)

- [docs] Fix generating constructor syntax examples in Go for package
awsx
  [#16583](#16583)

- [backend/service] Retry POST requests that time out during handshake
timeouts
  [#16576](#16576)

- [engine] Avoid computing refresh `Diff`s for external resources
  [#16544](#16544)

- [engine] Fix program hanging when the import resource option is used
and the inputs don't match
  [#16572](#16572)

- [programgen/go] Do not emit index module for resources without a
schema
  [#16588](#16588)

- [sdk/go] Fix out-of-range panic when sanitizing PATH env var
  [#16575](#16575)

- [sdk/nodejs] Fix creating a closure with object getters and setters
  [#16568](#16568)

- [programgen/python] Fix Python program generation for remote assets
  [#16556](#16556)


### Miscellaneous

- [sdk/nodejs] Bump `@opentelemetry` packages in the NodeJS SDK
  [#16558](#16558)
github-merge-queue bot pushed a commit that referenced this pull request Jul 10, 2024
Stacked PR on top of #16607

Tentative changelog:

### Features

- [docs] Add ability to constrain supported languages of resource and
function overlays

- [engine] Guess references to properties 'name' and 'arn' between
dependant resources during import
  [#16234](#16234)

- [sdk/nodejs] Add `dependsOn` to `InvokeOptions` in the NodeJS SDK
  [#16560](#16560)


### Bug Fixes

- [cli/new] Use default values for language specific prompts when using
--yes
  [#16595](#16595)

- [docs] Fix generating constructor syntax examples for kubernetes
  [#16574](#16574)

- [docs] Fix generating constructor syntax examples in Go for package
awsx
  [#16583](#16583)

- [backend/service] Retry POST requests that time out during handshake
timeouts
  [#16576](#16576)

- [engine] Avoid computing refresh `Diff`s for external resources
  [#16544](#16544)

- [engine] Fix program hanging when the import resource option is used
and the inputs don't match
  [#16572](#16572)

- [programgen/go] Do not emit index module for resources without a
schema
  [#16588](#16588)

- [sdk/go] Fix out-of-range panic when sanitizing PATH env var
  [#16575](#16575)

- [sdk/nodejs] Fix creating a closure with object getters and setters
  [#16568](#16568)

- [programgen/python] Fix Python program generation for remote assets
  [#16556](#16556)


### Miscellaneous

- [sdk/nodejs] Bump `@opentelemetry` packages in the NodeJS SDK
  [#16558](#16558)
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.123.0.

1 similar comment
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.123.0.

glena pushed a commit that referenced this pull request Jul 11, 2024
I noticed that sst currently panics if an environment variable's name is
shorter than 5 characters. This fixes the root cause.

```
V=1 sst deploy --stage=dev 
SST ❍ ion 0.0.416  ready!

➜  App:        myapp
   Stage:      dev

~  Deploying

panic: runtime error: slice bounds out of range [:5] with length 3

goroutine 1 [running]:
github.com/pulumi/pulumi/sdk/v3/go/auto.fixupPath({0x140018ec408, 0xb1, 0x1400013dfc0?}, {0x1400013dfc0, 0x32})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/cmd.go:324 +0x270
github.com/pulumi/pulumi/sdk/v3/go/auto.pulumiCommand.Run({{0x3, 0x73, 0x2, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}}, {0x1400013dfc0, ...}}, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/cmd.go:273 +0x394
github.com/pulumi/pulumi/sdk/v3/go/auto.(*LocalWorkspace).runPulumiInputCmdSync(0x14001494000, {0x106fb2b28, 0x1400061c0f0}, {0x0, 0x0}, {0x14000aeba00, 0x4, 0x4})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/local_workspace.go:776 +0x1f4
github.com/pulumi/pulumi/sdk/v3/go/auto.(*LocalWorkspace).runPulumiCmdSync(...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/local_workspace.go:790
github.com/pulumi/pulumi/sdk/v3/go/auto.(*LocalWorkspace).SelectStack(0x14001494000, {0x106fb2b28, 0x1400061c0f0}, {0x16b392623, 0x3})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/local_workspace.go:568 +0x160
github.com/pulumi/pulumi/sdk/v3/go/auto.SelectStack({0x106fb2b28?, 0x1400061c0f0?}, {0x16b392623, 0x3}, {0x106fcd6e0, 0x14001494000})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/stack.go:179 +0x5c
github.com/pulumi/pulumi/sdk/v3/go/auto.UpsertStack({0x106fb2b28, 0x1400061c0f0}, {0x16b392623, 0x3}, {0x106fcd6e0, 0x14001494000})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/go/auto/stack.go:191 +0x34
github.com/sst/ion/pkg/project.(*stack).Run(0x14000a42058, {0x106fb2b28, 0x1400061c0f0}, 0x140000bbcc0)
        /home/runner/work/ion/ion/pkg/project/stack.go:283 +0x1cf4
main.init.func3(0x14000064550)
        /home/runner/work/ion/ion/cmd/sst/main.go:458 +0x2c8
main.run()
        /home/runner/work/ion/ion/cmd/sst/main.go:160 +0x6cc
main.main()
        /home/runner/work/ion/ion/cmd/sst/main.go:52 +0x12c
```
glena pushed a commit that referenced this pull request Jul 11, 2024
Tentative changelog:

### Features

- [docs] Add ability to constrain supported languages of resource and
function overlays

- [engine] Guess references to properties 'name' and 'arn' between
dependant resources during import
  [#16234](#16234)

- [sdk/nodejs] Add `dependsOn` to `InvokeOptions` in the NodeJS SDK
  [#16560](#16560)


### Bug Fixes

- [cli/new] Use default values for language specific prompts when using
--yes
  [#16595](#16595)

- [docs] Fix generating constructor syntax examples for kubernetes
  [#16574](#16574)

- [docs] Fix generating constructor syntax examples in Go for package
awsx
  [#16583](#16583)

- [backend/service] Retry POST requests that time out during handshake
timeouts
  [#16576](#16576)

- [engine] Avoid computing refresh `Diff`s for external resources
  [#16544](#16544)

- [engine] Fix program hanging when the import resource option is used
and the inputs don't match
  [#16572](#16572)

- [programgen/go] Do not emit index module for resources without a
schema
  [#16588](#16588)

- [sdk/go] Fix out-of-range panic when sanitizing PATH env var
  [#16575](#16575)

- [sdk/nodejs] Fix creating a closure with object getters and setters
  [#16568](#16568)

- [programgen/python] Fix Python program generation for remote assets
  [#16556](#16556)


### Miscellaneous

- [sdk/nodejs] Bump `@opentelemetry` packages in the NodeJS SDK
  [#16558](#16558)
glena pushed a commit that referenced this pull request Jul 11, 2024
Stacked PR on top of #16607

Tentative changelog:

### Features

- [docs] Add ability to constrain supported languages of resource and
function overlays

- [engine] Guess references to properties 'name' and 'arn' between
dependant resources during import
  [#16234](#16234)

- [sdk/nodejs] Add `dependsOn` to `InvokeOptions` in the NodeJS SDK
  [#16560](#16560)


### Bug Fixes

- [cli/new] Use default values for language specific prompts when using
--yes
  [#16595](#16595)

- [docs] Fix generating constructor syntax examples for kubernetes
  [#16574](#16574)

- [docs] Fix generating constructor syntax examples in Go for package
awsx
  [#16583](#16583)

- [backend/service] Retry POST requests that time out during handshake
timeouts
  [#16576](#16576)

- [engine] Avoid computing refresh `Diff`s for external resources
  [#16544](#16544)

- [engine] Fix program hanging when the import resource option is used
and the inputs don't match
  [#16572](#16572)

- [programgen/go] Do not emit index module for resources without a
schema
  [#16588](#16588)

- [sdk/go] Fix out-of-range panic when sanitizing PATH env var
  [#16575](#16575)

- [sdk/nodejs] Fix creating a closure with object getters and setters
  [#16568](#16568)

- [programgen/python] Fix Python program generation for remote assets
  [#16556](#16556)


### Miscellaneous

- [sdk/nodejs] Bump `@opentelemetry` packages in the NodeJS SDK
  [#16558](#16558)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants