Skip to content

Running vp run in environment with LD_PRELOAD=any_value fails with EINVAL #340

@ekzhang

Description

@ekzhang

Thank you for an incredible project! So I'm trying to set this up in a complex env and have LD_PRELOAD in the global profile (for reasons beyond me, it's complicated…) and anyway, this is breaking with cache: true in vite.config.ts.

import { defineConfig } from "vite-plus";

export default defineConfig({
  run: {
    cache: true,
  },
});
shell-$ vp run -r build
VITE+ - The Unified Toolchain for the Web

~/my-package-name-in-workspace$ vp pack
✗ Failed to spawn process: failed to prepare the command for injection: Invalid argument (os error 22)

This originates on line 173 of fspy_shared_unix/src/exec/mod.rs:

pub fn ensure_env(
envs: &mut Vec<(BString, Option<BString>)>,
name: impl AsRef<BStr>,
value: impl AsRef<BStr>,
) -> nix::Result<()> {
let name = name.as_ref();
let value = value.as_ref();
let existing_value = envs.iter().find_map(|(n, v)| if n == name { v.as_ref() } else { None });
if let Some(existing_value) = existing_value {
return if existing_value == value { Ok(()) } else { Err(nix::Error::EINVAL) };
}
envs.push((name.to_owned(), Some(value.to_owned())));
Ok(())
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions