Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: getenv does not properly detect set-but-empty variable #96

Closed
mjcarroll opened this issue Sep 18, 2020 · 1 comment
Closed

Bug: getenv does not properly detect set-but-empty variable #96

mjcarroll opened this issue Sep 18, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mjcarroll
Copy link
Contributor

Discovered when writing some logic that checks for the presence of an environment variable, rather than the value.

You could in theory do something like

# In bash/zsh
export IGN_ENV_VAR=""

# and then in C++
ignition::common::env("IGN_ENV_VAR", foo)  # returns FALSE, but should be TRUE

This is completely valid (at least on Posix systems, unsupported on Windows)

Ref: https://github.com/ignitionrobotics/ign-common/blob/526c2aceb847dcdbfc2d25fc72457caaece03d3c/src/Util.cc#L328-L333

@mjcarroll
Copy link
Contributor Author

Close by #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant