emptyenv and default path

From: Brett Neumeier <bneumeier_at_gmail.com>
Date: Sat, 6 Feb 2016 12:41:07 -0600


I'm trying to get a handle on execline and have found some behavior that
perplexes me. I'm hoping someone can clarify what's going on!

I've installed all the skarnet stuff to /opt/skar. I configured skalibs
with "--with-default-path=/opt/skar/bin:/usr/bin:/bin"; my understanding is
that the various skarnet programs will use that default path if there is no
PATH environment variable.

When I don't have /opt/skar/bin in the PATH and I run this script:

#!/opt/skar/bin/execlineb -P
foreground { echo plugh } #1
foreground { echo plover }

of course execlineb crashes with "fatal: unable to exec emptyenv: No such
file or directory", because it can't find the emptyenv program.

When I change that line to /opt/skar/bin/emptyenv, though, I'm surprised
that the script fails with "emptyenv: fatal: unable to exec foreground: No
such file or directory" -- I expected that after emptyenv emptied the
environment, it would then use the default path to resolve the next command
and exec into it. But that doesn't happen!

If I change the first foreground command (line #1) so that it *also* has a
full path /opt/skar/bin/foreground, then the script works just as it does
if /opt/skar/bin is in the PATH when I run the script -- so after emptyenv
exec's into the next program, the default path is definitely being used.
Why isn't it used when emptyenv is running?



Brett Neumeier (bneumeier_at_gmail.com)
Received on Sat Feb 06 2016 - 18:41:07 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC