also sprach Michael DeHaan <michael.dehaan@gmail.com> [2013.02.15.0130 +1300]:
Mr. DeHaan misreads as also sprach Zarathustra and anticipates the
black monolith and soundtrack
I am working on it, but first I have a question:
In ansible/runner/__init__.py in function _execute_module, you go
through a bit of trouble to extract the shebang line and execute the
interpreter yourself, rather than just adding +x to the "command"
file you transferred and asking the linker to execute it.
Can you please tell me why you are doing this?
Absolutely.
As I recall, lots of people have different preferences on shells, and
many don't have a /bin/sh.
I think the problem is caused by some random operating system that
only has fish, but I can't remember
Ansible is a balance of juggling lots of various interests.
It also simplified some code that had to mangle the module if the
interpreter was in a different location, and there may have been some
benefit to not spawing the actual shell.
To be honest, it's been something of an evolution.
The only reason I could imagine is because you want to ensure things
are working if noexec is set on the mountpoint (thus preventing the
linker from working). However, in that case I think the proper
solution would be to require the admin to chose an appropriate
temporary directory instead.
That may have actually been a bit a part of it, it avoids the need for
the chmod and you can just execute the file by fully pathing Python
(or bash, or Ruby).
Shouldn't have any noexec problems in that case.
Are there other reasons to extract the shebang line and thereby
foreclosing the linker's work?
Not sure exactly what you mean by this last part.
I tend to think of linkers in gcc terms.