devbox icon indicating copy to clipboard operation
devbox copied to clipboard

[Bug]: export of fish shell environment variables do not always works as intended

Open arthurgeek opened this issue 5 months ago • 6 comments

Current Behavior (bug)

My fish config contains:

set EXA_STANDARD_OPTIONS --group --header --group-directories-first --icons

but exportify: https://github.com/jetpack-io/devbox/blob/2fee55b15345134123acec9da617b48e0547f715/internal/devbox/envvars.go#L17-L22 exports every env variable enclosed with "". This results in the incorrect behaviour: a variable exported with " will be treated as a single argument, while a variable without " will correctly treat the values as separate arguments. In fish, all variables are lists, so it's not always correct to enclose variables with strings.

The $EXA_STANDARD_OPTIONS var is sent to exa and when exported with ", exa/eza treats the whole value as a single argument, returning an error: eza: Unknown argument --group --header --group-directories-first --icons. If exported without ", it works as expected, because fish treats those as an argument list.

Expected Behavior (fix)

Maintain semantics of user-exported env variables. Or, even better, when using fish, do not re-export env variables that are not relevant to devbox.

If this comment works as intended, there's no need to reexport something that was correctly exported in my fish config:

https://github.com/jetpack-io/devbox/blob/2fee55b15345134123acec9da617b48e0547f715/internal/devbox/shellrc_fish.tmpl#L6-L9

Additional context

$ devbox version -v
Version:     0.8.7
Platform:    darwin_arm64
Commit:      525bb17ed665bb3066fbd3fb9bccec0aa961ecb7
Commit Time: 2024-01-23T19:15:31Z
Go Version:  go1.21.5
Launcher:    0.2.1

arthurgeek avatar Jan 25 '24 18:01 arthurgeek