[IsolationSession] A `process.env` entry without `=` is set as an empty variable

Open Beginner friendly
#1,649 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

Start in build_process_options in src/mxc-sdk/src/backends/isolation_session/common/process_options.rs, where each env entry is split at its first =. Compare with env_pairs in src/mxc-sdk/src/core/mxc_common/default_env.rs, which drops entries without =. Then check that build_pty_process_options inherits the fix. Done when a bare FOO entry leaves the default variable unchanged, such as TEMP, and FOO= still sets an empty value.

Written by the indexing model from the issue text.

Description

Backend-IsolationSession Issue-Bug OS-Windows
Relevant area(s)

Windows

Brief description of your issue

The IsolationSession backend passes a process.env entry that has no =, such as FOO, as the variable FOO with an empty value (src/mxc-sdk/src/backends/isolation_session/common/process_options.rs :: build_process_options). Bubblewrap, ProcessContainer, Seatbelt and WSLc drop such an entry because it names no variable, as the shared src/mxc-sdk/src/core/mxc_common/default_env.rs :: env_pairs does.

Steps to reproduce

Read from the code at d22e3515; not run.

  1. build_process_options splits each entry at its first = and gives an entry without one an empty value, so FOO and FOO= both become ("FOO", "").
  2. The backend accepts process.env only with process.inheritDefaultEnv: true, which layers the entries over the default environment.
  3. build_pty_process_options starts from build_process_options, so PTY runs do the same.
Expected behavior

A bare entry leaves the process's environment unchanged, as on Bubblewrap, ProcessContainer, Seatbelt and WSLc.

Actual behavior

The process gets the variable with an empty value, so a bare entry that names a default variable, such as TEMP, empties it.

Dominant language
Rust
Stars
3.1k
Forks
171
Avg merge
2d 22h
Merged PRs (30d)
86

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/mxc

All issues in microsoft/mxc

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.