From b5d490c49a13620485e419cf237f758e68ebf977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 9 Oct 2026 01:31:08 -0400 Subject: [PATCH] Inert step tolerates only 'not registered'; guard fails on query or plist errors; test asserts the tile rejection (R2.15) --- crates/ely-lok/src/client/tests.rs | 10 ++++++++-- scripts/inert-lo.sh | 5 ++++- tests/scripts/lo-unregistered.sh | 4 +++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/ely-lok/src/client/tests.rs b/crates/ely-lok/src/client/tests.rs index 87689e8..6358fa4 100644 --- a/crates/ely-lok/src/client/tests.rs +++ b/crates/ely-lok/src/client/tests.rs @@ -290,8 +290,14 @@ fn an_unpatched_build_is_rejected() { return; } let dir = tempfile::tempdir().expect("a temp dir"); - let outcome = Worker::spawn(&frameworks, &dir.path().join("profile")); - assert!(outcome.is_err(), "the unpatched build must be rejected"); + let Err(error) = Worker::spawn(&frameworks, &dir.path().join("profile")) else { + panic!("the unpatched build must be rejected"); + }; + assert_eq!(error.kind(), std::io::ErrorKind::InvalidData, "{error}"); + assert!( + error.to_string().contains("does not paint tiles (unpatched)"), + "rejected for the tile check, not {error}" + ); } #[test] diff --git a/scripts/inert-lo.sh b/scripts/inert-lo.sh index 9ad4bc6..25f878c 100755 --- a/scripts/inert-lo.sh +++ b/scripts/inert-lo.sh @@ -11,7 +11,10 @@ for key in CFBundleDocumentTypes CFBundleURLTypes UTExportedTypeDeclarations UTI fi done rm -rf "$app/Contents/PlugIns" "$app/Contents/Library/Spotlight" -"$lsregister" -u "$app" +# -10814: not registered, which is the goal. +if ! said=$("$lsregister" -u "$app" 2>&1); then + grep -q -- "-10814" <<<"$said" || { echo "inert-lo.sh: $said" >&2; exit 1; } +fi # Spotlight would find the bundle and register it again. touch "$(cd "$app/../../.." && pwd)/.metadata_never_index" echo "inert-lo.sh: $app claims no files and is unregistered" diff --git a/tests/scripts/lo-unregistered.sh b/tests/scripts/lo-unregistered.sh index fb899d1..eb25183 100755 --- a/tests/scripts/lo-unregistered.sh +++ b/tests/scripts/lo-unregistered.sh @@ -6,6 +6,7 @@ root=$(cd "$(dirname "$0")/../.." && pwd) fail() { echo "FAIL: $*" >&2; exit 1; } app=$root/engines/lo-src/instdir/LibreOffice.app if [ -d "$app" ]; then + plutil -lint -s "$app/Contents/Info.plist" || fail "$app has no readable Info.plist" for key in CFBundleDocumentTypes CFBundleURLTypes UTExportedTypeDeclarations UTImportedTypeDeclarations; do ! /usr/libexec/PlistBuddy -c "Print :$key" "$app/Contents/Info.plist" >/dev/null 2>&1 || fail "$app claims $key" done @@ -20,6 +21,7 @@ for path in CommandLine.arguments.dropFirst() { for app in NSWorkspace.shared.urlsForApplications(toOpen: URL(fileURLWithPath: path)) { print(app.path) } } SWIFT -found=$(swift "$work/open.swift" "$work"/sample.* | grep -i libreoffice || true) +apps=$(swift "$work/open.swift" "$work"/sample.*) || fail "the Open With query failed" +found=$(grep -i libreoffice <<<"$apps" || true) [ -z "$found" ] || fail "Open With lists LibreOffice: $found" echo "ok: no LibreOffice in Open With"