From a8b78942084df8cc839824f2dfeceeb17ed732db Mon Sep 17 00:00:00 2001 From: ELDment Date: Fri, 4 Dec 2026 08:11:39 +0800 Subject: [PATCH] fix(runtime): keep QEMU ASLR in sync across runtime and data folder changes --- frontend/src/App.tsx | 11 ++ frontend/src/styles/app.css | 1 + frontend/src/ui/toast.tsx | 8 +- frontend/src/wails.ts | 1 + internal/app/app.go | 161 ++++++++++++------ internal/app/create_flow.go | 4 +- internal/app/dataroot_aslr.go | 90 +++++++++++ internal/app/dataroot_aslr_test.go | 159 ++++++++++++++++++ internal/app/dataroot_flow.go | 41 +++-- internal/app/diagnostics_flow.go | 2 +- internal/app/installer_bindings.go | 4 +- internal/app/macos_settings.go | 4 +- internal/app/opencore_flow.go | 8 +- internal/app/runtime_selection_test.go | 31 ++-- internal/app/setup.go | 2 + internal/app/vm_monitor.go | 11 +- internal/cli/cli.go | 10 +- internal/cli/runtime_fetch.go | 2 +- internal/config/config.go | 15 +- internal/config/file_retry_other.go | 5 + internal/config/file_retry_windows.go | 23 +++ internal/config/file_retry_windows_test.go | 52 ++++++ internal/host/qemu_aslr.go | 7 + internal/host/qemu_aslr_windows.go | 13 +- internal/host/qemu_aslr_windows_test.go | 27 +++- internal/i18n/catalog_gen.go | 6 +- internal/runtime/launch_policy.go | 84 ++++++++-- internal/runtime/launch_policy_test.go | 95 +++++++++++ internal/runtime/remove_test.go | 55 +++++++ internal/runtime/runtime.go | 22 ++- internal/runtime/selection.go | 179 +++++++++++++++------ internal/runtime/selection_test.go | 64 +++++++- locales/en-US/native.json | 3 +- locales/zh-CN/native.json | 3 +- main.go | 4 + 35 files changed, 1021 insertions(+), 186 deletions(-) create mode 100644 internal/app/dataroot_aslr.go create mode 100644 internal/app/dataroot_aslr_test.go create mode 100644 internal/config/file_retry_other.go create mode 100644 internal/config/file_retry_windows.go create mode 100644 internal/config/file_retry_windows_test.go create mode 100644 internal/runtime/launch_policy_test.go diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 2815d63..1252a4f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -459,6 +459,17 @@ export const App: React.FC = () => { useEffect(() => () => { disposeActiveThemeAndLocaleFonts() }, []) const tr = (k: I18nKey, v?: Record) => t(locale, k, v) const pushToast = toasts.push + useEffect(() => events.onRuntimeWarning((message) => { + const { summary, code, rawDetail } = parseAppError(message) + pushToast({ + kind: 'warning', + title: summary, + errorCode: code, + rawDetail, + detailsLabel: t(locale, 'errRawDetailsToggle'), + copyDetailsLabel: t(locale, 'errCopyDetails'), + }) + }), [locale, pushToast]) useEffect(() => events.onHostDrop(({ delivered, mode }) => { if (mode !== 'l1_share' || delivered.length === 0) return const title = delivered.length === 1 diff --git a/frontend/src/styles/app.css b/frontend/src/styles/app.css index 58e6dad..aa67101 100644 --- a/frontend/src/styles/app.css +++ b/frontend/src/styles/app.css @@ -1007,6 +1007,7 @@ button.status-issue + .status-metric { margin-left: 6px; } .toast-main-row:has(.toast-desc) { align-items: flex-start; } .toast-main-row:has(.toast-desc) > svg { margin-top: 2px; } .toast.ok .toast-main-row > svg { color: var(--status-running); } +.toast.warning .toast-main-row > svg { color: var(--status-busy); } .toast.error .toast-main-row > svg { color: var(--status-error); } .toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; } .toast-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } diff --git a/frontend/src/ui/toast.tsx b/frontend/src/ui/toast.tsx index 56cadc0..2e70e85 100644 --- a/frontend/src/ui/toast.tsx +++ b/frontend/src/ui/toast.tsx @@ -1,12 +1,12 @@ import * as RToast from '@radix-ui/react-toast' -import { Check, CircleCheck, CircleX, X } from 'lucide-react' +import { AlertTriangle, Check, CircleCheck, CircleX, X } from 'lucide-react' import { HostIcon } from './themeVisuals' import { emitThemeEvent } from '../lib/themeEngine' import React, { useCallback, useState } from 'react' import { IconButton } from './controls' export interface ToastInput { - kind: 'ok' | 'error' + kind: 'ok' | 'warning' | 'error' title: string description?: string errorCode?: string @@ -63,7 +63,7 @@ const ToastCard: React.FC = ({ item, onRemove, closeLabel }) => { if (!open) onRemove(item.id) }} @@ -71,6 +71,8 @@ const ToastCard: React.FC = ({ item, onRemove, closeLabel }) =>
{item.kind === 'ok' ? (