jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.89k stars 285 forks source link

oci install requires sudo #1696

Open alehostert opened 8 months ago

alehostert commented 8 months ago

Describe the bug

oci (oracle cloud cli) requires sudo authentication for installation. If you run mise install, you'll get a false sensation of stuck:

➜  mise install
######################################################################## 100,0%
mise oci@3.37.10       python3 /tmp/oci_cli_install_tmp_yzX6  --accept-all-defaults --install-dir /home/ahostert/.local/share/mise/installs ⠙ 1s 
mise oci@3.37.10       python3 /tmp/oci_cli_install_tmp_yzX6  --accept-all-defaults --install-dir /home/ahostert/.local/share/mise/installs ⠒ 79m <<<<<< Hit Ctrl+C here
mise missing: oci@3.37.10
➜  

To Reproduce

mise install oci

Expected behavior We should be able to see the prompt for password being asked by sudo, so we can authorize the installation to proceed:

[sudo] password for my_user: 

mise doctor output

version: 2024.2.17 linux-x64 (17e6351 2024-02-22)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Thu, 22 Feb 2024 01:00:40 +0000
  Rust Version: rustc 1.76.0 (07dca489a 2024-02-04)
  Profile: release

shell: 
  /bin/bash
  GNU bash, versão 5.0.17(1)-release (x86_64-pc-linux-gnu)
  Copyright (C) 2019 Free Software Foundation, Inc.
  Licença GPLv3+: GNU GPL versão 3 ou posterior <http://gnu.org/licenses/gpl.html>.

  Este é um software livre; você é livre para alterar e redistribuí-lo.
  Há NENHUMA GARANTIA, na extensão permitida pela lei.

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/git/terraform/prod/.mise.toml

plugins: 
  bun           (core)
  deno          (core)
  go            (core)
  java          (core)
  node          (core)
  oci           https://github.com/yasn77/asdf-oci.git#4b228f4
  python        (core)
  ruby          (core)
  terraform     https://github.com/asdf-community/asdf-hashicorp.git#197e3ec
  terraform-ls  https://github.com/asdf-community/asdf-hashicorp.git#197e3ec

toolset: 
  oci@3.37.10      
  terraform@1.7.1  

env_vars: 
  MISE_SHELL=bash

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = false
  python_default_packages_file = "/home/ahostert/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  python_venv_auto_create = false
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No problems found

Additional context

It's easy to bypass this issue. All we have to do is run mise install with --verbose (-v) flag (some parts are ommited/non-relevant):

➜  mise install -v
[DEBUG] ARGS: /home/ahostert/.local/bin/mise install -v
[DEBUG] Config {
    Config Files: [
        "~/git/terraform/prod/.mise.toml",
        "~/.config/mise/config.toml",
    ],
}
[DEBUG] Toolset: oci@3.37.10, terraform@1.7.1, terraform-ls@0.32.4
downloading
~/.local/share/mise/plugins/oci/bin/download
[DEBUG] $ ~/.local/share/mise/plugins/oci/bin/download 
* Downloading oci release 3.37.10...
installing
~/.local/share/mise/plugins/oci/bin/install
[DEBUG] $ ~/.local/share/mise/plugins/oci/bin/install 
WARNING: Some interactive prompts may not function correctly if this script is piped into bash (e.g. 'curl "https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh" | bash)'
WARNING: Script should either be downloaded and invoked directly, or be run with the following command: bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
Running with --accept-all-defaults
Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v3.37.10/scripts/install/install.py to /tmp/oci_cli_install_tmp_DKqd.
######################################################################## 100,0%
Running install script.
python3 /tmp/oci_cli_install_tmp_DKqd  --accept-all-defaults --install-dir /home/ahostert/.local/share/mise/installs/oci/3.37.10/lib --exec-dir /home/ahostert/.local/share/mise/installs/oci/3.37.10/bin --script-dir /home/ahostert/.local/share/mise/installs/oci/3.37.10/bin/oci-cli-scripts --rc-file-path /home/ahostert/.bashrc.oci --oci-cli-version 3.37.10
[sudo] password for ahostert: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< sudo prompt here!
Atingido:1 http://br.archive.ubuntu.com/ubuntu focal InRelease
Obter:2 http://br.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]

... output ommited here

oci 3.37.10 installation was successful!
mise oci@3.37.10 ✓ installed
➜

The purpose of this issue is to report the "stuck feeling" caused by the sudo input request, with its workaround.

jdx commented 8 months ago

It should probably work if you pass --raw

alehostert commented 8 months ago

Yep, works better with --raw (less verbosity) :smile: