-
Notifications
You must be signed in to change notification settings - Fork 545
fix: Remove redundant single quotes in Linux terminal command #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Remove redundant single quotes in Linux terminal command #409
Conversation
The bash -c command was wrapped with extra single quotes around the script argument, causing the Start Server button to fail on Linux. Before: bash -c "'command; exec bash'" After: bash -c "command; exec bash" The double quotes are sufficient for bash -c to receive the command as a single argument.
WalkthroughA single file modification to ServerManagementService.cs removes outer single-quote enclosure from a Linux terminal process command script construction, changing how the command string is passed to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
MCPForUnity/Editor/Services/ServerManagementService.cs (1)
437-437: Consider updating single-quote escaping for consistency.The
'\\''escape pattern on this line is specifically designed for escaping single quotes within single-quoted bash strings. Now that the script no longer wraps the command in single quotes (after the fix on line 439), this escaping idiom may not work as intended if the command ever contains single quotes.For the current context (command passed to bash -c without surrounding quotes), the simpler
\'escape would be more appropriate:-string escapedCommandLinux = command.Replace("'", "'\\''"); +string escapedCommandLinux = command.Replace("'", "\\'");However, since the command is constructed from controlled sources (uvx path, package name, HTTP URL) and is unlikely to contain single quotes in practice, this is not a pressing issue.
If you'd like to verify the escaping behavior with commands containing single quotes, I can generate a test script.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
MCPForUnity/Editor/Services/ServerManagementService.cs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-05T16:22:04.960Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 265
File: README.md:204-204
Timestamp: 2025-09-05T16:22:04.960Z
Learning: In the Unity MCP project, the ServerInstaller.cs creates a symlink from ~/Library/AppSupport to ~/Library/Application Support on macOS to mitigate argument parsing and quoting issues in some MCP clients. The README documentation should use the shortened AppSupport path, not the full "Application Support" path with spaces.
Applied to files:
MCPForUnity/Editor/Services/ServerManagementService.cs
📚 Learning: 2025-09-05T16:22:04.960Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 265
File: README.md:204-204
Timestamp: 2025-09-05T16:22:04.960Z
Learning: In the Unity MCP project, the ServerInstaller.cs creates a symlink from ~/Library/AppSupport to ~/Library/Application Support on macOS to avoid spaces in paths that can cause arg parsing and quoting issues in some MCP clients. The README documentation should use the shortened AppSupport path, not the full "Application Support" path.
Applied to files:
MCPForUnity/Editor/Services/ServerManagementService.cs
🔇 Additional comments (1)
MCPForUnity/Editor/Services/ServerManagementService.cs (1)
438-439: LGTM! Fix correctly removes redundant single quotes.The removal of outer single quotes from the script construction correctly fixes the issue where bash was treating the entire command as a literal string instead of executing it. The change transforms
bash -c "'command; exec bash'"intobash -c "command; exec bash", which allows bash to properly parse and execute the command.The double quotes in the final construction (line 442) are consumed by the C# argument parser to group the script as a single argument to bash -c, while bash itself receives the unquoted command string to execute.
|
Not clear what the value add is, and Coderabbit says it could be a security vulnerability. |
Description
Fixes a bug where the "Start Server" button fails to execute the command correctly on Linux systems.
Problem
In
ServerManagementService.cs, the Linux terminal command construction wraps the script in redundant single quotes when building thebash -cargument:The extra single quotes cause bash to interpret the entire command as a literal string rather than executing it.
Solution
Remove the redundant single quotes since the double quotes already properly delimit the argument for
bash -c:Testing
Checklist
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.