Skip to content

Conversation

@dra27
Copy link
Owner

@dra27 dra27 commented Aug 27, 2025

No description provided.

@dra27 dra27 added relocatable PRs related to the Relocatable Compiler project CI: Full matrix Full CI test matrix labels Aug 27, 2025
@dra27 dra27 changed the title [Relocatable] Follow-up 11: Overhaul handling of empty components in PATH-like environment variables [Relocatable] Follow-up 10: Overhaul handling of empty components in PATH-like environment variables Aug 28, 2025
@dra27 dra27 force-pushed the relocatable-testing branch from 3c8b5c1 to 2a7e0ad Compare September 9, 2025 22:19
@dra27 dra27 changed the base branch from relocatable-testing to trunk September 13, 2025 13:35
@dra27 dra27 changed the base branch from trunk to relocatable-testing November 30, 2025 14:35
@dra27 dra27 force-pushed the relocatable-testing branch from d644c59 to 63922b2 Compare November 30, 2025 14:36
@dra27 dra27 force-pushed the empty-paths branch 2 times, most recently from 5444318 to 1582e1f Compare November 30, 2025 17:56
@dra27 dra27 force-pushed the relocatable-testing branch from 63922b2 to 198fcfd Compare December 10, 2025 11:10
@dra27 dra27 force-pushed the relocatable-testing branch from 198fcfd to 56b115d Compare December 11, 2025 18:34
Previously, if OCAMLRUNPARAM was "Set But Null", CAMLRUNPARAM was
completely ignored. Similarly, a "Set But Null" value for OCAMLLIB
caused CAMLLIB and subsequently the default location of the Standard
Library to be ignored. Especially for OCAMLLIB/CAMLLIB, this behaviour
is counter-intuitive, as it's highly unlikely to be useful.

Now, if OCAMLLIB is set, but to the empty string, then CAMLLIB is
checked and, more importantly, if it is either not set or also set to
the empty string then the default location of the Standard Library is
still used. For consistency, if OCAMLRUNPARAM is set, but to the empty string,
then CAMLRUNPARAM is read.
POSIX recognises empty components in a PATH-like variable as meaning "."
(the current directory). This is reflected in the processing of
OCAMLTOP_INCLUDE_PATH, CAML_LD_LIBRARY_PATH and ld.conf where either a
blank component or a blank line is interpreted as "."

Somewhat confusingly, this processing is applied inconsistently between
Unix and Windows (it's confusing given that Windows more readily
includes the current working directory by default in PATH searches).

It also has the side-effect that a "Set But Null" environment variable
is interpreted as "." which counter-intuitively makes
CAML_LD_LIBRARY_PATH= ocamlrun add the current working directory to the
search path.

Blank lines and empty components of both OCAMLTOP_INCLUDE_PATH and
CAML_LD_LIBRARY_PATH are now ignored. The current working directory can
still be explicitly included, of course, by adding a "." entry/line
where required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: Full matrix Full CI test matrix relocatable PRs related to the Relocatable Compiler project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants