fix(sandbox): prevent shell option interpretation for paths with leading hyphens#25891
Merged
steipete merged 2 commits intoopenclaw:mainfrom Feb 25, 2026
Conversation
…ing hyphens Paths starting with "-" (like those containing "---" pattern) can be interpreted as shell options by the sh shell. This fix adds a helper function that prepends "./" to paths starting with "-" to prevent this interpretation. This fixes the issue where sandbox filesystem operations fail with "Syntax error: ; unexpected" when file paths contain the "---" pattern used in auto-generated inbound media filenames like: file_1095---f00a04a2-99a0-4d98-99b0-dfe61c5a4198.ogg 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
b23a548 to
3951fc7
Compare
Contributor
|
Landed via temp rebase onto main.
Thanks @albertlieyingadrian! |
This was referenced Feb 25, 2026
joshavant
pushed a commit
that referenced
this pull request
Feb 25, 2026
Contributor
Author
|
Your welcome! @steipete |
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
Jackson3195
pushed a commit
to Jackson3195/openclaw-with-a-personal-touch
that referenced
this pull request
Feb 25, 2026
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
2 tasks
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Feb 27, 2026
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
6 tasks
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
… (thanks @albertlieyingadrian) (cherry picked from commit c7ae4ed) # Conflicts: # CHANGELOG.md # src/agents/sandbox/fs-bridge.ts
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
… (thanks @albertlieyingadrian) (cherry picked from commit c7ae4ed) # Conflicts: # CHANGELOG.md # src/agents/sandbox/fs-bridge.ts
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
thebenjaminlee
pushed a commit
to escape-velocity-ventures/openclaw
that referenced
this pull request
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Syntax error: ";" unexpectedwhen file paths contain the---patternensurePathNotInterpretedAsOption()helper function that prepends "./" to paths starting with "-" to prevent shell option interpretationProblem
After upgrading from 2026.2.22 to 2026.2.23, all sandbox filesystem operations (
read,write,image) fail with:This breaks ALL inbound media processing - agents cannot see photos, voice notes, or documents sent by users via Telegram.
Root Cause
Paths starting with "-" (including those containing "---" pattern in filenames like
file_1095---f00a04a2-99a0-4d98-99b0-dfe61c5a4198.ogg) can be interpreted as shell options by the sh shell when passed as arguments tosh -c.Solution
Added a helper function
ensurePathNotInterpretedAsOption()that prepends "./" to paths starting with "-" to ensure they're always treated as file paths, not options.Testing
file_1095---f00a04a2-99a0-4d98-99b0-dfe61c5a4198.oggfile_1221---6c4f9947-8cbb-48a1-a834-e69c2bbfeaa2.mdfile_1569---54dcf3f8-9874-4888-8f47-a5fb719f584f.mdPost-Deploy Monitoring & Validation
moltbot-sandbox-fs.*Syntax errorread,imagetools---pattern in filenameSyntax errorstill appears in logs after deployment, revertGreptile Summary
Fixed critical sandbox filesystem bug where paths starting with
-(hyphen) were interpreted as shell options instead of file paths, causing all filesystem operations to fail withSyntax error: ";" unexpected. AddedensurePathNotInterpretedAsOption()helper that prepends./to hyphen-prefixed paths before passing them to shell commands. Applied consistently across all filesystem operations:readFile,writeFile,mkdirp,remove,rename,stat, andresolveCanonicalContainerPath../to paths starting with-or-----pattern in filenames (e.g.,file_1095---uuid.ogg)--argument terminatorsConfidence Score: 5/5
./prefix for hyphen-prefixed paths), is consistently applied across all filesystem operations, works correctly with existing--argument terminators in shell scripts, and has comprehensive coverage. The fix addresses a real production issue affecting media processing without introducing new attack vectors.Last reviewed commit: b23a548
(2/5) Greptile learns from your feedback when you react with thumbs up/down!