ocaml / opam-repository

Main public package repository for opam, the source package manager of OCaml.
https://opam.ocaml.org
Creative Commons Zero v1.0 Universal
517 stars 1.14k forks source link

WARNING: Cannot revert permission change of lib/ocaml/stublibs and lib/ocaml #21205

Open sidkshatriya opened 2 years ago

sidkshatriya commented 2 years ago

The following cryptic warning is issued when I try to install merlin in a ocaml 4.14 switch:

[WARNING] While removing num.1.4: cannot revert:
  - permission change of:
      - [hash] lib/ocaml/stublibs
      - [hash] lib/ocaml

Is it possible to know why this warning is being issued and what needs to be done to fix it?

Please see below:

$ opam install merlin.4.5-414
The following actions will be performed:
  ↻ recompile num                      1.4     [upstream or system changes]
  ∗ install   dot-merlin-reader        4.2     [required by merlin]
  ↻ recompile sexplib                  v0.15.0 [uses num]
  ∗ install   merlin                   4.5-414
  ↻ recompile sexp_pretty              v0.15.0 [uses sexplib]
  ↻ recompile ppx_log                  v0.15.0 [uses sexplib]
  ↻ recompile ppx_jane                 v0.15.0 [uses ppx_log]
  ↻ recompile int_repr                 v0.15.0 [uses ppx_jane]
  ↻ recompile base_bigstring           v0.15.0 [uses ppx_jane]
  ↻ recompile core                     v0.15.0 [uses sexplib]
  ↻ recompile expect_test_helpers_core v0.15.0 [uses core, sexp_pretty]
  ↻ recompile bignum                   v0.15.0 [uses num]
===== ∗ 2   ↻ 10 =====
Do you want to continue? [Y/n] Y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved base_bigstring.v0.15.0  (cached)
⬇ retrieved bignum.v0.15.0  (cached)
⬇ retrieved core.v0.15.0  (cached)
⬇ retrieved expect_test_helpers_core.v0.15.0  (cached)
⬇ retrieved int_repr.v0.15.0  (cached)
⬇ retrieved num.1.4  (cached)
⬇ retrieved ppx_jane.v0.15.0  (cached)
⬇ retrieved ppx_log.v0.15.0  (cached)
⬇ retrieved sexp_pretty.v0.15.0  (cached)
⬇ retrieved sexplib.v0.15.0  (cached)
⊘ removed   bignum.v0.15.0
⊘ removed   expect_test_helpers_core.v0.15.0
⊘ removed   core.v0.15.0
⊘ removed   base_bigstring.v0.15.0
⊘ removed   int_repr.v0.15.0
⊘ removed   ppx_jane.v0.15.0
⊘ removed   ppx_log.v0.15.0
⊘ removed   sexp_pretty.v0.15.0
⊘ removed   sexplib.v0.15.0
[WARNING] While removing num.1.4: cannot revert:
  - permission change of:
      - [hash] lib/ocaml/stublibs
      - [hash] lib/ocaml

