From 59c8217280756795170e64bf69c5683360ee4015 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:11:08 +0100 Subject: [PATCH] fix: say a settings file detection cannot read --- install.ps1 | 2 +- install.py | 9 +++++---- install.sh | 2 +- install/launchers/index.json | 16 ++++++++-------- tests/test_install_experience.py | 29 +++++++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/install.ps1 b/install.ps1 index 394040952..3e153d30c 100644 --- a/install.ps1 +++ b/install.ps1 @@ -16,7 +16,7 @@ # and Invoke-WebRequest throws on a cut transfer before the hash is read: # the site's build rewrites this line there (scripts/sitebootstrap.py). $mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." - $defaultInstallSha256 = "144f419239eaf12447b68b293d1c1d15294e45bca2344dea4a9da66fba7582cd" + $defaultInstallSha256 = "bb1da18416aec7c77a6d23c8bf2718cccf5c756ce0cbdbcbf54a6299a03a484f" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 96437450d..29aa13de2 100644 --- a/install.py +++ b/install.py @@ -1439,8 +1439,9 @@ def _parse_bash_var(path: Path, key: str) -> str | None: if line.startswith(f"{key}="): _, _, value = line.partition("=") return _shell_unquote(value) - except OSError: - pass + except OSError as exc: + # A settings.sh a sudo EmuDeck run left to root hid the setup. + _note_refused(path, exc) return None @@ -1551,8 +1552,8 @@ def _parse_ps1_var(path: Path, key: str) -> str | None: if check.startswith(f"{normalized}="): _, _, value = check.partition("=") return value.strip('"').strip("'") - except OSError: - pass + except OSError as exc: + _note_refused(path, exc) return None diff --git a/install.sh b/install.sh index ff6303641..99ebb5a32 100755 --- a/install.sh +++ b/install.sh @@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins # curl or wget stop on a cut transfer before the hash is read: the site's # build rewrites this line there (scripts/sitebootstrap.py). MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." -DEFAULT_INSTALL_SHA256="144f419239eaf12447b68b293d1c1d15294e45bca2344dea4a9da66fba7582cd" +DEFAULT_INSTALL_SHA256="bb1da18416aec7c77a6d23c8bf2718cccf5c756ce0cbdbcbf54a6299a03a484f" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/install/launchers/index.json b/install/launchers/index.json index 838151168..684a9df7a 100644 --- a/install/launchers/index.json +++ b/install/launchers/index.json @@ -27,8 +27,8 @@ { "dest": "roms/ports/retrobios/install.py", "repo_path": "install.py", - "size": 1089708, - "sha256": "144f419239eaf12447b68b293d1c1d15294e45bca2344dea4a9da66fba7582cd", + "size": 1089833, + "sha256": "bb1da18416aec7c77a6d23c8bf2718cccf5c756ce0cbdbcbf54a6299a03a484f", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1143335, - "sha256": "9f312c89654b2e3d07fc9f741a3d714c6a14342b27b81fe08f281b159dfeff14" + "size": 1143460, + "sha256": "8074276deabb785c034ecb1c3d5d4c2da3f7772ba17fb29f4f82241e289c7be5" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1089708, - "sha256": "144f419239eaf12447b68b293d1c1d15294e45bca2344dea4a9da66fba7582cd", + "size": 1089833, + "sha256": "bb1da18416aec7c77a6d23c8bf2718cccf5c756ce0cbdbcbf54a6299a03a484f", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1089708, - "sha256": "144f419239eaf12447b68b293d1c1d15294e45bca2344dea4a9da66fba7582cd", + "size": 1089833, + "sha256": "bb1da18416aec7c77a6d23c8bf2718cccf5c756ce0cbdbcbf54a6299a03a484f", "executable": false }, { diff --git a/tests/test_install_experience.py b/tests/test_install_experience.py index 136e96533..cc8e2ef58 100644 --- a/tests/test_install_experience.py +++ b/tests/test_install_experience.py @@ -708,6 +708,35 @@ class AHomeThisUserCannotOpen(unittest.TestCase): self.assertNotIn("using default path", proc.stdout + proc.stderr) +class ASettingsFileThisUserCannotRead(unittest.TestCase): + """A sudo EmuDeck run left settings.sh to root: its parser swallowed the + refusal and the run said "No supported platform detected" without a + word on the file, where the same refusal on retroarch.cfg is said.""" + + def setUp(self): + self.root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp")) + self.addCleanup(shutil.rmtree, self.root, True) + install._DETECTION_REFUSED.clear() + self.addCleanup(install._DETECTION_REFUSED.clear) + install._SETUP_SEARCH.active = True + self.addCleanup(setattr, install._SETUP_SEARCH, "active", False) + + def test_each_settings_parser_says_the_refusal(self): + for parse, name in ((install._parse_bash_var, "settings.sh"), + (install._parse_ps1_var, "settings.ps1")): + with self.subTest(file=name): + install._DETECTION_REFUSED.clear() + path = self.root / name + path.write_text('emulationPath="/x"\n', encoding="utf-8") + refusal = PermissionError(errno.EACCES, "Permission denied", str(path)) + with mock.patch.object(Path, "read_text", side_effect=refusal), \ + mock.patch.object(Path, "read_bytes", side_effect=refusal), \ + contextlib.redirect_stderr(io.StringIO()) as err: + self.assertIsNone(parse(path, "emulationPath")) + self.assertEqual(install._DETECTION_REFUSED, [(path, "Permission denied")]) + self.assertIn(f"cannot open {path}", err.getvalue()) + + class TheFrontendsOwnFolderClosed(unittest.TestCase): """The Flatpak RetroArch's folder at 000: its retroarch.cfg names ~/Games/bios, and the run took ~/.config/retroarch/system, a folder it