From 9bff368f181c72f2dff69b73972fcd398fdad522 Mon Sep 17 00:00:00 2001 From: Lorenzo Golluscio <149246609+ssupt@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:03:32 +0200 Subject: [PATCH 1/2] Prepare a native audio backend and rebuild cached releases after updates --- .github/workflows/ci.yml | 20 ++- README.md | 22 ++- backend-release.json | 4 +- backend/build.rs | 1 + bin/omarchy-audio-service | Bin 3707424 -> 3707424 bytes manifest.json | 6 +- packaging/build-release.py | 7 +- packaging/launch-backend.py | 114 +++++++++++++++ qml/core/Service.qml | 40 +++++- .../qml/components/AudioBalanceRow.qml | 0 .../qml/components/AudioBarIcon.qml | 0 .../qml/components/AudioDropdown.qml | 0 .../qml/components/AudioSinkRow.qml | 0 .../qml/components/AudioSlider.qml | 0 .../qml/components/AudioSourceRow.qml | 0 .../qml/components/AudioStreamRow.qml | 0 .../qml/core/AudioNodeModel.qml | 0 .../qml/core/AudioProtocol.js | 0 .../qml/core/AudioRuntime.qml | 0 .../qml/core/Model.js | 0 .../qml/core/ReleasePaths.js | 2 +- .../qml/core/Service.qml | 40 +++++- .../devices/AudioBluetoothPreferenceRow.qml | 0 .../qml/devices/AudioDevicePrefRow.qml | 0 .../qml/devices/AudioPortRow.qml | 0 .../qml/devices/AudioProfileRow.qml | 0 .../diagnostics/AudioDiagnosticActionRow.qml | 0 .../AudioDiagnosticsController.qml | 0 .../qml/diagnostics/AudioDiagnosticsView.qml | 0 .../AudioMicrophoneTestController.qml | 0 .../qml/microphone/MicrophoneTestRow.qml | 0 .../qml/panels/AdvancedAudio.qml | 0 .../qml/panels/Panel.qml | 0 .../qml/policy/AudioPolicyController.qml | 0 .../qml/policy/AudioPolicyToggleRow.qml | 0 .../qml/policy/AudioPolicyVolumeRow.qml | 0 .../qml/routing/AudioAppRuleRow.qml | 0 .../qml/routing/AudioOutputGroupCreateRow.qml | 0 .../routing/AudioOutputGroupMemberLevel.qml | 0 .../qml/routing/AudioOutputGroupRow.qml | 0 .../routing/AudioOutputGroupsController.qml | 0 .../qml/routing/AudioRulesController.qml | 0 .../qml/scenes/AudioSceneController.qml | 0 .../qml/scenes/AudioSceneRow.qml | 0 scripts/audio-service | 5 + test/all | 1 + test/integration/native_backend.py | 133 ++++++++++++++++++ test/integration/native_startup.py | 78 ++++++++++ test/integration/release.py | 5 + test/integration/runtime.py | 11 +- 50 files changed, 461 insertions(+), 28 deletions(-) create mode 100644 packaging/launch-backend.py rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/components/AudioBalanceRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/components/AudioBarIcon.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/components/AudioDropdown.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/components/AudioSinkRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/components/AudioSlider.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/components/AudioSourceRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/components/AudioStreamRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/core/AudioNodeModel.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/core/AudioProtocol.js (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/core/AudioRuntime.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/core/Model.js (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/core/ReleasePaths.js (50%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/core/Service.qml (79%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/devices/AudioBluetoothPreferenceRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/devices/AudioDevicePrefRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/devices/AudioPortRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/devices/AudioProfileRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/diagnostics/AudioDiagnosticActionRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/diagnostics/AudioDiagnosticsController.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/diagnostics/AudioDiagnosticsView.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/microphone/AudioMicrophoneTestController.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/microphone/MicrophoneTestRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/panels/AdvancedAudio.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/panels/Panel.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/policy/AudioPolicyController.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/policy/AudioPolicyToggleRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/policy/AudioPolicyVolumeRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/routing/AudioAppRuleRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/routing/AudioOutputGroupCreateRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/routing/AudioOutputGroupMemberLevel.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/routing/AudioOutputGroupRow.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/routing/AudioOutputGroupsController.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/routing/AudioRulesController.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/scenes/AudioSceneController.qml (100%) rename runtime/{3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84 => a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6}/qml/scenes/AudioSceneRow.qml (100%) create mode 100755 scripts/audio-service create mode 100644 test/integration/native_backend.py create mode 100644 test/integration/native_startup.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45348a4..c22d0d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,6 +100,7 @@ jobs: python test/integration/release.py backend/target/debug/omarchy-audio-service python test/integration/packaging.py backend/target/debug/omarchy-audio-service python packaging/build-release.py --output "$RUNNER_TEMP/audio-upgrade-candidate" --binary backend/target/debug/omarchy-audio-service + python test/integration/native_startup.py "$RUNNER_TEMP/audio-upgrade-candidate" python "$RUNNER_TEMP/audio-upgrade-candidate/test/integration/runtime.py" "$RUNNER_TEMP/audio-upgrade-candidate/bin/omarchy-audio-service" python "$RUNNER_TEMP/audio-upgrade-candidate/test/integration/routed_audio.py" "$RUNNER_TEMP/audio-upgrade-candidate/bin/omarchy-audio-service" python "$RUNNER_TEMP/audio-upgrade-candidate/test/integration/profiles.py" "$RUNNER_TEMP/audio-upgrade-candidate/bin/omarchy-audio-service" @@ -113,9 +114,16 @@ jobs: python test/integration/upgrade.py "$RUNNER_TEMP/audio-upgrade-candidate" legacy-plugin release-candidate: - name: Build self-contained plugin candidate + name: Build self-contained plugin candidate (${{ matrix.arch }}) needs: [test, qml-runtime] - runs-on: ubuntu-24.04 + runs-on: ${{ matrix.runner }} + strategy: + matrix: + include: + - runner: ubuntu-24.04 + arch: x86_64 + - runner: ubuntu-24.04-arm + arch: aarch64 timeout-minutes: 15 steps: - name: Check out plugin @@ -131,12 +139,14 @@ jobs: python3 packaging/build-release.py --output "$RUNNER_TEMP/audio-plugin" python3 packaging/build-release.py --check "$RUNNER_TEMP/audio-plugin" python3 test/integration/lifecycle.py "$RUNNER_TEMP/audio-plugin/bin/omarchy-audio-service" - tar -C "$RUNNER_TEMP/audio-plugin" -czf "$RUNNER_TEMP/omarchy-audio-control-linux-x86_64.tar.gz" . + python3 test/integration/release.py "$RUNNER_TEMP/audio-plugin/bin/omarchy-audio-service" + python3 test/integration/native_backend.py + tar -C "$RUNNER_TEMP/audio-plugin" -czf "$RUNNER_TEMP/omarchy-audio-control-linux-${{ matrix.arch }}.tar.gz" . - name: Upload candidate for review uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: omarchy-audio-control-linux-x86_64 - path: ${{ runner.temp }}/omarchy-audio-control-linux-x86_64.tar.gz + name: omarchy-audio-control-linux-${{ matrix.arch }} + path: ${{ runner.temp }}/omarchy-audio-control-linux-${{ matrix.arch }}.tar.gz if-no-files-found: error retention-days: 14 diff --git a/README.md b/README.md index 092962a..8d0d91d 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,26 @@ until discarded or until the advanced window closes. ## Install -Requires **Omarchy Quattro on x86_64 Linux**, PipeWire and WirePlumber, with -Omarchy's usual audio and desktop tools. Installation needs no Rust toolchain. +Requires **Omarchy Quattro on x86_64 or aarch64 Linux**, PipeWire and WirePlumber, +with Omarchy's usual audio and desktop tools. The Git checkout includes an +x86_64 backend, so x86_64 installation needs no Rust toolchain. + +On **aarch64** (including Asahi Linux), install Rust/Cargo **1.85+**, libclang, +pkg-config, and the PipeWire and libpulse development headers before enabling +the plugin. For Arch-based systems: + +```bash +sudo pacman -S --needed rust clang pkgconf pipewire libpulse +``` + +The plugin builds a native backend on first startup and after updates that +change runtime sources. The panel shows **Preparing audio service…** until the +build finishes. Builds stay under +`${XDG_CACHE_HOME:-~/.cache}/omarchy-audio-control/`; dependencies are reused +across updates, and the plugin checkout remains unchanged. Later starts use +the cached executable. If preparation fails, install the requirements above +and reload the plugin. Manual binary replacement after each update is no +longer needed. ```bash omarchy plugin add https://github.com/ssupt/omarchy-audio-control.git --enable diff --git a/backend-release.json b/backend-release.json index 426fad3..611b5da 100644 --- a/backend-release.json +++ b/backend-release.json @@ -1,7 +1,7 @@ { - "buildId": "3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84", + "buildId": "a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6", "target": "x86_64-unknown-linux-gnu", "version": "0.1.0", "protocolVersion": 1, - "sha256": "e37256102a94ca5ab01c7a1bb1bbb8afe0b3c9cdc56609d723fb43080efe40ec" + "sha256": "4a88e3b548c7140c1c4820cb84bfd2ed56a009a31894464371ed5b025032d9b3" } diff --git a/backend/build.rs b/backend/build.rs index 79207b0..2e98bd1 100644 --- a/backend/build.rs +++ b/backend/build.rs @@ -31,6 +31,7 @@ fn main() { "backend/build.rs".into(), "packaging/manifest.template.json".into(), "packaging/build-release.py".into(), + "packaging/launch-backend.py".into(), ]; collect_sources(root, &root.join("backend/src"), &mut files); println!( diff --git a/bin/omarchy-audio-service b/bin/omarchy-audio-service index e967ff117c99f504e078f2333640e2539d1a2eb4..2fa77b1522ca41b7613da9b636c7a7b8d0eb2c14 100755 GIT binary patch delta 418 zcmbu%xh@280KnnQ%({1-gSD*twwU98>=r~T^a_*6>>PCd6du6OGbq0HYu$YqEj(8&`~2d*ymR~@PLB@vKilu(wQzQOeQ6e(-8c&ykU@>q5kJUnMGz{M6Htqm{2}%GGYQ<~b^ni4KKKy)bq{ z)jat!OW9A;d^`C6_4HyC8+O}-g&aE2i7s@b2fgS+9tHGc0D~C9Fh*cw6k{02-#vj6 tCNYIFrZIzA%wZl2Si};Rv4T~sVI3Q&U=v%|h65KKd%a<1ffjmXZJf delta 418 zcmbu%yGp}Q0DxhV)O)>0t<`#~cdI=~nw$hgbk;`*lw3hyz*!vn01-Oc!C6HL!50um zXGiJi;Gny|&*1Q_U+3;a>EN-Z>2J?3-OHczOuQdn+-BAK)5%#SyHZQ-uUrurIy}Pp`n02^kV>n7{V|{P{b(4FpddKVhYpHF@ssm;qRVD u84FlM1xr}Q3Rba(D%P=qO>AKsJJ`h@YS_mC>JTts!a@T!oLuk8;{7ifxS0R| diff --git a/manifest.json b/manifest.json index a659e46..7cb1b36 100644 --- a/manifest.json +++ b/manifest.json @@ -11,9 +11,9 @@ "service" ], "entryPoints": { - "barWidget": "runtime/3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84/qml/panels/Panel.qml", - "panel": "runtime/3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84/qml/panels/AdvancedAudio.qml", - "service": "runtime/3b9a83e019dc97d72fc5811b677ffca8800577e0aad56b3ed924b393c0871d84/qml/core/Service.qml" + "barWidget": "runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/Panel.qml", + "panel": "runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/AdvancedAudio.qml", + "service": "runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/Service.qml" }, "barWidget": { "displayName": "Advanced Audio Control", diff --git a/packaging/build-release.py b/packaging/build-release.py index d717952..58ba755 100644 --- a/packaging/build-release.py +++ b/packaging/build-release.py @@ -14,7 +14,8 @@ def source_id(root): names = ['backend/Cargo.toml', 'backend/Cargo.lock', 'backend/build.rs', - 'packaging/manifest.template.json', 'packaging/build-release.py'] + 'packaging/manifest.template.json', 'packaging/build-release.py', + 'packaging/launch-backend.py'] for directory in ('qml', 'backend/src', 'scripts'): paths = ((root / directory).rglob('*') if directory != 'scripts' else (root / directory).iterdir()) @@ -76,8 +77,8 @@ def verify(root): info = inspect(binary) if info['buildId'] != source_id(root) or metadata['buildId'] != info['buildId']: raise ValueError('Backend does not match the plugin sources; rebuild the release') - if info['target'] != 'x86_64-unknown-linux-gnu' or metadata['target'] != info['target']: - raise ValueError('This release targets Omarchy on x86_64 Linux') + if info['target'] not in ('x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu') or metadata['target'] != info['target']: + raise ValueError('This release requires a native x86_64 or aarch64 Linux backend') if any(metadata.get(key) != info.get(key) for key in ('version', 'protocolVersion')): raise ValueError('Backend version metadata does not match the executable') if not os.access(binary, os.X_OK): diff --git a/packaging/launch-backend.py b/packaging/launch-backend.py new file mode 100644 index 0000000..eb4bf95 --- /dev/null +++ b/packaging/launch-backend.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +"""Prepare a backend for this CPU without changing the installed plugin.""" +import fcntl +import importlib.util +import json +import os +from pathlib import Path +import platform +import shutil +import stat +import struct +import subprocess +import sys +import tempfile + +TARGETS = { + 'x86_64': ('x86_64-unknown-linux-gnu', 62), + 'aarch64': ('aarch64-unknown-linux-gnu', 183), +} + + +def release_tools(root): + spec = importlib.util.spec_from_file_location('audio_release', root/'packaging/build-release.py') + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def matches(binary, target, machine, build_id, tools): + try: + with binary.open('rb') as stream: + header = stream.read(20) + # Never execute a foreign ELF (including via binfmt/QEMU). + if (len(header) != 20 or header[:6] != b'\x7fELF\x02\x01' + or struct.unpack_from('= 5900, 'Slow preparation was bypassed' + finally: + if success: + # This PID comes from hello on the private temporary daemon. + try: + os.kill(int(success[1]), signal.SIGTERM) + except ProcessLookupError: + pass +print('PASS: packaged native startup and preparation beyond the hello deadline') diff --git a/test/integration/release.py b/test/integration/release.py index b739bda..29e82d5 100644 --- a/test/integration/release.py +++ b/test/integration/release.py @@ -38,6 +38,11 @@ def rejected(check, message): nested_extra.write_text('// Added after the backend was built\n') rejected(lambda: release.verify(candidate), 'Added nested Rust source was accepted') nested_extra.unlink() + launcher = candidate/'packaging/launch-backend.py' + original_launcher = launcher.read_bytes() + launcher.write_bytes(original_launcher + b'\n# Changed native preparation\n') + rejected(lambda: release.verify(candidate), 'Modified native launcher was accepted') + launcher.write_bytes(original_launcher) executable = candidate/'bin/omarchy-audio-service' original = executable.read_bytes() executable.write_bytes(b'broken executable') diff --git a/test/integration/runtime.py b/test/integration/runtime.py index 1c8f3e6..6b3367d 100644 --- a/test/integration/runtime.py +++ b/test/integration/runtime.py @@ -65,7 +65,10 @@ def stop(process): PULSE_SERVER='unix:'+str(work/'audio-test-pulse'), XDG_STATE_HOME=str(work / 'state'), XDG_CACHE_HOME=str(work / 'cache'), AUDIO_CONTROL_PRIVATE_RUNTIME_DIR=temporary, - AUDIO_INTEGRATION_LOG=str(work / 'operations'), PATH=str(binaries)+os.pathsep+os.environ['PATH']) + AUDIO_INTEGRATION_LOG=str(work / 'operations'), + # The private config must not invoke user tool-manager shims + # whose trust/configuration changes with XDG_CONFIG_HOME. + PATH=str(binaries)+os.pathsep+os.defpath+os.pathsep+os.environ['PATH']) # Remove inherited per-store overrides so tests cannot touch user documents. for key in ('OMARCHY_AUDIO_CONTROL_FILE', 'OMARCHY_AUDIO_PREFERENCES_FILE', 'OMARCHY_AUDIO_RULES_FILE', 'OMARCHY_AUDIO_SCENES_FILE'): env.pop(key, None) @@ -370,7 +373,11 @@ def pipewire(): Process { id: crashProc } Timer { interval: 25000; running: true; onTriggered: { console.log("RUNTIME_FAILURE timeout"); Qt.quit() } } } -'''.replace('DIAGNOSTICS_URL', json.dumps(((ROOT/ENTRY_POINTS['service']).parent.parent/'diagnostics/AudioDiagnosticsController.qml').as_uri())).replace('BACKEND_PROPERTIES', json.dumps({} if PACKAGED else {'backendCommand':[str(BINARY),'--plugin']})).replace('RUNTIME_URL', json.dumps((ROOT/ENTRY_POINTS['service']).with_name('AudioRuntime.qml').as_uri())).replace('SCRIPTS_PATH', json.dumps(str(ROOT/'scripts'))).replace('SERVICE_URL', json.dumps((ROOT/ENTRY_POINTS['service']).as_uri())).replace('UI_PROBE', +'''.replace('DIAGNOSTICS_URL', json.dumps(((ROOT/ENTRY_POINTS['service']).parent.parent/'diagnostics/AudioDiagnosticsController.qml').as_uri())).replace('BACKEND_PROPERTIES', json.dumps({} if PACKAGED else { + # Preparation can outlast the five-second protocol deadline on first ARM + # builds. A delayed preparation must finish before hello is sent. + 'backendPreparationCommand': [sys.executable, '-c', 'import time; time.sleep(6); print('+repr(str(BINARY))+')'] +})).replace('RUNTIME_URL', json.dumps((ROOT/ENTRY_POINTS['service']).with_name('AudioRuntime.qml').as_uri())).replace('SCRIPTS_PATH', json.dumps(str(ROOT/'scripts'))).replace('SERVICE_URL', json.dumps((ROOT/ENTRY_POINTS['service']).as_uri())).replace('UI_PROBE', ('var panel = Qt.createComponent('+json.dumps((ROOT/ENTRY_POINTS['barWidget']).as_uri())+'); ' 'var advanced = Qt.createComponent('+json.dumps((ROOT/ENTRY_POINTS['panel']).as_uri())+'); ' 'if (panel.status !== Component.Ready || advanced.status !== Component.Ready) { ' From 1ed2ac537ef273adcde5f99ec20c08576a575c74 Mon Sep 17 00:00:00 2001 From: Lorenzo Golluscio <149246609+ssupt@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:40:16 +0200 Subject: [PATCH 2/2] Harden native backend cache validation --- backend-release.json | 4 +- bin/omarchy-audio-service | Bin 3707424 -> 3707424 bytes manifest.json | 6 +- packaging/launch-backend.py | 45 ++++++-- .../qml/components/AudioBalanceRow.qml | 0 .../qml/components/AudioBarIcon.qml | 0 .../qml/components/AudioDropdown.qml | 0 .../qml/components/AudioSinkRow.qml | 0 .../qml/components/AudioSlider.qml | 0 .../qml/components/AudioSourceRow.qml | 0 .../qml/components/AudioStreamRow.qml | 0 .../qml/core/AudioNodeModel.qml | 0 .../qml/core/AudioProtocol.js | 0 .../qml/core/AudioRuntime.qml | 0 .../qml/core/Model.js | 0 .../qml/core/ReleasePaths.js | 2 +- .../qml/core/Service.qml | 0 .../devices/AudioBluetoothPreferenceRow.qml | 0 .../qml/devices/AudioDevicePrefRow.qml | 0 .../qml/devices/AudioPortRow.qml | 0 .../qml/devices/AudioProfileRow.qml | 0 .../diagnostics/AudioDiagnosticActionRow.qml | 0 .../AudioDiagnosticsController.qml | 0 .../qml/diagnostics/AudioDiagnosticsView.qml | 0 .../AudioMicrophoneTestController.qml | 0 .../qml/microphone/MicrophoneTestRow.qml | 0 .../qml/panels/AdvancedAudio.qml | 0 .../qml/panels/Panel.qml | 0 .../qml/policy/AudioPolicyController.qml | 0 .../qml/policy/AudioPolicyToggleRow.qml | 0 .../qml/policy/AudioPolicyVolumeRow.qml | 0 .../qml/routing/AudioAppRuleRow.qml | 0 .../qml/routing/AudioOutputGroupCreateRow.qml | 0 .../routing/AudioOutputGroupMemberLevel.qml | 0 .../qml/routing/AudioOutputGroupRow.qml | 0 .../routing/AudioOutputGroupsController.qml | 0 .../qml/routing/AudioRulesController.qml | 0 .../qml/scenes/AudioSceneController.qml | 0 .../qml/scenes/AudioSceneRow.qml | 0 test/integration/native_backend.py | 99 ++++++++++++++++++ 40 files changed, 140 insertions(+), 16 deletions(-) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/components/AudioBalanceRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/components/AudioBarIcon.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/components/AudioDropdown.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/components/AudioSinkRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/components/AudioSlider.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/components/AudioSourceRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/components/AudioStreamRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/core/AudioNodeModel.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/core/AudioProtocol.js (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/core/AudioRuntime.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/core/Model.js (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/core/ReleasePaths.js (50%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/core/Service.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/devices/AudioBluetoothPreferenceRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/devices/AudioDevicePrefRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/devices/AudioPortRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/devices/AudioProfileRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/diagnostics/AudioDiagnosticActionRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/diagnostics/AudioDiagnosticsController.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/diagnostics/AudioDiagnosticsView.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/microphone/AudioMicrophoneTestController.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/microphone/MicrophoneTestRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/panels/AdvancedAudio.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/panels/Panel.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/policy/AudioPolicyController.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/policy/AudioPolicyToggleRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/policy/AudioPolicyVolumeRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/routing/AudioAppRuleRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/routing/AudioOutputGroupCreateRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/routing/AudioOutputGroupMemberLevel.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/routing/AudioOutputGroupRow.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/routing/AudioOutputGroupsController.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/routing/AudioRulesController.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/scenes/AudioSceneController.qml (100%) rename runtime/{a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6 => 3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d}/qml/scenes/AudioSceneRow.qml (100%) diff --git a/backend-release.json b/backend-release.json index 611b5da..43ca95a 100644 --- a/backend-release.json +++ b/backend-release.json @@ -1,7 +1,7 @@ { - "buildId": "a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6", + "buildId": "3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d", "target": "x86_64-unknown-linux-gnu", "version": "0.1.0", "protocolVersion": 1, - "sha256": "4a88e3b548c7140c1c4820cb84bfd2ed56a009a31894464371ed5b025032d9b3" + "sha256": "7faad268771810e4aa53463d36e7f66d4cf35079c103e05bfcd9414d4f763d0e" } diff --git a/bin/omarchy-audio-service b/bin/omarchy-audio-service index 2fa77b1522ca41b7613da9b636c7a7b8d0eb2c14..a062f044e72ec5a235a5a755a1f8cd5cadd314ce 100755 GIT binary patch delta 418 zcmbu%H%`M)0DxiH4g`YfCZy1N2@u!!vLJQ_E?^0{y?Y>r93YXrMu;T~Fd%tjX5bVk zBLhN=4E&sd;ak7K{kt~6Q_HZ1KQCYEYS?e8a__B@)b9+l+Pl$f`DY4Q$H@Ze#8S08Q6z;Bw(X>jh@_WgiSMRDiZs9e z&>O{fuD@RX|9X7ZYF%rj!$1jR7)Kcsm_!9rFfol8%wi7nSimAIETM{J{M~gl(8LN> qv4(YQU=v%|#twF|hkYF25Jxyh3nw_m8QQSnz=a1NL1B%A`S1(L#h73K delta 418 zcmbu%xh@280KnnQ%({1-gSD*twwU98>=r~T^a_*6>>PCd6du6OGbq0HYu$YqEj(8&`~2d*ymR~@PLB@vKilu(wQzQOeQ6e(-8c&ykU@>q5kJUnMGz{M6Htqm{2}%GGYQ<~b^ni4KKKy)bq{ z)jat!OW9A;d^`C6_4HyC8+O}-g&aE2i7s@b2fgS+9tHGc0D~C9Fh*cw6k{02-#vj6 tCNYIFrZIzA%wZl2Si};Rv4T~sVI3Q&U=v%|h65KKd%a<1ffjmXZJf diff --git a/manifest.json b/manifest.json index 7cb1b36..07a09eb 100644 --- a/manifest.json +++ b/manifest.json @@ -11,9 +11,9 @@ "service" ], "entryPoints": { - "barWidget": "runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/Panel.qml", - "panel": "runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/AdvancedAudio.qml", - "service": "runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/Service.qml" + "barWidget": "runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/panels/Panel.qml", + "panel": "runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/panels/AdvancedAudio.qml", + "service": "runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/Service.qml" }, "barWidget": { "displayName": "Advanced Audio Control", diff --git a/packaging/launch-backend.py b/packaging/launch-backend.py index eb4bf95..c2d56b3 100644 --- a/packaging/launch-backend.py +++ b/packaging/launch-backend.py @@ -26,9 +26,16 @@ def release_tools(root): return module -def matches(binary, target, machine, build_id, tools): +def matches(binary, target, machine, build_id, tools, cached=False): try: - with binary.open('rb') as stream: + descriptor = os.open(binary, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK) + with os.fdopen(descriptor, 'rb') as stream: + metadata = os.fstat(stream.fileno()) + if not stat.S_ISREG(metadata.st_mode): + return False + if cached and (metadata.st_uid != os.getuid() or metadata.st_nlink != 1 + or metadata.st_mode & 0o022): + return False header = stream.read(20) # Never execute a foreign ELF (including via binfmt/QEMU). if (len(header) != 20 or header[:6] != b'\x7fELF\x02\x01' @@ -36,12 +43,21 @@ def matches(binary, target, machine, build_id, tools): or not os.access(binary, os.X_OK)): return False info = tools.inspect(binary) - return (info.get('buildId') == build_id and info.get('target') == target + return (isinstance(info, dict) and info.get('buildId') == build_id and info.get('target') == target and info.get('protocolVersion') == 1) except (OSError, ValueError, subprocess.SubprocessError): return False +def cache_directory(path, parents=False): + path.mkdir(parents=parents, exist_ok=True, mode=0o700) + metadata = path.lstat() + if (not stat.S_ISDIR(metadata.st_mode) or metadata.st_uid != os.getuid() + or metadata.st_mode & 0o022): + raise ValueError('Native audio cache directory must be owned by this user ' + 'and not writable by other users') + + def prepare(root, machine=None, cache_home=None): machine = platform.machine() if machine is None else machine if platform.system() != 'Linux' or machine not in TARGETS: @@ -55,25 +71,35 @@ def prepare(root, machine=None, cache_home=None): base = Path(cache_home or os.environ.get('XDG_CACHE_HOME') or Path.home()/'.cache') if not base.is_absolute(): raise ValueError('XDG_CACHE_HOME must be an absolute path') - cache = base/'omarchy-audio-control'/target - cache.mkdir(parents=True, exist_ok=True, mode=0o700) + # Resolve the configured cache home for dotfiles setups, then keep every + # plugin-owned directory on a trusted, non-redirected path before execution. + base = base.resolve() + cache_directory(base, parents=True) + plugin_cache = base/'omarchy-audio-control' + cache_directory(plugin_cache) + cache = plugin_cache/target + cache_directory(cache) cached = cache/build_id/'omarchy-audio-service' - if matches(cached, target, elf_machine, build_id, tools): + cache_directory(cached.parent) + if matches(cached, target, elf_machine, build_id, tools, cached=True): return cached # A shared Cargo target directory reuses dependencies across UI updates. # Serialize preparations and recheck after locking for concurrent panels. - lock_fd = os.open(cache/'.build.lock', os.O_CREAT | os.O_RDWR | os.O_NOFOLLOW, 0o600) + lock_fd = os.open(cache/'.build.lock', os.O_CREAT | os.O_RDWR | os.O_NOFOLLOW | os.O_NONBLOCK, 0o600) with os.fdopen(lock_fd, 'w') as lock: info = os.fstat(lock.fileno()) - if not stat.S_ISREG(info.st_mode) or info.st_uid != os.getuid() or info.st_nlink != 1: + if (not stat.S_ISREG(info.st_mode) or info.st_uid != os.getuid() + or info.st_nlink != 1 or info.st_mode & 0o022): raise ValueError('Native audio build lock is not a private regular file') + os.fchmod(lock.fileno(), 0o600) fcntl.flock(lock, fcntl.LOCK_EX) - if matches(cached, target, elf_machine, build_id, tools): + if matches(cached, target, elf_machine, build_id, tools, cached=True): return cached if not shutil.which('cargo'): raise ValueError('This CPU needs a native audio backend. Install Rust/Cargo 1.85+, ' 'libclang, pkg-config, and PipeWire/libpulse development headers, ' 'then reload the plugin (see README).') + cache_directory(cache/'target') print(f'Building native audio backend for {target}; later launches use the cached build', file=sys.stderr) result = subprocess.run([ 'cargo', 'build', '--locked', '--release', '--manifest-path', str(root/'backend/Cargo.toml'), @@ -88,7 +114,6 @@ def prepare(root, machine=None, cache_home=None): # Do not publish a build if the plugin changed while Cargo was running. if tools.source_id(root) != build_id: raise ValueError('Plugin updated while building the audio backend; reload and retry') - cached.parent.mkdir(exist_ok=True, mode=0o700) with tempfile.NamedTemporaryFile(dir=cached.parent, prefix='.backend-', delete=False) as stage: temporary = Path(stage.name) try: diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioBalanceRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioBalanceRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioBalanceRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioBalanceRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioBarIcon.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioBarIcon.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioBarIcon.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioBarIcon.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioDropdown.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioDropdown.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioDropdown.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioDropdown.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioSinkRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioSinkRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioSinkRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioSinkRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioSlider.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioSlider.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioSlider.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioSlider.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioSourceRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioSourceRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioSourceRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioSourceRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioStreamRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioStreamRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/components/AudioStreamRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/components/AudioStreamRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/AudioNodeModel.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/AudioNodeModel.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/AudioNodeModel.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/AudioNodeModel.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/AudioProtocol.js b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/AudioProtocol.js similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/AudioProtocol.js rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/AudioProtocol.js diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/AudioRuntime.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/AudioRuntime.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/AudioRuntime.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/AudioRuntime.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/Model.js b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/Model.js similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/Model.js rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/Model.js diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/ReleasePaths.js b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/ReleasePaths.js similarity index 50% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/ReleasePaths.js rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/ReleasePaths.js index 408c415..9e54627 100644 --- a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/ReleasePaths.js +++ b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/ReleasePaths.js @@ -1,3 +1,3 @@ // Generated release paths; edit the qml sources instead. var root = "../../../../" -var buildId = "a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6" +var buildId = "3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d" diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/Service.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/Service.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/core/Service.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/core/Service.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioBluetoothPreferenceRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioBluetoothPreferenceRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioBluetoothPreferenceRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioBluetoothPreferenceRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioDevicePrefRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioDevicePrefRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioDevicePrefRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioDevicePrefRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioPortRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioPortRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioPortRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioPortRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioProfileRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioProfileRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/devices/AudioProfileRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/devices/AudioProfileRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/diagnostics/AudioDiagnosticActionRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/diagnostics/AudioDiagnosticActionRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/diagnostics/AudioDiagnosticActionRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/diagnostics/AudioDiagnosticActionRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/diagnostics/AudioDiagnosticsController.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/diagnostics/AudioDiagnosticsController.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/diagnostics/AudioDiagnosticsController.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/diagnostics/AudioDiagnosticsController.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/diagnostics/AudioDiagnosticsView.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/diagnostics/AudioDiagnosticsView.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/diagnostics/AudioDiagnosticsView.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/diagnostics/AudioDiagnosticsView.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/microphone/AudioMicrophoneTestController.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/microphone/AudioMicrophoneTestController.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/microphone/AudioMicrophoneTestController.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/microphone/AudioMicrophoneTestController.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/microphone/MicrophoneTestRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/microphone/MicrophoneTestRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/microphone/MicrophoneTestRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/microphone/MicrophoneTestRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/AdvancedAudio.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/panels/AdvancedAudio.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/AdvancedAudio.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/panels/AdvancedAudio.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/Panel.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/panels/Panel.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/panels/Panel.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/panels/Panel.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/policy/AudioPolicyController.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/policy/AudioPolicyController.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/policy/AudioPolicyController.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/policy/AudioPolicyController.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/policy/AudioPolicyToggleRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/policy/AudioPolicyToggleRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/policy/AudioPolicyToggleRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/policy/AudioPolicyToggleRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/policy/AudioPolicyVolumeRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/policy/AudioPolicyVolumeRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/policy/AudioPolicyVolumeRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/policy/AudioPolicyVolumeRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioAppRuleRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioAppRuleRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioAppRuleRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioAppRuleRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupCreateRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupCreateRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupCreateRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupCreateRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupMemberLevel.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupMemberLevel.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupMemberLevel.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupMemberLevel.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupRow.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupsController.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupsController.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioOutputGroupsController.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioOutputGroupsController.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioRulesController.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioRulesController.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/routing/AudioRulesController.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/routing/AudioRulesController.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/scenes/AudioSceneController.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/scenes/AudioSceneController.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/scenes/AudioSceneController.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/scenes/AudioSceneController.qml diff --git a/runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/scenes/AudioSceneRow.qml b/runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/scenes/AudioSceneRow.qml similarity index 100% rename from runtime/a54274df05584205c37b44db36e6dc3f27c076369617189206e5e7a45f2ad0a6/qml/scenes/AudioSceneRow.qml rename to runtime/3b427ced50a7f5b6ee554fb64f8f92e682b8f09aa8777112d27a84eec53d787d/qml/scenes/AudioSceneRow.qml diff --git a/test/integration/native_backend.py b/test/integration/native_backend.py index 1bf95ac..086a504 100644 --- a/test/integration/native_backend.py +++ b/test/integration/native_backend.py @@ -3,9 +3,12 @@ import hashlib import importlib.util import json +import os from pathlib import Path import struct import subprocess +from subprocess import run as run_process +import sys import tempfile from types import SimpleNamespace import unittest @@ -101,6 +104,102 @@ def test_corrupt_cache_is_rebuilt(self): self.assertEqual(self.prepare(), binary) self.assertEqual(self.cargo.call_count, 2) + def test_fifo_binary_is_rejected_without_blocking(self): + binary = self.root/'fifo-backend' + os.mkfifo(binary) + probe = ('import runpy; from pathlib import Path; ' + 'launcher = runpy.run_path('+repr(str(ROOT/'packaging/launch-backend.py'))+'); ' + 'print(launcher["matches"](Path('+repr(str(binary))+'), ' + '"x86_64-unknown-linux-gnu", 62, "unused", None))') + result = run_process([sys.executable, '-c', probe], + capture_output=True, text=True, timeout=2, check=True) + self.assertEqual(result.stdout.strip(), 'False') + + def test_writable_cache_directories_are_rejected_before_inspection(self): + binary = self.prepare() + original = binary.read_bytes() + for directory in (self.cache, binary.parents[2], binary.parents[1], binary.parent): + with self.subTest(directory=directory): + directory.chmod(0o777) + self.inspected.clear() + try: + with self.assertRaisesRegex(ValueError, 'cache'): + self.prepare() + self.assertFalse(self.inspected) + self.assertEqual(binary.read_bytes(), original) + finally: + directory.chmod(0o700) + + def test_redirected_cache_directory_is_rejected_before_inspection(self): + binary = self.prepare() + directory = binary.parent.parent + outside = self.root/'outside-cache' + directory.rename(outside) + directory.symlink_to(outside, target_is_directory=True) + self.inspected.clear() + with self.assertRaisesRegex(ValueError, 'cache'): + self.prepare() + self.assertFalse(self.inspected) + + def test_unsafe_cached_binaries_are_replaced_without_executing_them(self): + binary = self.prepare() + for kind in ('symlink', 'hardlink', 'writable'): + with self.subTest(kind=kind): + outside = self.root/('outside-'+kind) + outside.write_bytes(binary.read_bytes()) + outside.chmod(0o755) + original = outside.read_bytes() + if kind == 'symlink': + binary.unlink() + binary.symlink_to(outside) + elif kind == 'hardlink': + binary.unlink() + os.link(outside, binary) + else: + binary.chmod(0o777) + self.inspected.clear() + self.cargo.reset_mock() + self.assertEqual(self.prepare(), binary) + self.assertEqual(self.cargo.call_count, 1) + self.assertNotIn(binary, self.inspected) + self.assertFalse(binary.is_symlink()) + self.assertEqual(binary.stat().st_nlink, 1) + self.assertEqual(binary.stat().st_mode & 0o022, 0) + self.assertEqual(outside.read_bytes(), original) + + def test_symlinked_cache_home_is_supported(self): + binary = self.prepare() + target = self.root/'real-cache' + self.cache.rename(target) + self.cache.symlink_to(target, target_is_directory=True) + self.assertEqual(self.prepare().resolve(), binary.resolve()) + self.assertEqual(self.cargo.call_count, 1) + + def test_unsafe_cargo_target_is_rejected_before_building(self): + binary = self.prepare() + binary.write_bytes(b'broken') + directory = binary.parent.parent/'target' + directory.chmod(0o777) + self.cargo.reset_mock() + with self.assertRaisesRegex(ValueError, 'cache'): + self.prepare() + self.cargo.assert_not_called() + directory.chmod(0o700) + outside = self.root/'outside-target' + directory.rename(outside) + directory.symlink_to(outside, target_is_directory=True) + with self.assertRaisesRegex(ValueError, 'cache'): + self.prepare() + self.cargo.assert_not_called() + + def test_malformed_build_info_is_rejected(self): + binary = self.root/'bin/omarchy-audio-service' + self.write_binary(binary, 'x86_64') + for value in (None, [], 'invalid'): + with self.subTest(value=value), patch.object(self.tools, 'inspect', return_value=value): + self.assertFalse(launcher.matches(binary, 'x86_64-unknown-linux-gnu', + 62, self.source_id(self.root), self.tools)) + def test_failed_build_publishes_no_executable(self): self.cargo.side_effect = subprocess.CalledProcessError(1, ['cargo']) with self.assertRaises(subprocess.CalledProcessError):