Skip to content

Commit c8ec474

Browse files
committed
Add docs and news.
1 parent 917ffae commit c8ec474

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ New language features
1212
Language changes
1313
----------------
1414

15+
* Specifying a path in `JULIA_DEPOT_PATH` now results in the expansion of empty strings to
16+
omit the default user depot ([#51448]).
17+
1518
Compiler/Runtime improvements
1619
-----------------------------
1720
* Updated GC heuristics to count allocated pages instead of individual objects ([#50144]).

doc/src/manual/environment-variables.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,30 @@ as Julia's code loading mechanisms, look for package registries, installed
125125
packages, named environments, repo clones, cached compiled package images,
126126
configuration files, and the default location of the REPL's history file.
127127

128-
Unlike the shell `PATH` variable but similar to [`JULIA_LOAD_PATH`](@ref JULIA_LOAD_PATH), empty entries in
129-
[`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH) are expanded to the default value of `DEPOT_PATH`. This allows
130-
easy appending, prepending, etc. of the depot path value in shell scripts regardless
131-
of whether [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH) is already set or not. For example, to prepend the
132-
directory `/foo/bar` to `DEPOT_PATH` just do
128+
Unlike the shell `PATH` variable but similar to [`JULIA_LOAD_PATH`](@ref JULIA_LOAD_PATH),
129+
empty entries in [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH) are expanded to the default
130+
value of `DEPOT_PATH`, excluding the user depot. This allows easy overriding of the user
131+
depot, while still retaining access to resources that are bundled with Julia, like cache
132+
files, artifacts, etc. For example, to switch the user depot to `/foo/bar` just do
133133
```sh
134-
export JULIA_DEPOT_PATH="/foo/bar:$JULIA_DEPOT_PATH"
134+
export JULIA_DEPOT_PATH="/foo/bar:"
135135
```
136-
If the [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH) environment variable is already set, its old value will be
137-
prepended with `/foo/bar`. On the other hand, if [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH) is not set, then
138-
it will be set to `/foo/bar:` which will have the effect of prepending `/foo/bar` to
139-
the default depot path. If [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH) is set to the empty string, it expands
140-
to an empty `DEPOT_PATH` array. In other words, the empty string is interpreted as a
141-
zero-element array, not a one-element array of the empty string. This behavior was
142-
chosen so that it would be possible to set an empty depot path via the environment
143-
variable. If you want the default depot path, either unset the environment variable
144-
or if it must have a value, set it to the string `:`.
136+
All package operations, like cloning registrise or installing packages, will now write to
137+
`/foo/bar`, but since the empty entry is expanded to the default system depot, any bundled
138+
resources will still be available. If you really only want to use the depot at `/foo/bar`,
139+
and not load any bundled resources, simply set the environment variable to `/foo/bar`
140+
without the trailing colon.
141+
142+
There are two exceptions to the above rule. First, if [`JULIA_DEPOT_PATH`](@ref
143+
JULIA_DEPOT_PATH) is set to the empty string, it expands to an empty `DEPOT_PATH` array. In
144+
other words, the empty string is interpreted as a zero-element array, not a one-element
145+
array of the empty string. This behavior was chosen so that it would be possible to set an
146+
empty depot path via the environment variable.
147+
148+
Second, if no user depot is specified in [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH), then
149+
the empty entry is expanded to the default depot *including* the user depot. This makes
150+
it possible to use the default depot, as if the environment variable was unset, by setting
151+
it to the string `:`.
145152

146153
!!! note
147154

0 commit comments

Comments
 (0)