# eb-local.foreign ::::{zig:module} eb-local.foreign :file: src/foreign.zig :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig Host and container paths that must not leak into a build. `eb-local doctor` reports entries of `PERL5LIB`, `PYTHONPATH`, `R_LIBS*`, `JULIA_LOAD_PATH`, `JULIA_DEPOT_PATH`, `NODE_PATH`, `CMAKE_PREFIX_PATH` and `PKG_CONFIG_PATH`, and compiler-wrapper variables, that resolve outside the approved prefixes. `CARGO_TARGET_*_LINKER`, `CARGO_BUILD_RUSTC_WRAPPER`, `RUSTC_WORKSPACE_WRAPPER`, `R_MAKEVARS_USER` and `R_MAKEVARS_SITE` are wrapper variables. `RUSTFLAGS` and `CARGO_TARGET_*_RUSTFLAGS` are flag strings, so they are not paths. It also reports the timezone `/etc/localtime` resolves to, a bind mount of that file, and host library directories a container runtime injected. A build drops the foreign entries only when `build.clear_foreign_prefixes` is set. :::: ## Types ::::{zig:type} eb-local.foreign.Code :signature: pub const Code = enum :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L39 What doctor prints for one finding. The words are in `main.zig`, so a how-to that shows a line can be checked against that format. :::{zig:field} eb-local.foreign.Code.none :signature: none :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L40 ::: :::{zig:field} eb-local.foreign.Code.list_keep :signature: list_keep :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L41 ::: :::{zig:field} eb-local.foreign.Code.list_drop :signature: list_drop :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L42 ::: :::{zig:field} eb-local.foreign.Code.wrap_keep :signature: wrap_keep :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L43 ::: :::{zig:field} eb-local.foreign.Code.wrap_drop :signature: wrap_drop :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L44 ::: :::{zig:field} eb-local.foreign.Code.timezone :signature: timezone :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L45 ::: :::{zig:field} eb-local.foreign.Code.timezone_bind :signature: timezone_bind :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L46 ::: :::{zig:field} eb-local.foreign.Code.host_lib :signature: host_lib :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L47 ::: :::{zig:field} eb-local.foreign.Code.host_none :signature: host_none :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L48 ::: :::: ::::{zig:type} eb-local.foreign.Finding :signature: pub const Finding = struct :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L52 One reported path: `name` is the variable, `path` the entry or target. :::{zig:field} eb-local.foreign.Finding.code :signature: code: Code :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L53 ::: :::{zig:field} eb-local.foreign.Finding.name :signature: name: []const u8 = "" :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L54 ::: :::{zig:field} eb-local.foreign.Finding.path :signature: path: []const u8 = "" :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L55 ::: :::: ## Functions :::{zig:function} eb-local.foreign.approvedPrefixes :signature: pub fn approvedPrefixes(a: Allocator, env: *const std.process.Environ.Map, extra: []const []const u8, install_prefix: []const u8) Allocator.Error![]const []const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L65 Prefixes a path may sit under: the EESSI repository, the install prefix, the four EESSI install variables, `extra` (the site's approved prefixes), eb-local's RPATH wrapper directory and its cache. ::: :::{zig:function} eb-local.foreign.scan :signature: pub fn scan(a: Allocator, env: *const std.process.Environ.Map, prefixes: []const []const u8, clear: bool, mountinfo: []const u8) Allocator.Error![]Finding :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L242 Findings for this shell. `clear` selects the words doctor uses; it does not change the environment. ::: :::{zig:function} eb-local.foreign.scrub :signature: pub fn scrub(a: Allocator, env: *std.process.Environ.Map, prefixes: []const []const u8) Allocator.Error!void :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L295 Drop foreign entries from `env`. An empty path list is removed. A compiler-wrapper variable that resolves outside the prefixes is removed. Approved entries stay. Nothing is added. ::: ## Constants :::{zig:constant} eb-local.foreign.path_lists :signature: pub const path_lists = ... :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L23 Path-list variables doctor inspects, besides every `R_LIBS*`. ::: :::{zig:constant} eb-local.foreign.compiler_vars :signature: pub const compiler_vars = ... :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/foreign.zig#L30 Compiler variables whose value is a program or a path. `CCACHE_*`, `SCCACHE_*` and `CMAKE_*_COMPILER_LAUNCHER` are recognised by name. :::