Why does strace return so many execve calls with ENOENT return code?
I wanted to use strace to see what was happening when I do `hadoop fs -ls ', so I ran the command:
strace -f -e trace=execve hadoop fs -ls /stg
which resulted in a lot of output like this:
[pid 187050] execve("/opt/sas/app/platform/lsf/8.0/linux2.6-glibc2.3-x86_64/etc/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = -1 ENOENT (No such file or directory)
[pid 187050] execve("/opt/sas/app/platform/lsf/8.0/linux2.6-glibc2.3-x86_64/bin/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = -1 ENOENT (No such file or directory)
[pid 187050] execve("/opt/dca/bin/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = -1 ENOENT (No such file or directory)
[pid 187050] execve("/usr/local/greenplum-cc-web/./bin/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = -1 ENOENT (No such file or directory)
[pid 187050] execve("/usr/lib64/qt-3.3/bin/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = -1 ENOENT (No such file or directory)
[pid 187050] execve("/usr/local/bin/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = -1 ENOENT (No such file or directory)
[pid 187050] execve("/bin/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = -1 ENOENT (No such file or directory)
[pid 187050] execve("/usr/bin/setsid", ["setsid", "bash", "-c", "echo $$"], [/* 78 vars */]) = 0
Why would there be so many -1 ENOENT (No such file or directory)
results?
Solution 1:
It's trying to run the program by calling every potential location in $PATH
-order without foreknowledge of where the program is. This is completely normal because doing something like stat()
then execve()
is considered a race condition by security best practices in a lot of software shops.