Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with broken installation if upgrade called from invalid cwd #2442

Open
yminsky opened this issue Feb 20, 2016 · 4 comments · May be fixed by #5966
Open

Crash with broken installation if upgrade called from invalid cwd #2442

yminsky opened this issue Feb 20, 2016 · 4 comments · May be fixed by #5966

Comments

@yminsky
Copy link

yminsky commented Feb 20, 2016

The upgrade I just attempted died in a rather mysterious way.

[ERROR] Actions cancelled because of Sys_error("No such file or directory")

The former state can be restored with:
opam switch import "~/.opam/system/backup/state-20160120061500.export"
Fatal error:
Sys_error("No such file or directory")
Backtrace:
  Raised at file "client/opamSolution.ml", line 468, characters 10-11
  Called from file "client/opamClient.ml", line 913, characters 19-71
  Called from file "client/opamClient.ml", line 153, characters 4-7

Here's the full terminal output.

$ opam upgrade
The following actions will be performed:
  ↗  upgrade   ocp-build           1.99.9-beta to 1.99.11-beta
  ↗  upgrade   ppx_deriving        3.0 to 3.1
  ↗  upgrade   lacaml              7.2.6 to 8.0.5
  ∗  install   base-ocamlbuild     base
  ↻  recompile ocp-indent          1.5.2                        [uses ocp-build]
  ↻  recompile ocamlbuild          0
  ↻  recompile ppx_driver          113.24.00
  ↻  recompile oasis               0.4.5
  ↻  recompile lbfgs               0.8.7                        [uses lacaml]
  ↻  recompile cppo                1.3.1
  ↻  recompile ppx_type_conv       113.24.00                    [uses ppx_deriving]
  ↻  recompile ppx_pipebang        113.24.00
  ↻  recompile ppx_let             113.24.00
  ↻  recompile ppx_inline_test     113.24.00
  ↻  recompile ppx_here            113.24.00
  ↻  recompile yojson              1.3.0
  ↻  recompile utop                1.18.1
  ↻  recompile ocplib-endian       0.8
  ↻  recompile js_of_ocaml         2.7                          [uses ppx_deriving]
  ↻  recompile ppx_variants_conv   113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_typerep_conv    113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_sexp_conv       113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_fields_conv     113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_enumerate       113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_conv_func       113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_compare         113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_bin_prot        113.24.01                    [uses ppx_type_conv]
  ↻  recompile ppx_bench           113.24.00
  ↻  recompile ppx_fail            113.24.00
  ↻  recompile ppx_deriving_yojson 2.4                          [uses ppx_deriving]
  ↻  recompile merlin              2.3.1
  ↻  recompile xtmpl               0.13.0                       [uses js_of_ocaml]
  ↻  recompile xmldiff             0.5.0                        [uses js_of_ocaml]
  ↻  recompile d3                  0.2.2                        [uses js_of_ocaml]
  ↗  upgrade   ipaddr              2.4.0 to 2.7.0
  ↻  recompile ppx_sexp_value      113.24.00                    [uses ppx_sexp_conv]
  ↻  recompile ppx_sexp_message    113.24.00                    [uses ppx_sexp_conv]
  ↻  recompile ppx_custom_printf   113.24.00                    [uses ppx_sexp_conv]
  ↻  recompile ppx_xml_conv        113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_assert          113.24.00                    [uses ppx_type_conv]
  ↻  recompile ppx_expect          113.24.00                    [uses ppx_sexp_conv, ppx_compare, ppx_assert, etc.]
  ↻  recompile ppx_jane            113.24.01                    [uses ppx_typerep_conv, ppx_fields_conv, ppx_compare, etc.]
  ↻  recompile core_kernel         113.24.00                    [uses ppx_assert]
  ↻  recompile re2                 113.24.00                    [uses ppx_assert]
  ↻  recompile patience_diff       113.24.00                    [uses ppx_assert]
  ↻  recompile core                113.24.01                    [uses ppx_assert]
  ↻  recompile async_kernel        113.24.00                    [uses ppx_assert]
  ↻  recompile textutils           113.24.00                    [uses ppx_assert]
  ↻  recompile incremental         113.24.00                    [uses ppx_assert]
  ↻  recompile async_unix          113.24.00                    [uses ppx_assert]
  ↻  recompile async_rpc_kernel    113.24.00                    [uses ppx_assert]
  ↻  recompile core_extended       113.24.00                    [uses ppx_assert]
  ↻  recompile async_extra         113.24.00                    [uses ppx_assert]
  ↻  recompile patdiff             113.24.00                    [uses ppx_assert]
  ↻  recompile core_profiler       113.24.00                    [uses ppx_assert]
  ↻  recompile core_bench          113.24.00                    [uses ppx_assert]
  ↻  recompile async               113.24.00                    [uses ppx_assert]
  ↗  upgrade   cstruct             1.8.0 to 1.9.0
  ↻  recompile rpc_parallel        113.24.00                    [uses ppx_assert]
  ↻  recompile async_shell         113.24.00                    [uses ppx_assert]
  ↻  recompile async_find          113.24.00                    [uses ppx_assert]
  ↻  recompile async_inotify       113.24.00                    [uses ppx_assert]
  ↻  recompile async_extended      113.24.00                    [uses ppx_assert]
===== ∗  1   ↻  57   ↗  5 =====
Do you want to continue ? [Y/n] y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[async] Archive in cache
[async_extended] Archive in cache
[async_extra] Archive in cache
[async_find] Archive in cache
[async_inotify] Archive in cache
[async_kernel] Archive in cache
[async_rpc_kernel] Archive in cache
[async_shell] Archive in cache
[async_unix] Archive in cache
[core_bench] Archive in cache
[core_extended] Archive in cache
[core_kernel] Archive in cache
[core_profiler] Archive in cache
[cppo] Archive in cache
[cstruct] Archive in cache
[d3] Archive in cache
[incremental] Archive in cache
[default] https://opam.ocaml.org/archives/ipaddr.2.7.0+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/cstruct.1.9.0+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/core.113.24.01+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/lacaml.8.0.5+opam.tar.gz downloaded
[merlin] Archive in cache
[default] https://opam.ocaml.org/archives/js_of_ocaml.2.7+opam.tar.gz downloaded
[ocp-build] Archive in cache
[default] https://opam.ocaml.org/archives/lbfgs.0.8.7+opam.tar.gz downloaded
[ocp-indent] Archive in cache
[ocplib-endian] Archive in cache
[patdiff] Archive in cache
[patience_diff] Archive in cache
[default] https://opam.ocaml.org/archives/ocp-build.1.99.11-beta+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_assert.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_bench.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_bin_prot.113.24.01+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/oasis.0.4.5+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_compare.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_conv_func.113.24.00+opam.tar.gz downloaded
[ppx_deriving_yojson] Archive in cache
[default] https://opam.ocaml.org/archives/ppx_custom_printf.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_deriving.3.1+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_driver.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_enumerate.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_expect.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_fail.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_fields_conv.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_here.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_jane.113.24.01+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_inline_test.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_let.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_pipebang.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_sexp_message.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_sexp_conv.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_sexp_value.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_type_conv.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ppx_typerep_conv.113.24.00+opam.tar.gz downloaded
[re2] Archive in cache
[rpc_parallel] Archive in cache
[textutils] Archive in cache
[default] https://opam.ocaml.org/archives/ppx_variants_conv.113.24.00+opam.tar.gz downloaded
[xmldiff] Archive in cache
[xtmpl] Archive in cache
[default] https://opam.ocaml.org/archives/ppx_xml_conv.113.24.00+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/yojson.1.3.0+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/utop.1.18.1+opam.tar.gz downloaded

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
⊘  removed   async_extended.113.24.00
⊘  removed   async_inotify.113.24.00
⊘  removed   async_find.113.24.00
⊘  removed   async_shell.113.24.00
⊘  removed   core_bench.113.24.00
⊘  removed   core_profiler.113.24.00
⊘  removed   incremental.113.24.00
⊘  removed   merlin.2.3.1
⊘  removed   ocp-indent.1.5.2
⊘  removed   lbfgs.0.8.7
⊘  removed   ipaddr.2.4.0
⊘  removed   patdiff.113.24.00
⊘  removed   core_extended.113.24.00
⊘  removed   patience_diff.113.24.00
⊘  removed   ppx_deriving_yojson.2.4
⊘  removed   ppx_xml_conv.113.24.00
⊘  removed   ppx_conv_func.113.24.00
⊘  removed   re2.113.24.00
⊘  removed   rpc_parallel.113.24.00
⊘  removed   textutils.113.24.00
⊘  removed   lacaml.7.2.6
⊘  removed   ocp-build.1.99.9-beta
⊘  removed   xmldiff.0.5.0
⊘  removed   xtmpl.0.13.0
∗  installed base-ocamlbuild.base
⊘  removed   utop.1.18.1
⊘  removed   yojson.1.3.0
⊘  removed   d3.0.2.2
⊘  removed   cstruct.1.8.0
⊘  removed   async.113.24.00
⊘  removed   async_extra.113.24.00
⊘  removed   async_rpc_kernel.113.24.00
⊘  removed   async_unix.113.24.00
⊘  removed   async_kernel.113.24.00
⊘  removed   core.113.24.01
⊘  removed   core_kernel.113.24.00
⊘  removed   ppx_jane.113.24.01
⊘  removed   ppx_bench.113.24.00
⊘  removed   ppx_bin_prot.113.24.01
⊘  removed   ppx_enumerate.113.24.00
⊘  removed   ppx_expect.113.24.00
⊘  removed   ppx_assert.113.24.00
⊘  removed   ppx_compare.113.24.00
⊘  removed   ppx_custom_printf.113.24.00
⊘  removed   ppx_fail.113.24.00
⊘  removed   ppx_fields_conv.113.24.00
⊘  removed   ppx_inline_test.113.24.00
⊘  removed   ppx_let.113.24.00
⊘  removed   ppx_pipebang.113.24.00
⊘  removed   ppx_sexp_message.113.24.00
⊘  removed   ppx_sexp_value.113.24.00
⊘  removed   ppx_here.113.24.00
⊘  removed   ppx_sexp_conv.113.24.00
⊘  removed   ppx_typerep_conv.113.24.00
⊘  removed   ppx_variants_conv.113.24.00
⊘  removed   ppx_type_conv.113.24.00
⊘  removed   ppx_driver.113.24.00
⊘  removed   ocplib-endian.0.8
⊘  removed   js_of_ocaml.2.7
[ERROR] Actions cancelled because of Sys_error("No such file or directory")

The former state can be restored with:
opam switch import "~/.opam/system/backup/state-20160120061500.export"
Fatal error:
Sys_error("No such file or directory")
Backtrace:
  Raised at file "client/opamSolution.ml", line 468, characters 10-11
  Called from file "client/opamClient.ml", line 913, characters 19-71
  Called from file "client/opamClient.ml", line 153, characters 4-7
@yminsky
Copy link
Author

yminsky commented Feb 20, 2016

Upon some further investigation, I believe this occurred because the directory that this was being run from no longer existed. It's perhaps worth bailing out earlier and giving a better error message in this case.

@yminsky yminsky changed the title opam crashes during upgrade Crash with broken installation if upgrade called from invalid cwd Feb 20, 2016
@dsheets
Copy link
Member

dsheets commented Feb 20, 2016

This is similar to #2435 and probably indicates that we need to test various operations when in an invalid cwd.

@ghost
Copy link

ghost commented Feb 22, 2016

Which version of opam are you using ? I'm not able to reproduce with master, nor branch-1.2.

@AltGr
Copy link
Member

AltGr commented May 17, 2016

opam normally detects when it's run with an invalid CWD, but may sometimes break when run from a directory that it itself removes, e.g. ~/.opam/<switch>/build/ (now ~/.opam/<switch>/.opam-switch/build). I am not sure if we should make sure to remove the parts that rely on cwd, or if we should change it at startup always.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants