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

confirm-level=ask is actually yes? #4900

Open
vphantom opened this issue Nov 8, 2021 · 9 comments
Open

confirm-level=ask is actually yes? #4900

vphantom opened this issue Nov 8, 2021 · 9 comments

Comments

@vphantom
Copy link

vphantom commented Nov 8, 2021

I can't figure out what I did to trigger this, or if it's actually a bug in 2.1.0, but --confirm-level=yes is assumed by default in my setup. If I use --confirm-level=ask explicitly to try to get the old behavior, it incorrectly behaves as though I had specified yes. If I use --confirm-level=no however, then no is correctly assumed.

I'm not running opam through a wrapper script which might make it think the tty is non-interactive.

Any ideas?

$ set |grep OPAM
OPAM_SWITCH_PREFIX=/home/lis/.opam/4.13.1+musl+flambda
$ if tty -s; then echo Interactive; else echo Non-interactive; fi
Interactive
# opam config report
# opam-version         2.1.0
# self-upgrade         no
# system               arch=x86_64 os=linux os-distribution=debian os-version=10
# 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         1 (http) (default repo at c7b1bb0d)
# pinned               0
# current-switch       4.13.1+musl+flambda
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /home/lis/.opam/4.13.1+musl+flambda/lib/ocaml/stublibs:/home/lis/.opam/4.13.1+musl+flambda/lib/ocaml
# ocaml:preinstalled   false
# ocaml:compiler       4.13.1+options+flambda+musl
@kit-ty-kate
Copy link
Member

What is the command that gets you this behaviour?

@vphantom
Copy link
Author

vphantom commented Nov 9, 2021

It's across the board. For example opam install sexp will go right ahead and assume "yes" at the "13 to install, do you want to continue?" prompt.

@rjbou
Copy link
Collaborator

rjbou commented Nov 10, 2021

if yes is activated by --confirmlevel, --yes, or environment variable, you shouldn't have the prompt Do you want to continue?

$ opam install sexp
The following actions will be performed:
  ∗ install conf-g++                1.0     [required by re2]
[...]
  ∗ install sexp                    v0.14.0
===== ∗ 73 =====
Do you want to continue? [Y/n] n
# I answer 'n'

$ opam install sexp --confirm-level=ask
The following actions will be performed:
  ∗ install conf-g++                1.0     [required by re2]
[...]
  ∗ install sexp                    v0.14.0
===== ∗ 73 =====
Do you want to continue? [Y/n] n
# I answer 'n'

$ opam install sexp --confirm-level=yes
The following actions will be performed:
  ∗ install conf-g++                1.0     [required by re2]
[...]
  ∗ install sexp                    v0.14.0
===== ∗ 73 =====

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved async.v0.14.0  (https://opam.ocaml.org/cache)
⬇ retrieved async_kernel.v0.14.0  (https://opam.ocaml.org/cache)
[ERROR] User interruption

@vphantom
Copy link
Author

Weird. In my case I always see the prompt, but it is answered automatically. I can't seem to convince opam that I want interaction.

@kit-ty-kate
Copy link
Member

Reading the code for this, I think the issue is that somehow on your machine you’re hitting some kind of Unix exception https://github.com/ocaml/opam/blob/master/src/core/opamConsole.ml#L757
As to why, i have no idea. If you’re feeling up to it you can try adding logs to this function and see what breaks but without knowing what is different on your system I have no idea how to debug this.

By any chance, how did you install opam? Through the precomiled binaries/install.sh or something else?

@vphantom
Copy link
Author

I initially used the install.sh but I think that for the upgrade to 2.1.0 I just downloaded the prebuilt binary from GitHub. A binary diff confirms that it's the binary I'm currently using.

Of note is that I use kitty as my terminal and do everything in tmux. I have the relevant files for both in my ~.terminfo/. This was already the case when I used opam <2.1.0 and interactive prompts worked as expected.

@rjbou
Copy link
Collaborator

rjbou commented Nov 19, 2021

If we prepare a branch, is it possible for you to test it?

@vphantom
Copy link
Author

I don't understand the instructions at that page. The "From Source" section doesn't mention any compiling step.

But yes if there's something I can A/B test vs 2.1.0 I'd be happy to help. 😃

@rjbou
Copy link
Collaborator

rjbou commented Nov 22, 2021

It's normal that there is no compilation step. As you install everything with your opam, you don't need to compile things yourself :)
I'll prepare you a branch to test then.

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

No branches or pull requests

3 participants