forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
[Relocatable] Follow-up 8: Document and clarify handling of set-but-empty environment variables #225
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
Open
dra27
wants to merge
12
commits into
relocatable-testing
Choose a base branch
from
environmental-emptiness
base: relocatable-testing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3c8b5c1 to
2a7e0ad
Compare
fdb5b50 to
6a5d951
Compare
6a5d951 to
be2d71c
Compare
be2d71c to
a3b346a
Compare
a3b346a to
b9275d3
Compare
d644c59 to
63922b2
Compare
b9275d3 to
9fe73e4
Compare
63922b2 to
198fcfd
Compare
9fe73e4 to
b70a613
Compare
198fcfd to
56b115d
Compare
b70a613 to
bd253ee
Compare
56b115d to
5c4d9f3
Compare
Clarify in various places the behaviour of reading an environment variable which is "Set But Null" (i.e. equal to the empty string as opposed to unset)
For Unix, the Filename module now treats TMPDIR being set to the empty string, as if it were not set at all (which causes it to use /tmp instead).
If TMPDIR is set to the empty string, the Unix build of ocamlyacc now defaults to /tmp (as it would if TMPDIR were not set at all). The Windows default for when TMPDIR is not set is alredy the current directory, so no change is required.
By making tmpdir explicitly "." in the rare corner-case of TMPDIR being set to the empty string on Windows, it becomes unnecessary to keep checking whether tmpdir is zero-length.
Use the non-raising Sys.getenv_opt internally in the Windows implementation of the Unix module. In passing, treat the highly unlikely corner case of COMSPEC being "Set But Null" as if COMSPEC were not set.
Previously, invocations such as OCAML_COLOR= ocamlopt emitted warning 46 (bad-env-variable) which is not particularly helpful. At present, Compmisc.set_from_env is used to implement OCAML_COLOR and OCAML_ERROR_STYLE, neither of which attached significance to the empty string. Compmisc.set_from_env is there changed to explictly ignore the environment variable value if it is "".
Most uses in ocamltest were via its safe_getenv function which already made unset and empty equivalent. This generalises the underlying getenv_with_default_value function always to return the default value if the variable is _either_ unset or set to the empty string.
The handling of OCAML_RUNTIME_EVENTS_DIR was incorrect if the value as "Set But Null" and the intention in the manual for OCAML_RUNTIME_EVENTS_START and OCAML_RUNTIME_EVENTS_PRESERVE is clearly that they should be set to non-empty values in order to trigger the required effect. All three variables are now ignored if they are set, but to an empty string.
bd253ee to
193aabe
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.