fix(vm-manager): guard qemu location lookup output#2682
Conversation
Walkthrough
ChangesVM share detection failure handling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
Summary
VM launch path translation now treats missing
getfattroutput as an empty location so PHP 8.4 does not log deprecation noise while preserving the existing fallback behavior.Why This Exists
The VM manager
qemu.phphook asks shfs for asystem.LOCATIONvalue before replacing/mnt/user/...paths with their backing disk or pool path. When that attribute lookup returns no output,shell_exec()can returnnull; passing that directly intotrim()emits a PHP 8.4 deprecation warning during VM startup.Resolution
Coalesce the
shell_exec()result to an empty string before trimming it. This keeps the existingempty($realdisk)fallback path intact when no location is available.Reviewer Considerations
/mnt/user/...argument is still the right fallback when nosystem.LOCATIONvalue is returned.Behavior Changes
VM startup should no longer emit a PHP deprecation warning when the location lookup produces no output. Path translation behavior is otherwise unchanged.
Implementation Summary
qemu.phpshell_exec()result with?? ''beforetrim().Verification
git diff --checkphp -l emhttp/plugins/dynamix.vm.manager/scripts/qemu.phptrim(null ?? "") === ""returnedtrue.Risk
Low; the change only normalizes a no-output command result to the empty string path the existing logic already treats as no replacement.
OS-480