0

我刚刚在 OEL 5.8 服务器上安装了 ruby​​,并且看到了一些奇怪的行为

服务器详情

 Linux myhost 2.6.18-238.el5 #1 SMP Tue Jan 4 15:41:11 EST 2011 x86_64 x86

红宝石版本

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

当我尝试运行一个 ruby​​ 程序时,我得到一个奇怪的错误

 -sh-3.2$ ruby testing.rb
 ruby: No such file or directory -- ('» (LoadError)

类似地调用 gem 返回类似的错误

-sh-3.2$ gem -v
/usr/bin/ruby: No such file or directory -- (W
(LoadError)

在 ruby​​ 上运行 strace 会在它死之前显示此错误

lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
lstat("/usr/lib/ruby", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib/ruby/site_ruby", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib/ruby/site_ruby/1.9.1", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib/ruby/site_ruby/1.9.1/rubygems", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb",  {st_mode=S_IFREG|0644, st_size=1871, ...}) = 0
open("(\227I\6", O_RDONLY)              = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(2, "ruby", 4ruby)                     = 4
write(2, ": ", 2: )                       = 2
write(2, "No such file or directory -- (\227I"..., 33No such file or directory -- (I) = 33
write(2, " (", 2 ()                       = 2
write(2, "LoadError", 9LoadError)                = 9
write(2, ")\n", 2)
)                      = 2
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0
rt_sigaction(SIGINT, {0x1, [], SA_RESTORER|SA_SIGINFO, 0x319d00eb10}, {0x4b1eb0, [],   SA_RESTORER|SA_SIGINFO, 0x319d00eb10}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER|SA_SIGINFO, 0x319d00eb10}, {0x1, [], SA_RESTORER|SA_SIGINFO, 0x319d00eb10}, 8) = 0
write(4, "!", 1)                        = 1
munmap(0x2ac6c5784000, 1052672)         = 0
exit_group(1)  

如果有人想看,我有完整的输出

奇怪的是,每次我调用 ruby​​ 时,我都会收到一条略有不同的错误消息(例如)

-sh-3.2$ ruby testing.rb
ruby: No such file or directory -- (Ç/ (LoadError)
-sh-3.2$ ruby testing.rb
ruby: No such file or directory -- Ç (LoadError)
-sh-3.2$ ruby testing.rb
ruby: No such file or directory -- 0w;   (LoadError)
-sh-3.2$ ruby testing.rb
ruby: No such file or directory -- NULLCMD (LoadError)
-sh-3.2$ ruby testing.rb
ruby: No such file or directory -- 07î (LoadError)

并且在每种情况下,我的 strace 在它死之前都会显示这样的错误

lstat("/usr/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb", {st_mode=S_IFREG|0644, st_size=1871, ...}) = 0
open("\20\7\3\30", O_RDONLY)            = -1 ENOENT (No such file or directory)

我注意到这发生在几周前,并重新安装了 ruby​​ 来修复它,但昨天凌晨 4 点,问题再次发生,这很奇怪,因为在那段时间没有使用盒子

我已经完成了通常的工作,比如检查其他版本的 Ruby,一切看起来都很好,所以我有点卡在这个上

有谁知道可能是什么原因造成的?更重要的是如何解决它

干杯

麦克风

4

1 回答 1

0

在运行 RHEL 6.3 的系统上遇到此问题。prelink 包每天运行一次并破坏 ruby​​ 二进制文件。我卸载了 prelink 并替换了 ruby​​ 二进制文件。

于 2013-01-30T16:25:05.997 回答