Skip to content

Executable scripts with #!$^X are interpreted as shell scripts #1293

Description

@fglock

Summary

PerlOnJava cannot execute generated executable Perl scripts whose shebang points to $^X. The host falls back to interpreting the script as a shell script, producing use: command not found and shell syntax errors.

Reproduction

Distribution: CLI::Cmdline 1.30

The upstream t/05-integration.t test writes an executable script.pl with:

print $fh "#!$^X\n";

It then executes the script directly. Under system Perl, all 275 tests pass. Under PerlOnJava, the five parser test files pass, but t/05-integration.t fails 22 of 25 assertions on both backends:

./script.pl: line 2: use: command not found
./script.pl: line 3: use: command not found
./script.pl: line 4: syntax error near unexpected token `('

The resulting exit status is 2 instead of the expected Perl-script results.

The issue reproduces with both the JVM backend and the interpreter backend. The failure is in executable-script/process-launch handling; CLI::Cmdline option parsing itself passes.

CPAN evidence

  • CPAN random tester run: 20260907-214651-8410
  • Target: CLI::Cmdline
  • Upstream result under system Perl: 275/275 tests passed
  • PerlOnJava result: 253/275 passed; 22 failures, all in t/05-integration.t

Expected behavior

An executable script with a PerlOnJava $^X shebang should be launched by PerlOnJava and execute as Perl, matching system Perl behavior.

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions