Cherry pick from 9c080e705b: Handle env vars where space eliminated by trimwhitespace.