Bug 908534 - Shebang line '#!/usr/bin/env ruby --verbose' complains on 'ruby --verbose'
Summary: Shebang line '#!/usr/bin/env ruby --verbose' complains on 'ruby --verbose'
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 18
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-06 23:53 UTC by Horst H. von Brand
Modified: 2013-02-08 09:40 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-02-08 09:40:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Script showing the problem (53 bytes, application/octet-stream)
2013-02-06 23:53 UTC, Horst H. von Brand
no flags Details

Description Horst H. von Brand 2013-02-06 23:53:32 UTC
Created attachment 694191 [details]
Script showing the problem

Description of problem:
Shebang line '#!/usr/bin/env ruby --verbose' complains it doesn't find 'ruby --verbose'

Version-Release number of selected component (if applicable):
coreutils-8.17-8.fc18.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Run a simple script with the give shebang
2.
3.
  
Actual results:
/usr/bin/env: ruby --verbose: No such file or directory

Expected results:
Run the script

Additional info:

Comment 1 Ondrej Vasik 2013-02-07 16:12:23 UTC
I guess bash is probably playing some game here - try to run e.g. /usr/bin/env ls -l  -> it works - and if you use it as a shebang, it doesn't... adding Bash maintainer to CC.

Comment 2 Roman Rakus 2013-02-08 00:33:36 UTC
The executor is kernel. From my quick search the correct "shebang" line is:
#!interpreter [argument]

and argument is only 1 argument and couldn't contain white space. I didn't find any specification.

What bash do:
1) tries to call execve() function to execute the command - our kernel interprets the shebang line
2) It's possible the kernel doesn't support shebang line interpretation and bash can do it itself. However also bash interprets only 1 argument.

In other words, there is no option to provide more than one argument for interpreter in shebang.

Comment 3 Ondrej Vasik 2013-02-08 09:40:33 UTC
Ok, thanks for explanation Roman - closing NOTABUG - as this is not a bug in coreutils and it seems to be correct behaviour. Maybe it could be filed as RFE for kernel to improve the shebang handling of multiargs.


Note You need to log in before you can comment on or make changes to this bug.