Mercurial:hgwebdir的权限被拒绝

时间:2010-08-01 19:30:10

标签: python apache mercurial

昨天我设置了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'正在进行操作。我已经多次重启服务器,重新创建了存储库目录,但无论如何我仍然会收到此错误!我没有权限重启机器,所以这不是一个选项。但它似乎已陷入非常糟糕的持久状态,我不知道如何解决它。任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:3)

这对我来说是一个配置错误,而不是删除我将在此处发布解决方案的问题,以防将来有人遇到此问题。

这是我正在使用的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 )。解决这些问题后,事情就完美了!