[exim] Re: Pipe transport and script (shebang)

Góra strony
Delete this message
Reply to this message
Autor: Andreas Metzler
Data:  
Dla: exim-users
Temat: [exim] Re: Pipe transport and script (shebang)
On 2023-08-28 Slavko via Exim-users <exim-users@???> wrote:
[...]
> The only changes which i did, are -- i add path option to transport:


>     path = /my/scripts/path


Hello,

So you tell it to search *exclusively* there.

> I changed command name to relative (without path) in redirect router:


>     data = |script_name.py one_arg


> After message arrived, it fail to run that script, with output:


>     reports_pipe transport output: /usr/bin/env: 'python3': No such
>     file or directory


... and the shebang line "#!/usr/bin/env python3" tells the program
loader to run /usr/bin/env with arg "python3", and env searches for
python3 in PATH. It probably doeds not live in /my/scripts/path.

> I had that in shebang, after i changed shebang to point directly to
> /usr/bin/python3, it starts to work again.


> I tried to emulate that from shell by setting PATH variable to the same
> value as in transport, then i tried to clear it at all, but scripts runs
> without problem,

[...]

Your testing was faulty.

ametzler@argenau:~$ cat /tmp/hello
#!/usr/bin/env python3
print("Hello world!")
ametzler@argenau:~$ /tmp/hello
Hello world!
ametzler@argenau:~$ env PATH="/nopython3here" /tmp/hello
/usr/bin/env: ‘python3’: No such file or directory
ametzler@argenau:~$ env PATH="/nopython3here:/usr/bin" /tmp/hello
Hello world!

cu Andreas

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/