From e7af5ba25b0f04def15fff3b473346146e538e90 Mon Sep 17 00:00:00 2001 From: sonofelice Date: Mon, 1 Feb 2016 23:10:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=B8=ADHow=20bad=20a=20?= =?UTF-8?q?boss=20is=20Linus=20Torvalds=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译中How bad a boss is Linus Torvalds? --- sources/talk/20151117 How bad a boss is Linus Torvalds.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20151117 How bad a boss is Linus Torvalds.md b/sources/talk/20151117 How bad a boss is Linus Torvalds.md index 8b10e44584..76e9f4c244 100644 --- a/sources/talk/20151117 How bad a boss is Linus Torvalds.md +++ b/sources/talk/20151117 How bad a boss is Linus Torvalds.md @@ -1,3 +1,4 @@ +sonofelice translating How bad a boss is Linus Torvalds? ================================================================================ ![linus torvalds](http://images.techhive.com/images/article/2015/08/linus_torvalds-100600260-primary.idge.jpg) From b74befbdb37e452359c9b6e23bac7926d448765a Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 2 Feb 2016 11:45:02 +0800 Subject: [PATCH 2/4] PUB:20151201 How to use Mutt email client with encrypted passwords @wyangsun --- ...t email client with encrypted passwords.md | 135 +++++++++++++++++ ...t email client with encrypted passwords.md | 138 ------------------ 2 files changed, 135 insertions(+), 138 deletions(-) create mode 100644 published/20151201 How to use Mutt email client with encrypted passwords.md delete mode 100644 translated/tech/20151201 How to use Mutt email client with encrypted passwords.md diff --git a/published/20151201 How to use Mutt email client with encrypted passwords.md b/published/20151201 How to use Mutt email client with encrypted passwords.md new file mode 100644 index 0000000000..2c57a73d91 --- /dev/null +++ b/published/20151201 How to use Mutt email client with encrypted passwords.md @@ -0,0 +1,135 @@ +如何 Mutt 邮件客户端中使用密文密码 +================================================================================ +Mutt 是一个 Linux/UNIX 终端环境下的开源的邮件客户端。Mutt 以及 [Alpine][1] 在 Linux 命令行爱好者中有着最忠诚的追随者,这不是没有原因的。想一下你所期待邮件客户端应有的功能,Mutt 拥有:多协议支持(例如,POP3、IMAP 和 SMTP),S/MIME 和 PGP/GPG 集成,会话线索,颜色标记,可定制宏/快捷键,等等。另外,基于命令行的 Mutt 相比粗重的基于浏览器的邮件客户端(如:Gmail,Ymail)或图形用户界面的邮件客户端(如:Thunderbird,MS Outlook)而言,是一个使用电子邮件的轻量级替代品。 + +当你想使用 Mutt 通过公司的 SMTP/IMAP 服务器访问或发送邮件,或取代网页邮件服务,可能所关心的一个问题是如何保护您的邮件凭据(如:SMTP/IMAP 密码),它们存储在一个纯文本 Mutt 配置文件(~/.muttrc)中。 + +对于这些人对安全的担忧,确实有一个容易的方法来**加密 Mutt 配置文件***,以防止这种风险。在这个教程中,我描述了如何加密 Mutt 敏感配置,比如使用 GnuPG(GPG)加密 SMTP/IMAP 密码,GPG 是一个开源的 OpenPGP 实现。 + +### 第一步 (可选):创建 GPG 密钥 ### + +因为我们将要使用 GPG 加密 Mutt 配置文件,如果你没有 GPG 密钥,第一步就是创建一个(公钥/私钥对)。如果有,请忽略这步。 + +创建一个新 GPG 密钥,输入下面命令: + + $ gpg --gen-key + +选择密钥类型(RSA),密钥长度(2048 bits),和过期时间(0 代表不过期)。当出现用户 ID 提示时,输入关联到该公钥/私钥对的名字(Dan Nanni) 和邮箱地址(myemail@email.com)。最后,输入一个密码来保护你的私钥。 + +![](https://c2.staticflickr.com/6/5726/22808727824_7735f11157_c.jpg) + +生成一个 GPG 密钥需要大量的随机字节来构成熵,所以在生成密钥期间确保在你的系统上执行一些随机行为(如:敲打键盘,移动鼠标或者读写磁盘)。根据密钥长度,生成 GPG 密钥要花几分钟或更多时间。 + +![](https://c1.staticflickr.com/1/644/23328597612_6ac5a29944_c.jpg) + +### 第二步:加密 Mutt 敏感配置 ### + +下一步,在 ~/.mutt 目录创建一个新的文本文件,然后把一些你想隐藏的 Mutt 敏感配置放进去。这个例子里,我指定了 SMTP/IMAP 密码。 + + $ mkdir ~/.mutt + $ vi ~/.mutt/password + +---------- + + set smtp_pass="XXXXXXX" + set imap_pass="XXXXXXX" + +现在通过 GPG 使用你的公钥加密这个文件如下: + + $ gpg -r myemail@email.com -e ~/.mutt/password + +这将创建 ~/.mutt/password.gpg,这是一个原始文件的 GPG 加密版本。 + +然后删除 ~/.mutt/password,只保留 GPG 加密版本。 + +### 第三步:创建完整 Mutt 配置文件 ### + +现在你已经在一个单独的文件放置了加密的 Mutt 敏感配置,你可以在 ~/.muttrc 指定其余的 Mutt 配置。然后增加下面这行在 ~/.muttrc 末尾。 + + source "gpg -d ~/.mutt/password.gpg |" + +当你启动 Mutt 时,这行将解密 ~/.mutt/password.gpg ,然后将解密内容应用到你的 Mutt 配置中。 + +下面展示一个完整 Mutt 配置例子,这可以让你通过 Mutt 访问 Gmail,而没有暴露你的 SMTP/IMAP 密码。用你的 Gmail ID 替代下面的 `yourgmailaccount`,此外你也需要在[你的 Goolgle 账户设置][3]中启用“支持不太安全的应用访问”。 + + set from = "yourgmailaccount@gmail.com" + set realname = "Your Name" + set smtp_url = "smtp://yourgmailaccount@smtp.gmail.com:587/" + set imap_user = "yourgmailaccount@gmail.com" + set folder = "imaps://imap.gmail.com:993" + set spoolfile = "+INBOX" + set postponed = "+[Google Mail]/Drafts" + set trash = "+[Google Mail]/Trash" + set header_cache =~/.mutt/cache/headers + set message_cachedir =~/.mutt/cache/bodies + set certificate_file =~/.mutt/certificates + set move = no + set imap_keepalive = 900 + + # encrypted IMAP/SMTP passwords + source "gpg -d ~/.mutt/password.gpg |" + +### 第四步(可选):配置 GPG 代理 ### + +这时候,你将可以使用加密了IMAP/SMTP 密码的 Mutt。然而,每次你运行 Mutt,你都要先被提示输入一个 GPG 密码来使用你的私钥解密 IMAP/SMTP 密码。 + +![](https://c2.staticflickr.com/6/5667/23437064775_20c874940f_c.jpg) + +如果你想避免这样的 GPG 密码提示,你可以部署一个 gpg-agent。它以后台守护进程方式运行,gpg-agent 可以安全地缓存你的 GPG 密码,无需手工干预,gpg 可以自动从 gpg-agent 获得你的 GPG 密码。如果你正在使用 Linux 桌面,你可以配置使用一些等同于 gpg-agent 的特定的桌面软件,例如,GNOME 桌面的 gnome-keyring-daemon。 + +你可以在基于 Debian 系统安装 gpg-agent: + + $ sudo apt-get install gpg-agent + +gpg-agent 在基于 Red Hat 的系统上是预装好的。 + +现在增加下面这些到你的 .bashrc 文件中。 + + envfile="$HOME/.gnupg/gpg-agent.env" + if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then + eval "$(cat "$envfile")" + else + eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" + fi + export GPG_AGENT_INFO + +重载 .bashrc,或简单的登出然后重新登录。 + + $ source ~/.bashrc + +现在确认 GPG_AGENT_INFO 环境变量已经设置妥当。 + + $ echo $GPG_AGENT_INFO + + /tmp/gpg-0SKJw8/S.gpg-agent:942:1 + +并且,当你输入 gpg-agent 命令时,你应该看到下面的信息。 + + $ gpg-agent + + gpg-agent: gpg-agent running and available + +一旦 gpg-agent 启动运行,它将会在第一次提示你输入密码时缓存你的 GPG 密码。随后你多次运行 Mutt ,都不会被提示要 GPG 密码(gpg-agent 一直开着,缓存就不会过期)。 + +![](https://c1.staticflickr.com/1/664/22809928093_3be57698ce_c.jpg) + +### 结论 ### + +在这个指导里,我提供一个使用 GnuPG 加密如 SMTP/IMAP 密码这样的 Mutt 敏感配置的方法。注意,如果你想在 Mutt 上使用 GnuPG 来加密或签名你的邮件,你可以参考[官方指南][2]关于 GPG 与 Mutt 结合的部分。 + +如果你知道任何使用 Mutt 的安全技巧,欢迎分享它。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/mutt-email-client-encrypted-passwords.html + +作者:[Dan Nanni][a] +译者:[wyangsun](https://github.com/wyangsun) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/gmail-command-line-linux-alpine.html +[2]:http://dev.mutt.org/trac/wiki/MuttGuide/UseGPG +[3]:https://www.google.com/settings/u/1/security \ No newline at end of file diff --git a/translated/tech/20151201 How to use Mutt email client with encrypted passwords.md b/translated/tech/20151201 How to use Mutt email client with encrypted passwords.md deleted file mode 100644 index 1e8a032a04..0000000000 --- a/translated/tech/20151201 How to use Mutt email client with encrypted passwords.md +++ /dev/null @@ -1,138 +0,0 @@ -如何使用加密过密码的Mutt邮件客户端 -================================================================================ -Mutt是一个开源的Linux/UNIX终端环境下的邮件客户端。连同[Alpine][1],Mutt有充分的理由在Linux命令行热衷者中有最忠诚的追随者。想一下你对邮件客户端的期待的事情,Mutt拥有:多协议支持(e.g., POP3, IMAP and SMTP),S/MIME和PGP/GPG集成,线程会话,颜色编码,可定制宏/快捷键,等等。另外,基于命令行的Mutt相比笨重的web浏览器(如:Gmail,Ymail)或可视化邮件客户端(如:Thunderbird,MS Outlook)是一个轻量访问电子邮件的选择。 - -当你想使用Mutt通过公司的SMTP/IMAP服务器访问或发送邮件,或取代网页邮件服务,可能所关心的一个问题是如何保护您的邮件凭据(如:SMTP/IMAP密码)存储在一个纯文本Mutt配置文件(~/.muttrc)。 - -对于一些人安全的担忧,确实有一个容易的方法来**加密Mutt配置文件***,防止这种风险。在这个教程中,我描述了如何加密Mutt敏感配置,比如SMTP/IMAP密码使用GnuPG(GPG),一个开源的OpenPGP实现。 - -### 第一步 (可选):创建GPG密钥 ### - -因为我们将要使用GPG加密Mutt配置文件,如果你没有,第一步就是创建一个GPG密钥(公有/私有 密钥对)。如果有,忽略这步。 - -创建一个新GPG密钥,输入下面的。 - - $ gpg --gen-key - -选择密钥类型(RSA),密钥长度(2048 bits),和过期时间(0,不过期)。当出现用户ID提示时,输入你的名字(Dan Nanni) 和邮箱地址(myemail@email.com)关联到私有/公有密钥对。最后,输入一个密码来保护你的私钥。 - -![](https://c2.staticflickr.com/6/5726/22808727824_7735f11157_c.jpg) - -生成一个GPG密钥需要大量的随机字节熵,所以在生成密钥期间确保在你的系统上执行一些随机行为(如:打键盘,移动鼠标或者读写磁盘)。根据密钥长度决定生成GPG密钥要花几分钟或更多时间。 - -![](https://c1.staticflickr.com/1/644/23328597612_6ac5a29944_c.jpg) - -### 第二部:加密Mutt敏感配置 ### - -下一步,在~/.mutt目录创建一个新的文本文件,然后把一些你想隐藏的Mutt敏感配置放进去。这个例子里,我指定了SMTP/IMAP密码。 - - $ mkdir ~/.mutt - $ vi ~/.mutt/password - ----------- - - set smtp_pass="XXXXXXX" - set imap_pass="XXXXXXX" - -现在gpg用你的公钥加密这个文件如下。 - - $ gpg -r myemail@email.com -e ~/.mutt/password - -这将创建~/.mutt/password.gpg,这个是一个GPG加密原始版本文件。 - -继续删除~/.mutt/password,只保留GPG加密版本。 - -### 第三部:创建完整Mutt配置文件 ### - -由于你已经在一个单独的文件加密了Mutt敏感配置,你可以在~/.muttrc指定其余的Mutt配置。然后增加下面这行在~/.muttrc末尾。 - - source "gpg -d ~/.mutt/password.gpg |" - -当你使用Mutt,这行将解密~/.mutt/password.gpg,然后将解密内容应用到你的Mutt配置。 - -下面展示一个完整Mutt配置例子,这允许你用Mutt访问Gmail,没有暴露你的SMTP/IMAP密码。取代你用Gmail ID登陆你的账户。 - - set from = "yourgmailaccount@gmail.com" - set realname = "Your Name" - set smtp_url = "smtp://yourgmailaccount@smtp.gmail.com:587/" - set imap_user = "yourgmailaccount@gmail.com" - set folder = "imaps://imap.gmail.com:993" - set spoolfile = "+INBOX" - set postponed = "+[Google Mail]/Drafts" - set trash = "+[Google Mail]/Trash" - set header_cache =~/.mutt/cache/headers - set message_cachedir =~/.mutt/cache/bodies - set certificate_file =~/.mutt/certificates - set move = no - set imap_keepalive = 900 - - # encrypted IMAP/SMTP passwords - source "gpg -d ~/.mutt/password.gpg |" - -### 第四部(可选):配置GPG代理 ### - -这时候,你将可以使用加密了IMAP/SMTP密码的Mutt。无论如何,每次你运行Mutt,你都要先被提示输入一个GPG密码来使用你的私钥解密IMAP/SMTP密码。 - -![](https://c2.staticflickr.com/6/5667/23437064775_20c874940f_c.jpg) - -如果你想避免这样的GPG密码提示,你可以部署gpg代理。运行一个后台程序,gpg代理安全的缓存你的GPG密码,无需手工干预gpg自动从gpg代理获得你的GPG密码。如果你正在使用Linux桌面,你可以使用桌面特定方式来配置一些东西等价于gpg代理,例如,GNOME桌面的gnome-keyring-daemon。 - -你可以在基于Debian系统安装gpg代理: - -$ sudo apt-get install gpg-agent - -gpg代理是基于Red Hat系统预装的。 - -现在增加下面这些道你的.bashrc文件。 - - envfile="$HOME/.gnupg/gpg-agent.env" - if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then - eval "$(cat "$envfile")" - else - eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" - fi - export GPG_AGENT_INFO - -重载.bashrc,或单纯的登出然后登陆回来。 - - $ source ~/.bashrc - -现在确认GPG_AGENT_INFO环境变量已经设置妥当。 - - $ echo $GPG_AGENT_INFO - ----------- - - /tmp/gpg-0SKJw8/S.gpg-agent:942:1 - -并且,当你输入gpg-agent命令时,你应该看到下面的信息。 - - $ gpg-agent - ----------- - - gpg-agent: gpg-agent running and available - -一旦gpg-agent启动运行,它将会在第一次提示你输入密码时缓存你的GPG密码。随后你运行Mutt多次,你将不会被提示要GPG密码(gpg-agent一直开着,缓存就不会过期)。 - -![](https://c1.staticflickr.com/1/664/22809928093_3be57698ce_c.jpg) - -### 结论 ### - -在这个指导里,我提出一个方法加密Mutt敏感配置如SMTP/IMAP密码使用GnuPG。注意,如果你想在Mutt上使用GnuPG或者登陆你的邮件信息,你可以参考[官方指南][2]在使用GPG与Mutt结合。 - -如果你知道任何使用Mutt的安全技巧,随时分享他。 - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/mutt-email-client-encrypted-passwords.html - -作者:[Dan Nanni][a] -译者:[wyangsun](https://github.com/wyangsun) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/nanni -[1]:http://xmodulo.com/gmail-command-line-linux-alpine.html -[2]:http://dev.mutt.org/trac/wiki/MuttGuide/UseGPG From a67b583872904f9ee242bc363289f8a3ab5ddb83 Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 2 Feb 2016 20:12:15 +0800 Subject: [PATCH 3/4] PUB:20160126 How to change from default to alternative Python version on Debian Linux @mr-ping --- ...lternative Python version on Debian Linux.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) rename {translated/tech => published}/20160126 How to change from default to alternative Python version on Debian Linux.md (85%) diff --git a/translated/tech/20160126 How to change from default to alternative Python version on Debian Linux.md b/published/20160126 How to change from default to alternative Python version on Debian Linux.md similarity index 85% rename from translated/tech/20160126 How to change from default to alternative Python version on Debian Linux.md rename to published/20160126 How to change from default to alternative Python version on Debian Linux.md index 5ff89d7944..a33c0fcaaf 100644 --- a/translated/tech/20160126 How to change from default to alternative Python version on Debian Linux.md +++ b/published/20160126 How to change from default to alternative Python version on Debian Linux.md @@ -1,4 +1,4 @@ -如何将 Debian Linux 系统中默认的 Python 替代为其他版本 +如何将 Debian Linux 中的默认的 Python 版本切换为替代版本 ==================================================== 当你安装 Debian Linux 时,安装过程有可能同时为你提供多个可用的 Python 版本,因此系统中会存在多个 Python 的可执行二进制文件。你可以按照以下方法使用 `ls` 命令来查看你的系统中都有那些 Python 的二进制文件可供使用。 @@ -15,9 +15,9 @@ $ python --version Python 2.7.8 ``` -1、基于用户修改 Python 版本: +###1、基于用户修改 Python 版本: -想要为某个特定用户修改 Python 版本,只需要在其 home 目录下创建一个 `alias(别名)` 即可。打开 `~/.bashrc` 文件,添加新的别名信息来修改默认使用的 Python 版本。 +想要为某个特定用户修改 Python 版本,只需要在其 home 目录下创建一个 `alias`(别名) 即可。打开该用户的 `~/.bashrc` 文件,添加新的别名信息来修改默认使用的 Python 版本。 ``` alias python='/usr/bin/python3.4' @@ -36,7 +36,7 @@ $ python --version Python 3.4.2 ``` -2、 基于系统级别修改 Python 版本 +###2、 在系统级修改 Python 版本 我们可以使用 `update-alternatives` 来为整个系统更改 Python 版本。以 root 身份登录,首先罗列出所有可用的 python 替代版本信息: @@ -45,7 +45,7 @@ Python 3.4.2 update-alternatives: error: no alternatives for python ``` -如果出现以上所示的错误信息,则表示 Python 的替代版本尚未被 `update-alternatives` 命令识别。想解决这个问题,我们需要更新一下替代表,将 `python2.7` 和 `python3.4` 放入其中。 +如果出现以上所示的错误信息,则表示 Python 的替代版本尚未被 `update-alternatives` 命令识别。想解决这个问题,我们需要更新一下替代列表,将 `python2.7` 和 `python3.4` 放入其中。 ``` # update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 @@ -61,7 +61,7 @@ update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python Python 3.4.2 ``` -接下来,我们继续列出可用的 Python 替代版本。 +接下来,我们再次列出可用的 Python 替代版本。 ``` # update-alternatives --list python @@ -82,7 +82,7 @@ Python 3.4.2 Python 2.7.8 ``` -3、附录 +###3、移除替代版本 一旦我们的系统中不再存在某个 Python 的替代版本时,我们可以将其从 `update-alternatives` 列表中删除掉。例如,我们可以将列表中的 python2.7 版本移除掉。 @@ -96,9 +96,8 @@ update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python via: http://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux -作者:[作者][] 译者:[mr-ping](https://github.com/mr-ping) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 71059bb550dbaa260f6d979972fb64186ed4d119 Mon Sep 17 00:00:00 2001 From: DongShuaike Date: Thu, 4 Feb 2016 11:38:06 +0800 Subject: [PATCH 4/4] Create 20160129 Recognizing correct code.md --- .../news/20160129 Recognizing correct code.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sources/news/20160129 Recognizing correct code.md diff --git a/sources/news/20160129 Recognizing correct code.md b/sources/news/20160129 Recognizing correct code.md new file mode 100644 index 0000000000..ad5028d622 --- /dev/null +++ b/sources/news/20160129 Recognizing correct code.md @@ -0,0 +1,51 @@ +# Recognizing correct code + +Automatic bug-repair system fixes 10 times as many errors as its predecessors. +------ +MIT researchers have developed a machine-learning system that can comb through repairs to open-source computer programs and learn their general properties, in order to produce new repairs for a different set of programs. + +The researchers tested their system on a set of programming errors, culled from real open-source applications, that had been compiled to evaluate automatic bug-repair systems. Where those earlier systems were able to repair one or two of the bugs, the MIT system repaired between 15 and 18, depending on whether it settled on the first solution it found or was allowed to run longer. + +While an automatic bug-repair tool would be useful in its own right, professor of electrical engineering and computer science Martin Rinard, whose group developed the new system, believes that the work could have broader ramifications. + +“One of the most intriguing aspects of this research is that we’ve found that there are indeed universal properties of correct code that you can learn from one set of applications and apply to another set of applications,” Rinard says. “If you can recognize correct code, that has enormous implications across all software engineering. This is just the first application of what we hope will be a brand-new, fabulous technique.” + +Fan Long, a graduate student in electrical engineering and computer science at MIT, presented a paper describing the new system at the Symposium on Principles of Programming Languages last week. He and Rinard, his advisor, are co-authors. + +Users of open-source programs catalogue bugs they encounter on project websites, and contributors to the projects post code corrections, or “patches,” to the same sites. So Long was able to write a computer script that automatically extracted both the uncorrected code and patches for 777 errors in eight common open-source applications stored in the online repository GitHub. + +**Feature performance** + +As with [all][1] machine-learning systems, the crucial aspect of Long and Rinard’s design was the selection of a “[feature set][2]” that the system would analyze. The researchers concentrated on values stored in memory — either variables, which can be modified during a program’s execution, or constants, which can’t. They identified 30 prime characteristics of a given value: It might be involved in an operation, such as addition or multiplication, or a comparison, such as greater than or equal to; it might be local, meaning it occurs only within a single block of code, or global, meaning that it’s accessible to the program as a whole; it might be the variable that represents the final result of a calculation; and so on. + +Long and Rinard wrote a computer program that evaluated all the possible relationships between these characteristics in successive lines of code. More than 3,500 such relationships constitute their feature set. Their machine-learning algorithm then tried to determine what combination of features most consistently predicted the success of a patch. + +“All the features we’re trying to look at are relationships between the patch you insert and the code you are trying to patch,” Long says. “Typically, there will be good connections in the correct patches, corresponding to useful or productive program logic. And there will be bad patterns that mean disconnections in program logic or redundant program logic that are less likely to be successful.” + +**Ranking candidates** + +In earlier work, Long had developed an algorithm that attempts to repair program bugs by systematically modifying program code. The modified code is then subjected to a suite of tests designed to elicit the buggy behavior. This approach may find a modification that passes the tests, but it could take a prohibitively long time. Moreover, the modified code may still contain errors that the tests don’t trigger. + +Long and Rinard’s machine-learning system works in conjunction with this earlier algorithm, ranking proposed modifications according to the probability that they are correct before subjecting them to time-consuming tests. + +The researchers tested their system, which they call Prophet, on a set of 69 program errors that had cropped up in eight popular open-source programs. Of those, 19 are amenable to the type of modifications that Long’s algorithm uses; the other 50 have more complicated problems that involve logical inconsistencies across larger swaths of code. + +When Long and Rinard configured their system to settle for the first solution that passed the bug-eliciting tests, it was able to correctly repair 15 of the 19 errors; when they allowed it to run for 12 hours per problem, it repaired 18. + +Of course, that still leaves the other 50 errors in the test set untouched. In ongoing work, Long is working on a machine-learning system that will look at more coarse-grained manipulation of program values across larger stretches of code, in the hope of producing a bug-repair system that can handle more complex errors. + +“A revolutionary aspect of Prophet is how it leverages past successful patches to learn new ones,” says Eran Yahav, an associate professor of computer science at the Technion in Israel. “It relies on the insight that despite differences between software projects, fixes — patches — applied to projects often have commonalities that can be learned from. Using machine learning to learn from ‘big code’ holds the promise to revolutionize many programming tasks — code completion, reverse-engineering, et cetera.” + +-------------------------------------------------------------------------------- + +via: http://news.mit.edu/2016/faster-automatic-bug-repair-code-errors-0129 + +作者:Larry Hardesty +译者:[译者ID](https://github.com/翻译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:http://news.mit.edu/2013/teaching-computers-to-see-by-learning-to-see-like-computers-0919 +[2]:http://news.mit.edu/2015/automating-big-data-analysis-1016 +