From 3c6456a2e623ae2e60350cc1a7b6e22b37fcda31 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Tue, 6 Oct 2026 13:25:14 +0200 Subject: [PATCH] setup: every finish mark is written with a warning on a read-only folder (#570) The PR guarded the mark of a whole shard; mark() itself now warns and goes on, so the SHA-256 result of a verified Unsloth shard and the shared-shard link on a --gguf-dir share do not stop setup either. The step is repeated on the next run. --- setup.py | 7 ++++++- tools/test_setup_choices.py | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 657f8889..7143732f 100644 --- a/setup.py +++ b/setup.py @@ -317,7 +317,12 @@ def done(path: Path) -> bool: def mark(path: Path, text=""): - path.with_name(path.name + ".done").write_text(text or time.strftime("%Y-%m-%d %H:%M"), encoding="utf-8") + """Write the finish mark. A folder that cannot be written (--gguf-dir on a read-only share, #570) only costs the + mark: setup says so and goes on (the step is repeated on the next run), it does not stop.""" + try: + path.with_name(path.name + ".done").write_text(text or time.strftime("%Y-%m-%d %H:%M"), encoding="utf-8") + except OSError as e: + warn(f"the finish mark of {path.name} cannot be written ({e}): the next run does this step again") # ------------------------------------------------------------------------------------------------ the PC diff --git a/tools/test_setup_choices.py b/tools/test_setup_choices.py index f7eb3a8e..f7e16f4e 100644 --- a/tools/test_setup_choices.py +++ b/tools/test_setup_choices.py @@ -176,6 +176,14 @@ class ReadOnlyGgufDir(unittest.TestCase): self.assertIn("is whole but its finish mark cannot be written", out) + def test_mark_itself_never_stops_on_a_read_only_folder(self): + """#570: every finish mark (the SHA-256 result of a verified shard too), not only the one for a whole shard.""" + with tempfile.TemporaryDirectory() as tmp, mock.patch.object(Path, "write_text", + side_effect=PermissionError(13, "read-only")): + setup.mark(Path(tmp) / "x.gguf", "sha256 abc") # no exception + self.assertFalse(setup.done(Path(tmp) / "x.gguf")) + + class ExperimentalSm60(unittest.TestCase): """#295: Pascal (6.x) and Volta (7.0) only with STRATA_EXPERIMENTAL_SM60=1, built with -DSTRATA_EXPERIMENTAL_SM60=ON and a CUDA 12.x toolkit; nothing changes without the variable."""