From c67dd2ad46d9c4805d0916baee25af4c4b40d4fd Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 22:14:17 +0200 Subject: [PATCH] fix: drop install anyway when nothing can come Offline with nothing here to copy, Install was removed, and a folder short of space or read-only then put Install anyway back: a run that could only fail every file. --- install.py | 6 +++--- tests/test_install_tui.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/install.py b/install.py index e8aa1050..15ec648c 100644 --- a/install.py +++ b/install.py @@ -10428,13 +10428,13 @@ def _plan_rows(state: TuiState) -> list[TuiRow]: rows = [TuiRow("install", label)] if _offline_only() and not _plan_copies(state, check): # Nothing here to copy, and the network refused: Install would - # only fail every file. + # only fail every file, in this folder or another. rows = [] if state.facts.get("writable") is False or _short_of_space(state, check): # Every file would fail alike, or the run would stop before the # first one: the way out is another folder. - rows = [TuiRow("folder", "Choose another folder"), TuiRow("install", "Install anyway"), - *rows[1:]] + rows = [TuiRow("folder", "Choose another folder"), + *([TuiRow("install", "Install anyway")] if rows else [])] if records_selection((state.manifest or {}).get("files", [])) and len(state.systems) > 1: rows.append(TuiRow("systems", "Choose systems")) rows.append(TuiRow("fromcard", "Copy the BIOS files from your old card or a folder")) diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index 2b03d2d8..1b004c19 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -2212,6 +2212,17 @@ class AuditRoundThree(unittest.TestCase): self.assertEqual(press(state, "enter"), []) self.assertEqual(state.screen, "folder") + def test_offline_with_nothing_to_copy_offers_no_install_anyway(self): + """Offline with nothing here to copy, Install is removed: a folder + short of space then put "Install anyway" back, a run that could + only fail every file.""" + state = checked_state({"free": 1024, "writable": False, "cores": []}) + with mock.patch.dict(os.environ, {install.OFFLINE_VARIABLE: "1"}): + labels = [row.label for row in install.tui_rows(state)] + self.assertEqual(labels[0], "Choose another folder") + self.assertNotIn("Install anyway", labels) + self.assertFalse(any(label.startswith("Install") for label in labels), labels) + FULL_TAIL = [ " Checking existing files...", " 0/50 present (0 verified, 0 wrong hash)",