Skip to content

rbgo refuses a script with arguments: no program using ARGV can run, and the corpus cannot see it #708

Closed

Description

@tannevaled

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions