Skip to content

resinator should not observe any environment variables #17585

Description

@andrewrk

One of zig's principles as a toolchain is to reduce dependencies on global state of the system, so that collaborators on wildly different systems can have a seamless experience working with each other.

To that end, this code should be deleted:

if (!options.ignore_include_env_var) {
const INCLUDE = std.process.getEnvVarOwned(allocator, "INCLUDE") catch "";
defer allocator.free(INCLUDE);
// TODO: Should this be platform-specific? How does windres/llvm-rc handle this (if at all)?
var it = std.mem.tokenize(u8, INCLUDE, ";");
while (it.next()) |search_path| {
var dir = openSearchPathDir(options.cwd, search_path) catch continue;
errdefer dir.close();
try search_dirs.append(.{ .dir = dir, .path = try allocator.dupe(u8, search_path) });
}
}

All include paths that are intended to be observed by resinator should be provided explicitly by the user, and explicitly for resinator and no other files, and it should be per invocation rather than global.

I noticed this when enhancing zig env to tattle on what environment variables are possibly observed by the compiler, and it's unfortunate that INCLUDE is in this list.

cc @squeek502

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis proposal is planned.enhancementSolving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions