rvm 1.29.4在CentOS 7上有一个bug,在Bash下,source了rvm后,执行Crtl+C时,无法终止shell命令。

具体讨论在Unable to pass SIGINT signal (control-C) on 1.29.4 中。

解决办法:

  1. 在用户账号下强制使用trap设置回被改写的信号量INT QUIT
  2. 升级rvm到1.29.4以上版本

临时修改trap

在用户账号下强制使用trap设置回被改写的信号量INT QUIT

  • 在~/.bash_profile中source rvm命令之后添加trap - INT QUIT
  • ~/.bashrc 末尾加上trap - INT QUIT

使用trap强行改回的方法不限于rvm,也可用于其他扰乱系统shell的脚本。

关于trap的用法参见这篇文章关于Linux Shell的信号trap功能你必须知道的细节

升级rvm版本

使用rvm get stable升级rvm为最新的稳定版

过程中可能会报如下错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# rvm get stable
Downloading https://get.rvm.io
Downloading https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc
Verifying /usr/local/rvm/archives/rvm-installer.asc
gpg: Signature made Sun 30 Dec 2018 10:44:46 AM UTC using RSA key ID 39499BDB
gpg: Can't check signature: No public key
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found. Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).
GPG signature verification failed for '/usr/local/rvm/archives/rvm-installer' - 'https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc'! Try to install GPG v2 and then fetch the public key:
sudo gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -
the key can be compared with:
https://rvm.io/mpapis.asc
https://keybase.io/mpapis
NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys from remote server. Please downgrade or upgrade to newer version (if available) or use the second method described above.
bash: return: _ret: numeric argument required
#

使用如下命令安装新key后再rvm get stable即可正常升级。

1
gpg --keyserver hkp://keys.gnupg.net --recv-keys 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

rvm 版本升级报错的详细说明参见该issue RVM 1.29.5 stable signed with different key

留言