以 root 用户身份运行 Mercurial 命令需要超过 20 秒

以 root 用户身份运行 Mercurial 命令需要超过 20 秒

当我以 root 用户身份调用任何 mercurial 命令(hg init、hg status、hg manifest、hg add 等)时,这些命令需要 20 多秒才能完成:

# time hg init

real    0m25.226s
user    0m0.156s
sys     0m0.044s

上述命令是在空目录中调用的。其他命令也需要略多于 25 秒的时间才能完成。感觉这些命令阻塞了 25 秒,然后在几分之一秒内完成了它们应该做的事情。以非 root 用户身份运行时,空目录中的 hg init 大约需要 0.2 秒。有人知道是什么原因导致了这种行为,或者如何缩小可能的原因范围吗?

我的操作系统是 Ubuntu 14。

答案1

虽然我仍然无法解释这种行为,但我发现它源于 $HOME 环境变量仍然指向我的用户的主目录。如果我

export HOME=/root

在执行 mercurial 命令之前,它们工作正常。指出这一点的消息是:

not trusting file /home/jan/.hg/hgrc from untrusted user jan, group jan

这是调用 hg init 后显示的。

相关内容