swiftlang / swiftly

A Swift toolchain installer and manager, written in Swift.
https://swiftlang.github.io/swiftly/
Apache License 2.0
490 stars 28 forks source link

Swiftly first toolchain download fails on waiting for user input #170

Open vsarunas opened 1 month ago

vsarunas commented 1 month ago

Leaving new version of swiftly causes a hang went run via ansible:

 FAILED! => {"changed": true, "cmd": "SWIFTLY_HOME_DIR=/usr/local/share SWIFTLY_BIN_DIR=/usr/local/bin /usr/local/bin/swiftly install 6.0.0 --no-verify", "delta": "0:04:40.989830", "end": "2024-09-25 09:04:35.952845", "msg": "non-zero return code", "rc": 137, "start": "2024-09-25 08:59:54.963015", "stderr": "Killed", "stderr_lines": ["Killed"], "stdout": "Installing Swift 6.0.0\nDownloading Swift 6.0.0\n1%: Downloaded 13.3 MiB of 775.1 MiB\n4%: Downloaded 32.4 MiB of 775.1 MiB\n7%: Downloaded 54.7 MiB of 775.1 MiB\n10%: Downloaded 81.5 MiB of 775.1 MiB\n13%: Downloaded 106.8 MiB of 775.1 MiB\n17%: Downloaded 133.6 MiB of 775.1 MiB\n20%: Downloaded 160.2 MiB of 775.1 MiB\n23%: Downloaded 182.7 MiB of 775.1 MiB\n26%: Downloaded 209.2 MiB of 775.1 MiB\n30%: Downloaded 235.8 MiB of 775.1 MiB\n33%: Downloaded 256.8 MiB of 775.1 MiB\n36%: Downloaded 282.4 MiB of 775.1 MiB\n39%: Downloaded 308.1 MiB of 775.1 MiB\n43%: Downloaded 334.6 MiB of 775.1 MiB\n46%: Downloaded 358.0 MiB of 775.1 MiB\n49%: Downloaded 384.6 MiB of 775.1 MiB\n53%: Downloaded 411.5 MiB of 775.1 MiB\n56%: Downloaded 437.2 MiB of 775.1 MiB\n59%: Downloaded 464.0 MiB of 775.1 MiB\n62%: Downloaded 488.3 MiB of 775.1 MiB\n66%: Downloaded 515.6 MiB of 775.1 MiB\n69%: Downloaded 542.3 MiB of 775.1 MiB\n73%: Downloaded 568.2 MiB of 775.1 MiB\n76%: Downloaded 594.0 MiB of 775.1 MiB\n79%: Downloaded 617.5 MiB of 775.1 MiB\n83%: Downloaded 644.3 MiB of 775.1 MiB\n86%: Downloaded 671.0 MiB of 775.1 MiB\n89%: Downloaded 696.8 MiB of 775.1 MiB\n93%: Downloaded 723.5 MiB of 775.1 MiB\n96%: Downloaded 748.4 MiB of 775.1 MiB\n99%: Downloaded 774.7 MiB of 775.1 MiB\n100%: Downloaded 775.1 MiB of 775.1 MiB", "stdout_lines": ["Installing Swift 6.0.0", "Downloading Swift 6.0.0", "1%: Downloaded 13.3 MiB of 775.1 MiB", "4%: Downloaded 32.4 MiB of 775.1 MiB", "7%: Downloaded 54.7 MiB of 775.1 MiB", "10%: Downloaded 81.5 MiB of 775.1 MiB", "13%: Downloaded 106.8 MiB of 775.1 MiB", "17%: Downloaded 133.6 MiB of 775.1 MiB", "20%: Downloaded 160.2 MiB of 775.1 MiB", "23%: Downloaded 182.7 MiB of 775.1 MiB", "26%: Downloaded 209.2 MiB of 775.1 MiB", "30%: Downloaded 235.8 MiB of 775.1 MiB", "33%: Downloaded 256.8 MiB of 775.1 MiB", "36%: Downloaded 282.4 MiB of 775.1 MiB", "39%: Downloaded 308.1 MiB of 775.1 MiB", "43%: Downloaded 334.6 MiB of 775.1 MiB", "46%: Downloaded 358.0 MiB of 775.1 MiB", "49%: Downloaded 384.6 MiB of 775.1 MiB", "53%: Downloaded 411.5 MiB of 775.1 MiB", "56%: Downloaded 437.2 MiB of 775.1 MiB", "59%: Downloaded 464.0 MiB of 775.1 MiB", "62%: Downloaded 488.3 MiB of 775.1 MiB", "66%: Downloaded 515.6 MiB of 775.1 MiB", "69%: Downloaded 542.3 MiB of 775.1 MiB", "73%: Downloaded 568.2 MiB of 775.1 MiB", "76%: Downloaded 594.0 MiB of 775.1 MiB", "79%: Downloaded 617.5 MiB of 775.1 MiB", "83%: Downloaded 644.3 MiB of 775.1 MiB", "86%: Downloaded 671.0 MiB of 775.1 MiB", "89%: Downloaded 696.8 MiB of 775.1 MiB", "93%: Downloaded 723.5 MiB of 775.1 MiB", "96%: Downloaded 748.4 MiB of 775.1 MiB", "99%: Downloaded 774.7 MiB of 775.1 MiB", "100%: Downloaded 775.1 MiB of 775.1 MiB"]}

The toolchain is installed:

 SWIFTLY_HOME_DIR=/usr/local/share SWIFTLY_BIN_DIR=/usr/local/bin /usr/local/bin/swiftly install 6.0.0 --no-verify
Swift 6.0.0 is already installed, exiting.

Probably it hangs on activating the new toolchain and asking for confirmation:

sudo SWIFTLY_HOME_DIR=/usr/local/share SWIFTLY_BIN_DIR=/usr/local/bin /usr/local/bin/swiftly use 6.0.0
The following existing executables will be overwritten:
  /usr/local/bin/ld.lld
  /usr/local/bin/swift-build-sdk-interfaces
  /usr/local/bin/swift-package
  /usr/local/bin/docc
  /usr/local/bin/plutil
  /usr/local/bin/lld-link
  /usr/local/bin/swiftc
  /usr/local/bin/clangd
  /usr/local/bin/swift-test
  /usr/local/bin/lldb-server
  /usr/local/bin/wasm-ld
  /usr/local/bin/swift-package-registry
  /usr/local/bin/swift-api-extract
  /usr/local/bin/clang
  /usr/local/bin/swift-api-checker.py
  /usr/local/bin/repl_swift
  /usr/local/bin/swift-package-collection
  /usr/local/bin/swift-build-tool
  /usr/local/bin/clang++
  /usr/local/bin/sourcekit-lsp
  /usr/local/bin/llvm-cov
  /usr/local/bin/swift-api-digester
  /usr/local/bin/llvm-profdata
  /usr/local/bin/swift
  /usr/local/bin/swift-driver
  /usr/local/bin/clang-cl
  /usr/local/bin/swift-help
  /usr/local/bin/swift-autolink-extract
  /usr/local/bin/sdk-module-lists
  /usr/local/bin/ld64.lld
  /usr/local/bin/llvm-ar
  /usr/local/bin/swift-build
  /usr/local/bin/swift-demangle
  /usr/local/bin/swift-plugin-server
  /usr/local/bin/swift-cache-tool
  /usr/local/bin/swift-experimental-sdk
  /usr/local/bin/clang-cpp
  /usr/local/bin/clang-cache
  /usr/local/bin/lld
  /usr/local/bin/swift-symbolgraph-extract
  /usr/local/bin/lldb
  /usr/local/bin/lldb-argdumper
  /usr/local/bin/swift-frontend
  /usr/local/bin/swift-run
Proceed? (y/n): 

Should expand the use of --assume-yes flag that exists in uninstall?

0xTim commented 1 month ago

@vsarunas there's a --disable-confirmation flag that should fix this

vsarunas commented 1 month ago

@0xTim; correct, but the --disable-confirmation is only there for the initial shell script bootstrap process.

/usr/local/bin/swiftly install 6.0.0 --disable-confirmation
Error: Unknown option '--disable-confirmation'

The --assume-yes is present for example in update.