昨天,我设置了Apache服务于Mercurial存储库,并使一切正常运行。然后,我测试了将更改推回该存储库并出现一个错误,现在我尝试执行的每个操作都会弹出该错误-甚至只是对存储库的简单GET请求!这是错误:

mod_wsgi (pid=1771): Target WSGI script '/var/hg/hgweb.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=1771): Exception occurred processing WSGI script '/var/hg/hgweb.wsgi'.
Traceback (most recent call last):
  File "/var/hg/hgweb.wsgi", line 18, in ?
    application = hgwebdir(config)
  File "/usr/lib64/python2.4/site-packages/mercurial/hgweb/__init__.py", line 15, in hgwebdir
    return hgwebdir_mod.hgwebdir(*args, **kwargs)
  File "/usr/lib64/python2.4/site-packages/mercurial/hgweb/hgwebdir_mod.py", line 52, in __init__
    self.refresh()
  File "/usr/lib64/python2.4/site-packages/mercurial/hgweb/hgwebdir_mod.py", line 82, in refresh
    self.repos = findrepos(paths)
  File "/usr/lib64/python2.4/site-packages/mercurial/hgweb/hgwebdir_mod.py", line 36, in findrepos
    for path in util.walkrepos(roothead, followsym=True, recurse=recurse):
  File "/usr/lib64/python2.4/site-packages/mercurial/util.py", line 1164, in walkrepos
    for hgname in walkrepos(fname, True, seen_dirs):
  File "/usr/lib64/python2.4/site-packages/mercurial/util.py", line 1146, in walkrepos
    for root, dirs, files in os.walk(path, topdown=True, onerror=errhandler):
  File "/usr/lib64/python2.4/os.py", line 276, in walk
    onerror(err)
  File "/usr/lib64/python2.4/site-packages/mercurial/util.py", line 1127, in errhandler
    raise err
OSError: [Errno 13] Permission denied: './dev/fd'


我的存储库目录由运行Apache的用户apache拥有。我不知道为什么对其中任一操作“ ./dev/fd”。我已经多次重启服务器,重新创建了存储库目录,但是无论如何我仍然会收到此错误!我无权重启计算机,因此这不是一种选择。但是它似乎已经处于非常糟糕的持久状态,我不知道如何解决它。任何帮助表示赞赏!

最佳答案

事实证明这是我的配置错误,而不是删除问题,我会在此处发布解决方案,以防将来有人遇到此问题。

这是我正在使用的hgweb.config:

[paths]
/ = /var/hg/repos/*

#[web]
style = gitweb
allow_archive = bz2 gz zip
maxchanges = 200
allow_push = *
push_ssl = false


这里有两个问题,一个很明显。我已注释掉[web]标头,并且我认为许多选项对于[paths]部分无效。另外,再次重新阅读Hg文档之后,push_ssl指令不属于hgweb.config文件,而是属于每个存储库的.hg/hgrc(或运行apache的用户的~/.hgrc)。修复这些问题后,一切运行正常!

关于python - Mercurial:hgwebdir的权限被拒绝,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3383426/

10-14 17:53
查看更多