我最近安装了 Ubuntu 14.04 LTS,出于某种原因,当普通用户调用 perl 命令时,它会挂起。但是,如果我使用 sudo,它会完美运行。我认为 perl 程序正在尝试读取/写入普通用户无权访问的内容,但我如何确定或找出是什么?
我拥有的 perl 版本是 v5.18.2,是 64 位。
我询问的原因是我正在尝试运行一个显然使用 perl 的 make(所以它挂起了),但是如果我使用 sudo 运行它,我就没有权限覆盖 make 生成的文件。
如果有人有任何建议,我将不胜感激。谢谢!
编辑:这是的输出strace perl -v
。它会无限循环这个块。
execve("/apps/jas/bin/perl", ["perl", "-v"], [/* 62 vars */]) = 0 brk(0) = 0x7fe3c41f5000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe3c207d000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=87654, ...}) = 0 mmap(NULL, 87654, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe3c2067000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1845024, ...}) = 0 mmap(NULL, 3953344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe3c1a97000 mprotect(0x7fe3c1c53000, 2093056, PROT_NONE) = 0 mmap(0x7fe3c1e52000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bb000) = 0x7fe3c1e52000 mmap(0x7fe3c1e58000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe3c1e58000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe3c2066000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe3c2064000 arch_prctl(ARCH_SET_FS, 0x7fe3c2064740) = 0 mprotect(0x7fe3c1e52000, 16384, PROT_READ) = 0 mprotect(0x7fe3c229d000, 8192, PROT_READ) = 0 mprotect(0x7fe3c207f000, 4096, PROT_READ) = 0 munmap(0x7fe3c2067000, 87654) = 0 getpid() = 29478 rt_sigaction(SIGCHLD, {0x7fe3c2094460, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 geteuid() = 42590 brk(0) = 0x7fe3c41f5000 brk(0x7fe3c4216000) = 0x7fe3c4216000 getppid() = 29475 stat("/lhome/username", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 open("/apps/jas/bin/perl", O_RDONLY) = 3 fcntl(3, F_DUPFD, 10) = 10 close(3) = 0 fcntl(10, F_SETFD, FD_CLOEXEC) = 0 rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGINT, {0x7fe3c2094460, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 read(10, "#!/bin/sh\n\nDIRNAME=
目录名 $0\n"..., 8192) = 207 pipe([3, 4]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe3c2064a10) = 29479 close(4) = 0 read(3, "/apps/jas/bin\n", 128) = 14 read(3, "", 128) = 0 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=29479, si_status=0, si_utime=0, si_stime=0} --- rt_sigreturn() = 0 close(3) = 0 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 29479 pipe([3, 4]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe3c2064a10) = 29480 close(4) = 0 read(3, "Linux\n", 128) = 6 read(3, "", 128) = 0 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=29480, si_status=0, si_utime=0, si_stime=0} --- rt_sigreturn() = 0 close(3) = 0 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 29480
答案1
由于 PATH 的存储方式,我的系统使用了错误的 perl。我整理了 PATH,现在它正常工作了。如果您在使用其他程序时遇到类似问题,请尝试检查您的 PATH。