topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.76k stars 117 forks source link

On Windows, -y isn't passed to the topgrade-in-WSL step #558

Open ssmendon opened 9 months ago

ssmendon commented 9 months ago

Erroneous Behavior

topgrade -v -y --only wsl prompts for confirmation.

Expected Behavior

It shouldn't prompt for confirmation, or it should be documented as such.

Steps to reproduce

  1. topgrade -v -y --only wsl

Possible Cause (Optional)

See #521.

Problem persists without calling from topgrade

Did you run topgrade through Remote Execution

If yes, does the issue still occur when you run topgrade directlly in your remote host

Additional Details

Built from sources.

Topgrade 12.0.2 / f986ebb576ede061ad61b8448c982efabfaa25fe

Verbose Output (topgrade -v)

 ❯ cargo run -- -v -y --only wsl
    Finished dev [unoptimized + debuginfo] target(s) in 0.20s
     Running `target\debug\topgrade.exe -v -y --only wsl`
DEBUG Version: 12.0.2
DEBUG OS: x86_64-pc-windows-msvc
DEBUG Args { inner: ["target\\debug\\topgrade.exe", "-v", "-y", "--only", "wsl"] }
DEBUG Binary path: Ok("C:\\Users\\df\\source\\github\\ssmendon\\topgrade\\target\\debug\\topgrade.exe")
DEBUG Self Update: false
DEBUG Detected "C:\\Program Files\\Git\\cmd\\git.EXE" as "git"
DEBUG Detected "C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.3.7.0_x64__8wekyb3d8bbwe\\pwsh.EXE" as "pwsh"
DEBUG Executing command `C:\Program Files\WindowsApps\Microsoft.PowerShell_7.3.7.0_x64__8wekyb3d8bbwe\pwsh.EXE -NoProfile -Command 'Split-Path $profile'`
DEBUG Path "C:\\Users\\df\\Documents\\PowerShell" exists
DEBUG Path "C:\\Users\\df\\AppData\\Roaming\\.emacs.d" doesn't exist
DEBUG Cannot find "doas"
DEBUG Detected "C:\\tools\\gsudo\\Current\\sudo.EXE" as "sudo"
DEBUG Step "WSL"
DEBUG Detected "C:\\WINDOWS\\system32\\wsl.EXE" as "wsl"
DEBUG Detected "C:\\WINDOWS\\system32\\wsl.EXE" as "wsl"
DEBUG Executing command `C:\WINDOWS\system32\wsl.EXE --list -q`
DEBUG WSL distributions: ["Ubuntu", "docker-desktop", "docker-desktop-data", ""]
DEBUG Executing command `C:\WINDOWS\system32\wsl.EXE -d Ubuntu bash -lc 'which topgrade'`
DEBUG Executing command `C:\WINDOWS\system32\wsl.EXE -d Ubuntu bash -c 'TOPGRADE_PREFIX=Ubuntu exec /home/smendon/.local/bin/topgrade -v' -y`
DEBUG Version: 12.0.2
DEBUG OS: x86_64-unknown-linux-gnu
DEBUG Args { inner: ["/home/smendon/.local/bin/topgrade", "-v"] }
DEBUG Binary path: Ok("/home/smendon/.local/bin/topgrade")
DEBUG Self Update: false
DEBUG Detected "/usr/bin/git" as "git"
DEBUG Cannot find "pwsh"
DEBUG Cannot find "powershell"
DEBUG Path "/home/smendon/.config/emacs" doesn't exist
DEBUG Path "/home/smendon/.emacs.d" doesn't exist
DEBUG Cannot find "doas"
DEBUG Detected "/usr/bin/sudo" as "sudo"
DEBUG Step "packer.nu"
DEBUG Step "System update"

── (Ubuntu) 20:44:03 - System update ───────────────────────────────────────────
DEBUG Cannot find "apt-fast"
DEBUG Cannot find "mist"
DEBUG Executing command `/usr/bin/sudo apt-get update`
[sudo] password for smendon:
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease 
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [900 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [41.6 kB]
Fetched 1279 kB in 1s (957 kB/s)
Reading package lists... Done
DEBUG Executing command `/usr/bin/sudo apt-get dist-upgrade`
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  ubuntu-advantage-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 190 kB of archives.
After this operation, 85.0 kB of additional disk space will be used.
Do you want to continue? [Y/n]
SteveLauC commented 9 months ago

Copy my comment from #521

The verbose argument would be useful for debugging, say a user is having issues with WSL, it can paste the output of topgrade -v from its host without having to execute it inside of the WSL.

For the assume_yes (-y) option, I haven't seen much value in it, users can configure this option in the configuration file if they want


But we probably should make the remote topgrade command consistent with the host one, i.e., all the arguments supplied to the host topgrade should also be passed to the remote ones.

If so, command line options should be platform-independent as they will possibly be used across different operating systems and arches