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

Merged
merged 1 commit into from
Jul 1, 2025

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.

@savil savil force-pushed the fix/bash_func_error branch from b7cda18 to a271f4a Compare July 1, 2025 22:06
Copy link
Collaborator

@savil savil left a comment

Choose a reason for hiding this comment

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

Thank you for sending this!

I struggled to repro the bug on my mac, but could using a fedora docker container. Confirmed that using the binary from this PR fixes the issue as well.

@savil savil merged commit 65c3c1c into jetify-com:main Jul 1, 2025
29 checks passed
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
2 participants