我想使用 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
为什么会有这么多-1 ENOENT (No such file or directory)
结果?
答案1
它试图按顺序调用每个潜在位置来运行程序,$PATH
而无需预先知道程序的位置。这完全正常,因为许多软件商店的安全最佳实践认为stat()
这样做是一种竞争条件。execve()