Summary: | #! does not seem to pass along arguments as expected | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | cyril mougel <cyril.mougel> |
Component: | [OLD] Core system | Assignee: | Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel> |
Status: | VERIFIED INVALID | ||
Severity: | normal | CC: | brodigan, graaff |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
patch for sow bin works
emerge --info output |
Description
cyril mougel
2007-11-16 17:15:10 UTC
Which ebuild version is this about? Also, can you attach the patch? Sorry for my forget. The version where I see this issue is the version 1.2.2. I had made a patch and I attach it. Created attachment 136101 [details, diff]
patch for sow bin works
As far as I can tell from the documentation this is a bug in /usr/bin/env (which would be a bit weird). Could you provide emerge --info and the version of coreutils on your system? According to the documentation, /usr/bin/env should handle the case where a command and args are given. This works fine in a shell, e.g. "env ls -l" works as expected, executing 'ls' with '-l' as the argument. However, when this is done in a shebang file like this: #!/usr/bin/env ls -l then env tries to execute 'ls -l' as a command, which obviously fails. I don't think that env itself is to blame here, but just gets the rest of the line as a single argument instead of multiple arguments. Created attachment 136133 [details]
emerge --info output
My emerge --info output.
has nothing to do with /usr/bin/env the kernel parses #! and passes those to userspace This is not a bug. It is the intended, albeit surprising, behaviour. On linux shebang invocations of an interpreter will be passed a maximum of one argument. Space separated words will be passed as one string. It is one of those lovable little *nix quirks that trips everyone up the first time they come across it. From "man execve": "The semantics of the optional-arg argument of an interpreter script vary across implementations. On Linux, the entire string following the interpreter name is passed as a single argument to the interpreter, and this string can include white space. However, behavior differs on some other systems. Some systems use the first white space to terminate optional-arg. On some systems, an interpreter script can have multiple arguments, and white spaces in optional-arg are used to delimit the arguments." There is a rather good and comprehensive discussion of the exact semantics of shebang invocations here: http://homepages.cwi.nl/~aeb/std/hashexclam-1.html Re-opening because the problem from the original bug reporter it not solved. There are actually a number of bugs for this upstream: http://rubyforge.org/search/?type_of_search=artifact&group_id=1513&atid=5921&words=sow&Search=Search In fact, one of these bugs refers to a fix for this in rubygems. rubygems should rewrite "/usr/bin/env ruby" interpreters on installation to use the local path, ie. /usr/bin/ruby, but this was broken. dev-ruby/rubygems-0.9.4-r2 should fix this. To confirm, emerge this version of rubygems first, and then re-emerge hoe. *** Bug 202546 has been marked as a duplicate of this bug. *** I've asked for rubygems-0.9.4-r2 to be stabilized in bug 202608 so that the fix will become more widely available. |