Repository navigation
rbgo refuses a script with arguments: no program using ARGV can run, and the corpus cannot see it #708
Description
rbgo refuses to run a script that is given arguments, so no Ruby program taking
command-line arguments can run under it.
$ ruby /tmp/argvtest.rb alpha beta
["alpha", "beta"]
$ rbgo /tmp/argvtest.rb alpha beta
usage: rbgo run <file.rb> | rbgo run -e "<code>" | rbgo <file.rb>
rbgo build [-o out] <file.rb> AOT-compile methods and link a native binary
$ rbgo run /tmp/argvtest.rb alpha beta # same usage message
$ rbgo /tmp/argvtest.rb -- alpha beta # same usage message
It is not that ARGV is unpopulated — the front-end rejects the command line
before the VM starts. ARGV itself exists and is well-formed:
$ rbgo -e 'p defined?(ARGV), ARGV.class'
"constant"
Array
So the VM half is in place and the argument vector simply never reaches it. MRI's
contract is ruby [options] script.rb [arguments...], with everything after the
script path belonging to the program, and -- forcing that boundary.
Why this matters more than its example count
Nothing in the ruby/spec corpus sweep exercises it, so it is worth zero
conformance examples and would never surface in the ratchet. But it is
load-bearing for what this project is for: rbgo build --closed script.rb
produces a standalone binary, and a standalone binary that cannot be passed
arguments is not a usable program. Any CLI tool, any script with a filename
parameter, any OptionParser program is out of reach.
It was found as a measurement hazard, which is how I would expect it to be met:
an agent's probe used ARGV[0] to pass a file path, and every single case returned
the same "LOAD_ERR". A uniform verdict across differing inputs was the only signal —
had the probe varied for another reason, the whole MRI → rbgo direction of that
measurement would have been silently void.
This is the fourth front-end gap found today, and they share a shape
- A deliberate exit status never reaches the process: rbgo -e 'exit 3' exits 0 #676 — a deliberate
exit 3never reached the process (fixed in signal+exit: a self-directed signal becomes a Ruby exception, and a deliberate exit status reaches the process (#691, #676) #693; the
discard turned out to be invm.Run, not the CLI, correcting my own diagnosis). - Process.kill(:TERM, Process.pid) kills the process instead of raising SignalException — ~77 examples behind one defect #691 — a self-directed signal killed the process instead of becoming a rescuable
exception (fixed in signal+exit: a self-directed signal becomes a Ruby exception, and a deliberate exit status reaches the process (#691, #676) #693). - GOOS=js GOARCH=wasm has not compiled for 3 days, and the test that catches it is behind an env var no workflow sets #682 —
rbgo buildonly worked from inside a checkout. - this one — script arguments are refused outright.
In each case the VM was further along than the front-end, and in each case the gap
is invisible to the conformance ratchet because the ratchet invokes rbgo <file>
with no arguments and reads a printed result line. The corpus cannot see the
command-line surface at all, so that surface needs its own tests rather than
waiting for an example count to justify it.
Activity
Give rbgo a ruby command line: ARGV, $0 and -w/-W (#708, #709) (#716)