Skip to content

[envvars] Fix error when env contains Bash function #2612

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apgrucza
Copy link
Contributor

@apgrucza apgrucza commented May 6, 2025

Summary

Fixes #995 - Error running devbox shell in environment with exported Bash function

How was it tested?

Tested that when running the below commands:

  • no errors are printed
  • the foo function runs successfully and prints foo

Case 1 (simple):

foo() { echo foo; }
export -f foo
devbox shell
foo

Case 2 (function that contains special characters " and $):

foo() { echo "${bar}"; }
export -f foo
export bar=foo
devbox shell
foo

Case 3 (shellenv):

foo() { echo foo; }
export -f foo
devbox shellenv > shellrc

# open a new shell

source shellrc
foo

Also added a Bash function to the test data used by TestWriteDevboxShellrc.

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Error running devbox shell in environment with exported Bash function
1 participant