When a plugin modifies PATH and also config in devbox.json modifies PATH via env:{}, the env overwrites the plugin and so PATH modification from the plugin is lost. This is because we do maps.Copy() to merge the env from plugin to the one from config.
The copy is fine for all other env variables but for PATH we need to handle merging the two rather than overwriting.
Fixes #2138
How was it tested?
bug recreate:
devbox init
devbox add ruby (ruby plugin modifies PATH)
devbox shell (see PATH is prepended with ruby plugin)
modify devbox.json and add "env": {"PATH": "/my/config/bin"}
re-enter devbox shell and see PATH prepend from ruby plugin is lost, only "/my/config/bin" is prepended.
fix recreate:
follow same steps, but in last step both PATH prepends from devbox.json and from plugin are present.
Summary
When a plugin modifies PATH and also config in devbox.json modifies PATH via
env:{}
, the env overwrites the plugin and so PATH modification from the plugin is lost. This is because we domaps.Copy()
to merge the env from plugin to the one from config. The copy is fine for all other env variables but for PATH we need to handle merging the two rather than overwriting. Fixes #2138How was it tested?
bug recreate:
"env": {"PATH": "/my/config/bin"}
"/my/config/bin"
is prepended. fix recreate: