为什么 strace 返回这么多带有 ENOENT 返回码的 execve 调用?

jcm*_*jcm 5 linux linux-kernel

我想使用 strace 来查看执行 `hadoop fs -ls ' 时发生了什么,所以我运行了以下命令:

strace -f -e trace=execve hadoop fs -ls /stg 这导致了很多这样的输出:

[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
Run Code Online (Sandbox Code Playgroud)

为什么会有这么多-1 ENOENT (No such file or directory)结果?

And*_*zek 9

它试图通过按$PATH顺序调用每个潜在位置来运行程序,而不预先知道程序在哪里。因为做这样的事情是完全正常的stat()execve()是考虑了安全最佳做法的竞争条件在很多软件商店。