read_extra_kconfig

Function read_extra_kconfig 

Source
pub fn read_extra_kconfig(
    path: &Path,
    cli_label: &str,
) -> Result<String, String>
Expand description

Read a --extra-kconfig PATH file. Returns Ok(content) on success or Err(message) with an actionable diagnostic naming --extra-kconfig and the user’s literal input path verbatim so a typo names the exact string they passed.

Four distinguishing arms each produce an actionable message:

  • ENOENT (not-found) → tells the operator to verify the path spelling and that the file exists
  • EISDIR (is-a-directory) → tells the operator to pass a regular file rather than a directory
  • EACCES (permission-denied) → tells the operator to check file ownership and mode
  • empty file (zero-byte read success) → emits a tracing::warn! explaining the cache-slot consequence and pointing at the likely operator intent (a non-empty fragment), then proceeds

Other I/O errors fall through with the OS error rendered verbatim (--extra-kconfig {path}: {os error}). A non-UTF-8 file errors with a message identifying the constraint (kconfig fragments are ASCII text).

Symlinks resolve transparently (std::fs::read opens through open(2) which follows symlinks per kernel default).