Skip to content

Permission Denied Error Due to Unset ELM_HOME Environment Variable in Stuff Module #2315

@blackeuler

Description

@blackeuler

Description

When running the Elm compiler without the ELM_HOME environment variable set, it defaults to using the the location of elm im assuming for storing data. In certain environments, the process may lack the necessary permissions to write to this directory, resulting in a Permission Denied error.

This issue stems from the getElmHome function within the Stuff module in the Elm compiler source code. Below is the relevant snippet from the Stuff module:

getElmHome :: IO FilePath
getElmHome =
  do  maybeCustomHome <- Env.lookupEnv "ELM_HOME"
      case maybeCustomHome of
        Just customHome -> return customHome
        Nothing -> Dir.getAppUserDataDirectory "elm"

In the absence of the ELM_HOME environment variable, getElmHome defaults to using AppUserDataDirectory.

Steps to Reproduce

  1. Ensure the ELM_HOME environment variable is not set.
  2. Run the Elm compiler command in an environment where the AppUserDataDirectory is not writable by the process.
  3. Observe the Permission Denied error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions