Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Shebang mode fails on JRuby due to bash script launcher

Aperta
#95 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
bash, ruby
Ambito
cli, tooling

Direzione di ricerca

Inizia da test/test_racc_command.rb, in particolare da Racc::TestRaccCommand#test_executable_parser, e riproduci il malfunzionamento su JRuby. Traccia il modo in cui vengono generati gli script del parser in shebang-mode e confronta il comportamento degli shebang non-env e env; il lavoro è completato quando il test del parser eseguibile passa sulle configurazioni JRuby interessate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The "shebang" mode for the parser generator does not work properly on some configurations of JRuby due to the jruby command being a bash script.

This leads to the following error in CI (see #93):

Failure:
Racc::TestRaccCommand#test_executable_parser [/Users/headius/projects/racc/test/test_racc_command.rb:57]:
Expected false to be truthy.

In many installs of JRuby, including the default tarball you can download from https://jruby.org, the jruby command is actually implemented using a bash script. Due to stupidity in the design of shebangs on most *nix systems, this means that the jruby script cannot be used directly in the shebang line of a Ruby script, because bash will attempt to execute both the jruby command and the target script with bash.

This is the reason that RubyGems with binscripts are usually installed using so-called "env shebangs" on JRuby, like so:

#!/usr/bin/env jruby

It is possible to install the jruby-launcher gem which will install a native jruby binary that works with the non-env shebang. This may be an option to get the test to pass, but it may be better to use an env shebang when generating the parser script.

Lingua principale
Yacc
Stelle
569
Fork
94
Merge medio
12h 11m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/racc

Tutte le issue di ruby/racc

Issue simili

Altre issue su CLI

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.