[Bug 1141989] Re: Env fails on command line arguments

C de-Avillez hggdh2 at ubuntu.com
Wed Aug 28 00:02:25 UTC 2013


Thank you for opening this bug and helping make Ubuntu better.

I am unsure if this is a coreutils limitation (meaning I am pretty sure
it is *not*, but not absolutely so). Although 'env' does allow for
parameters to the called program, 'bash', for example, limits this
usage:

(from 'info bash', chapter 3.8 "Shell Scripts"):

"if `filename' is an executable shell script.  This subshell
reinitializes itself, so that the effect is as if a new shell had been
invoked to interpret the script, with the exception that the locations
of commands remembered by the parent (see the description of `hash' in
*note Bourne Shell Builtins::) are retained by the child.

   Most versions of Unix make this a part of the operating system's
command execution mechanism.  If the first line of a script begins with
the two characters `#!', *the* *remainder* *of* *the* *line* specifies an
interpreter for the program.  Thus, you can specify Bash, `awk', Perl,
or some other interpreter and write the rest of the script file in that
language."

(my bolding, above.)

I do not remember this usage ever working on Linux... but it sounds to
me that this would be, then, a limitation imposed by (in my example)
bash, not a case of coreutils' 'env' misbehaving.

Although I cannot find a real clear explanation for 'dash', the
behaviour is the same (it considers 'dash -x' -- in my tests I had
"#!/build/buildd/env dash -x" as the shebang -- as a single "name".

As far as I can remember, but I may be wrong, this was enforced to limit
some exploits.


** Changed in: coreutils (Ubuntu)
   Importance: Undecided => Low

** Changed in: coreutils (Ubuntu)
       Status: Confirmed => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1141989

Title:
  Env fails on command line arguments

Status in “coreutils” package in Ubuntu:
  Incomplete

Bug description:
  This simple script works fine with env:

  #!/usr/bin/env python3
  print('Works')

  However if you add a command line argument to the Python 3 executable
  it fails:

  #!/usr/bin/env python3 -tt
  print('Does not work.')

  The error message printed is this:

  /usr/bin/env: python3 -tt: No such file or directory

  This exact same piece of code does work on OSX. It should work on
  Linux too, as the man page says that you can pass arguments to the
  command:

  SYNOPSIS
         env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

  ProblemType: Bug
  DistroRelease: Ubuntu 12.10
  Package: coreutils 8.13-3.2ubuntu2.1
  ProcVersionSignature: Ubuntu 3.5.0-25.39-generic 3.5.7.4
  Uname: Linux 3.5.0-25-generic i686
  ApportVersion: 2.6.1-0ubuntu10
  Architecture: i386
  Date: Sun Mar  3 13:50:47 2013
  InstallationDate: Installed on 2012-09-01 (182 days ago)
  InstallationMedia: Ubuntu 12.04.1 LTS "Precise Pangolin" - Release i386 (20120817.3)
  MarkForUpload: True
  ProcEnviron:
   TERM=xterm
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: coreutils
  UpgradeStatus: Upgraded to quantal on 2012-10-24 (129 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1141989/+subscriptions




More information about the foundations-bugs mailing list