Fedora 28 - python warnings

Richard Laager rlaager at wiktel.com
Fri May 11 19:23:04 UTC 2018


To recap my understanding, and what your links say, /usr/bin/env
performs two functions:

1) It's main purpose, hence the name, is to exec() with a clean environment.

2) When deciding what to exec(), it searches the $PATH.

Because of #2, a convention has developed wherein /usr/bin/env can be
used in shebang lines to avoid needing to hardcode the location of the
interpreter. That is, I can use "/usr/bin/env perl", and it doesn't
matter whether my "perl" is in /usr/bin, /usr/local/bin, /usr/sbin,
/bin, or whatever. As long as it is in the $PATH, env finds it.

Likewise, when I run "/usr/bin/env python foo", env searches the $PATH
for something named python and exec()s the first one it finds.

If there is no python in my $PATH, it will not find anything.


You are proposing that:
  /usr/bin/env python foo
be equivalent to (for example):
  /usr/bin/python3 foo

I'm saying that's not how env behaves. It simply searches the path for
"python". It doesn't translate that to "python3", and why should it?

You have said your system DOES behave that way.

Can you give the results of the following commands:

$ which python
$ python --version
$ /usr/bin/env python --version

-- 
Richard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20180511/ed3c9069/attachment.bin>


More information about the devel mailing list