Skip to content

Calling string() on environment variables with empty values fails on Windows #554

Description

@aliquis162

When I have environment variables with no values (somehow I have two on my system - COMPLUS_InstallRoot and COMPLUS_Version), when I iterate over values of boost::process::environment::current() and try to call string() on the empty value, it fails.


boost::unordered_map<std::string, std::string> currentProcessEnvironment;

for (const auto& env : boost::process::environment::current())
{
    currentProcessEnvironment[env.key().string()] = env.value().string();    // fails if env.value().empty()
}

Fix for this should be simple, all needed should be just to apply this for size_as_utf8 and convert_to_utf8: f372a9a

Activity

  1. klemens-morgenstern commented on May 1, 2026

    @klemens-morgenstern
    Collaborator

    Do you want to create a PR?

  2. aliquis162 commented on May 6, 2026

    @aliquis162
    Author

    I am too busy with other things. I can create PR later but I don't know when.

  3. striezel commented on Jul 12, 2026

    @striezel
    Contributor

    @aliquis162 + @klemens-morgenstern
    I created a PR for this: #560

  4. klemens-morgenstern commented on Jul 12, 2026

    @klemens-morgenstern
    Collaborator

    Ok, I'll merge it after the current release is complete.

  5. striezel commented on Sep 7, 2026

    @striezel
    Contributor

    I'll merge it after the current release is complete.

    @klemens-morgenstern: Any update on this? Boost 1.92.0 has been released approx. a month ago, so now the pull request fixing this issue (#560) could be reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions