Skip to content

Creation of opam switch fails if the cwd get erased #4455

@dbuenzli

Description

@dbuenzli

I don't think it's a super important issue so don't hesitate to close if it makes it for easier operations.

But it seems that if you are in a directory, invoke opam switch create to create a non-local switch and then somehow erase that directory you end up with:

[ERROR] Actions cancelled because of Sys_error("No such file or directory")
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [Y/n] n
Fatal error:
Sys_error("No such file or directory")
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Backtrace:
  Raised at file "src/client/opamSwitchCommand.ml", line 348, characters 4-11
  Called from file "src/client/opamCommands.ml", line 2126, characters 8-177
  Called from file "src/state/opamGlobalState.ml", line 162, characters 14-18
  Re-raised at file "src/core/opamStd.ml", line 1164, characters 4-38
  Called from file "src_ext/cmdliner/src/cmdliner_term.ml", line 27, characters 19-24
  Called from file "src_ext/cmdliner/src/cmdliner.ml", line 27, characters 27-34
  Called from file "src_ext/cmdliner/src/cmdliner.ml", line 106, characters 32-39
  Called from file "src_ext/cmdliner/src/cmdliner.ml", line 136, characters 18-36
  Called from file "src_ext/cmdliner/src/cmdliner.ml", line 251, characters 22-48
  Called from file "src/client/opamMain.ml", line 207, characters 6-64
  Called from file "src/client/opamMain.ml", line 136, characters 6-10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions