Mercurial:hgwebdir 的权限被拒绝

发布于 2024-09-12 08:13:59 字数 1690 浏览 4 评论 0原文

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

Yesterday I setup Apache to serve my Mercurial repositories and got everything working properly. I then tested pushing changes back to this repository and was presented with an error, and now that error pops up for every single operation I attempt - even just a simple GET request of the repositories! Here is the error:

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'

My repository directory is owned by apache, the user running Apache. I dont know why './dev/fd' is being operated on either. I've restarted the server numerous times, recreated the repository directory, but I still get this error no matter what! I dont have access to restart the machine, so that is not an option. But it seems to have gotten in a very bad persistent state, and I dont know how to fix it. Any help is appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫负雪 2024-09-19 08:13:59

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

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

This turned out to be a configuration error on my part, and rather than delete the question I'll post the resolution here in case someone has this problem in the future.

Here was the hgweb.config I was using:

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

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

Two problems here, one is obvious. I had the [web] header commented out, and I assume that many of the options are not valid for the [paths] section. Also, after re-reading the Hg docs again, the push_ssl directive does not belong in the hgweb.config file, but rather in each repository's .hg/hgrc (or the ~/.hgrc of the user that runs apache). After fixing these, things are working perfectly!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文