Skip to content

spago shouldn't try to create $HOME if it doesn't exist #711

@dhess

Description

@dhess

While trying to make spago test work in a nixpkgs derivation, I ran into this issue:

[error] Directory "/" is not accessible. Permissions {readable = True, writable = False, executable = False, searchable = True}

This happens because, when nixpkgs builds a derivation, it sets $HOME to a non-existent location:

2020-12-14 14:15:37.905847: [debug] Running `getGlobalCacheDir`
@(src/Spago/RunEnv.hs:44:7)
2020-12-14 14:15:37.906423: [debug] Directory "/homeless-shelter/.cache/spago" does not exist, creating...
@(src/Spago/Prelude.hs:189:7)
2020-12-14 14:15:37.906462: [debug] Directory "/homeless-shelter/.cache" does not exist, creating...
@(src/Spago/Prelude.hs:189:7)
2020-12-14 14:15:37.906487: [debug] Directory "/homeless-shelter" does not exist, creating...
@(src/Spago/Prelude.hs:189:7)
2020-12-14 14:15:37.906559: [error] Directory "/" is not accessible. Permissions {readable = True, writable = False, executable = False, searchable = True}
@(src/Spago/Prelude.hs:125:13)

Note that spago tries to do this even when spago test is run with --global-cache=skip!

So I think there are 2 issues here:

  1. Don't go any further up the path than $HOME when trying to create the global cache directory.
  2. --global-cache=skip should not try to create $HOME/.cache/spago at all.

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