Files
container/Sources/Integration
Nandha Reddy 35a821f041 fix: vminitd incorrectly overwrites custom HOME environment variable (#136)
## Summary

The vminitd service was using `process.env.contains("HOME")` which
checks for exact string match rather than environment variables starting
with "HOME=".

Since environment variables are stored as `"KEY=value"` strings, the
condition was always false, causing vminitd to always override custom
HOME values even when explicitly provided by the client.

## Changes

- Updates the logic in `vminitd/Sources/vminitd/Server+GRPC.swift` to
use `contains(where: { $0.hasPrefix("HOME=") })` to properly detect
existing HOME environment variables
- Adds regression test `testProcessCustomHomeEnvvar()` to verify that
custom HOME environment variables are preserved when provided by the
client

## Testing

The fix has been tested with the new integration test that:
  - Sets a custom HOME environment variable (`HOME=/tmp/custom/home`)
- Runs a shell command that outputs the HOME variable on the container
runtime
- Verifies the custom HOME value is preserved and not overwritten with
the default

## Environment

  - macOS: 26.0 (25A5279m)
  - Hardware: M4 Pro
  - Xcode: 26 beta
  - Swift: 6.2-dev

Fixes #135
2025-06-17 21:51:11 -07:00
..