⊘ removed   num.1.4
∗ installed num.1.4
⬇ retrieved dot-merlin-reader.4.2  (https://opam.ocaml.org/cache)
∗ installed sexplib.v0.15.0
∗ installed dot-merlin-reader.4.2
∗ installed sexp_pretty.v0.15.0
∗ installed ppx_log.v0.15.0
∗ installed ppx_jane.v0.15.0
∗ installed int_repr.v0.15.0
∗ installed base_bigstring.v0.15.0
⬇ retrieved merlin.4.5-414  (https://opam.ocaml.org/cache)
∗ installed merlin.4.5-414
∗ installed core.v0.15.0
∗ installed expect_test_helpers_core.v0.15.0
∗ installed bignum.v0.15.0
Done.

<><> merlin.4.5-414 installed successfully ><><><><><><><><><><><><><><><><><><>
...
...
$ opam config report
# opam config report
# opam-version         2.1.1 
# self-upgrade         no
# system               arch=x86_64 os=linux os-distribution=ubuntu os-version=20.04
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 7
# repositories         2 (http), 4 (version-controlled) (default repo at 76354fbf)
# pinned               0
# current-switch       /home/abcxyz/ocaml-play
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /home/abcxyz/ocaml-play/_opam/lib/ocaml/stublibs:/home/abcxyz/ocaml-play/_opam/lib/ocaml
# ocaml:preinstalled   false
# ocaml:compiler       4.14.0
dra27 commented 2 years ago

Is it repeatable if you do opam reinstall num? It's not related to Merlin - there was an alteration to the num package in opam-repository which has caused it to need recompiling (that's the "upstream or system changes" part of the first screen).

The warning itself is noting that the permissions on those directories were altered when num was installed, but opam doesn't have the original changes, so it can't set them back. I expect that it's the use of install -d in num's Makefile which did it: https://github.com/ocaml/num/blob/703e1f883c8728ed0abaed6e2d5cdd3fc7e3cb46/src/Makefile#L89 and https://github.com/ocaml/num/blob/703e1f883c8728ed0abaed6e2d5cdd3fc7e3cb46/src/Makefile#L95

sidkshatriya commented 2 years ago

Thanks for your quick response.

The warning is not repeatable when re-installing num

$ opam reinstall num
The following actions will be performed:
  ↻ recompile num                      1.4
  ↻ recompile sexplib                  v0.15.0 [uses num]
  ↻ recompile sexp_pretty              v0.15.0 [uses sexplib]
  ↻ recompile ppx_log                  v0.15.0 [uses sexplib]
  ↻ recompile ppx_jane                 v0.15.0 [uses ppx_log]
  ↻ recompile int_repr                 v0.15.0 [uses ppx_jane]
  ↻ recompile base_bigstring           v0.15.0 [uses ppx_jane]
  ↻ recompile core                     v0.15.0 [uses sexplib]
  ↻ recompile expect_test_helpers_core v0.15.0 [uses core, sexp_pretty]
  ↻ recompile bignum                   v0.15.0 [uses num]
===== ↻ 10 =====
Do you want to continue? [Y/n] Y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved base_bigstring.v0.15.0  (cached)
⬇ retrieved bignum.v0.15.0  (cached)
⬇ retrieved core.v0.15.0  (cached)
⬇ retrieved expect_test_helpers_core.v0.15.0  (cached)
⬇ retrieved int_repr.v0.15.0  (cached)
⬇ retrieved num.1.4  (cached)
⬇ retrieved ppx_jane.v0.15.0  (cached)
⬇ retrieved ppx_log.v0.15.0  (cached)
⬇ retrieved sexp_pretty.v0.15.0  (cached)
⬇ retrieved sexplib.v0.15.0  (cached)
⊘ removed   bignum.v0.15.0
⊘ removed   expect_test_helpers_core.v0.15.0
⊘ removed   core.v0.15.0
⊘ removed   base_bigstring.v0.15.0
⊘ removed   int_repr.v0.15.0
⊘ removed   ppx_jane.v0.15.0
⊘ removed   ppx_log.v0.15.0
⊘ removed   sexp_pretty.v0.15.0
⊘ removed   sexplib.v0.15.0
⊘ removed   num.1.4
∗ installed num.1.4
∗ installed sexplib.v0.15.0
∗ installed sexp_pretty.v0.15.0
∗ installed ppx_log.v0.15.0
∗ installed ppx_jane.v0.15.0
∗ installed int_repr.v0.15.0
∗ installed base_bigstring.v0.15.0
∗ installed core.v0.15.0
∗ installed expect_test_helpers_core.v0.15.0
∗ installed bignum.v0.15.0
Done.
dra27 commented 2 years ago

Sorry, I suggested the wrong thing - it would need to be in a new switch. I think it's correct that if you create a temporary switch (opam switch create temp ocaml-base-compiler.4.14.0, say) and then opam install num in that switch followed by opam reinstall num that you'll see that message again?

dra27 commented 2 years ago

I think the possible fix for this would be in the num package description in opam-repository, to pass "INSTALL_DIR=mkdir -p" to make install to override its using install -d, but it'd be useful to confirm that it's definitely that which changes things.

dra27 commented 1 year ago

The next release of the num library should address this (as it generates a num.install instead of using the install command)