Repository navigation
fix(cli): make the sandbox download path probe work with busybox realpath - #4912
Closed
viwe-monai wants to merge 1 commit into
Closed
viwe-monai wants to merge 1 commit into
viwe-monai wants to merge 1 commit into
Conversation
…path
`sandbox download` resolved the source path with `pwd -P && realpath -e --
<path>`. busybox realpath has no `-e` flag and treats `-e` and `--` as
filenames, so on Alpine-based images the probe printed errors and exited 1
('failed to resolve sandbox source path ... ssh probe exited with status 1')
even for paths that exist — breaking the documented upload -> run -> download
workflow on any busybox image, including ghcr.io/anomalyco/opencode:latest.
Replace the GNU-only invocation with the POSIX form `test -e <path> &&
realpath <path>`, keeping the two-line output contract (workspace root,
resolved path) and the non-zero-exit behavior for missing paths. Since `--`
is gone, relative paths are prefixed with ./ so a leading-dash name cannot be
parsed as an option. Factor the command into sandbox_source_resolve_command
so it can be tested, and cover symlink resolution, leading-dash names, names
with spaces, and the missing-path failure under /bin/sh.
|
Thank you for your interest in contributing to OpenShell, @viwe-monai. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
|
Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text: I have read the DCO document and I hereby sign the DCO. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot. |
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.
Fixes #4909
Problem
sandbox downloadresolved the source path with:busybox
realpathhas no-eflag and treats-eand--as filenames, so on Alpine-based images (including the official example imageghcr.io/anomalyco/opencode:latest) the probe errors out even for paths that exist:→
failed to resolve sandbox source path ... ssh probe exited with status 1. Upload andsandbox execare unaffected; onlydownloadbreaks.Fix
The POSIX form from the issue's suggested UX, minus
--(which busybox also rejects):--gone, relative paths get a./prefix so a leading-dash name can't be parsed as an option; absolute paths can't start with-.sandbox_source_resolve_command()so it is unit-testable.Verification
Reproduced the exact busybox failure and fix with
busybox sh+ busyboxrealpath(old probe:realpath: -e: No such file or directory, exit 1 → new probe: exit 0,/tmp/probe-env/link/probe.txt→/tmp/probe-env/real/probe.txt).New test
ssh::tests::sandbox_source_resolve_probe_is_posix_and_resolves_symlinksruns the exact command under/bin/shand asserts: symlink resolution (absolute + relative), a leading-dash relative name, a name with spaces, and missing path → non-zero exit with only the root line.