Skip to content

dev_container: Parse env vars and docker labels with = in values correctly#53134

Merged
KyleBarton merged 2 commits intozed-industries:mainfrom
yeetypete:fix/env-var-parsing
Apr 6, 2026
Merged

dev_container: Parse env vars and docker labels with = in values correctly#53134
KyleBarton merged 2 commits intozed-industries:mainfrom
yeetypete:fix/env-var-parsing

Conversation

@yeetypete
Copy link
Copy Markdown
Contributor

@yeetypete yeetypete commented Apr 4, 2026

Fixes a parsing issue where docker env var key/value pairs can contain an "=" character in the value. This is pretty common and present in all nvidia/cuda docker images. Also adds some tests for env var parsing.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed a parsing failure where docker env var key/value pairs can contain an "=" character in the value.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 4, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator Bot requested a review from a team April 4, 2026 10:02
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Apr 4, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator Bot requested review from ConradIrwin and reflectronic and removed request for a team April 4, 2026 10:02
@yeetypete yeetypete changed the title fix: parse env vars with = in values correctly Apr 4, 2026
@maxdeviant maxdeviant changed the title fix(dev_container): parse env vars with = in values correctly Apr 4, 2026
@Vastargazing
Copy link
Copy Markdown
Contributor

There's a similar bug still present in deserialize_labels > visit_seq in the same file (the array-of-strings branch). It still uses the old split("=").collect() + parts.len() != 2 pattern. Any label whose value contains = will be silently dropped no error, no log.

The fix is a one-liner using the same approach you already introduced:

.filter_map(|v| {
    let (key, value) = v.split_once('=')?;
    Some((key.to_string(), value.to_string()))
})

it would also be good to add a test for it, mirroring should_parse_env_var_with_equals_in_value

@yeetypete yeetypete changed the title dev_container: Parse env vars with = in values correctly Apr 4, 2026
@ConradIrwin ConradIrwin removed their assignment Apr 6, 2026
@KyleBarton
Copy link
Copy Markdown
Collaborator

Good catch, thanks for the contribution!

@KyleBarton KyleBarton merged commit 4b1e0a3 into zed-industries:main Apr 6, 2026
31 checks passed
@zed-zippy zed-zippy Bot added the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 7, 2026
@KyleBarton
Copy link
Copy Markdown
Collaborator

@zed-zippy approved

MasoudAlali pushed a commit to MasoudAlali/zed-ide that referenced this pull request Apr 7, 2026
…rrectly (zed-industries#53134)

Fixes a parsing issue where docker env var key/value pairs can contain
an "=" character in the value. This is pretty common and present in all
[nvidia/cuda](https://hub.docker.com/r/nvidia/cuda) docker images. Also
adds some tests for env var parsing.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed a parsing failure where docker env var key/value pairs can
contain an "=" character in the value.
@MrSubidubi MrSubidubi removed the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 7, 2026
@zed-zippy zed-zippy Bot added the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 8, 2026
@dinocosta dinocosta removed the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 8, 2026
piper-of-dawn pushed a commit to piper-of-dawn/zed that referenced this pull request Apr 25, 2026
…rrectly (zed-industries#53134)

Fixes a parsing issue where docker env var key/value pairs can contain
an "=" character in the value. This is pretty common and present in all
[nvidia/cuda](https://hub.docker.com/r/nvidia/cuda) docker images. Also
adds some tests for env var parsing.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed a parsing failure where docker env var key/value pairs can
contain an "=" character in the value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

6 participants