我知道以前曾多次问过,但我相信我的情况是不同的.
我正在尝试在SVN信息库中添加一个pre-revprop-change钩子,以便对日志消息进行更改.
在我添加pre-revprop-change文件之前,我收到这个错误:
$svn propset -r 557 --revprop svn:log "New message!" https://myserver/repos/myrepo svn: DAV request Failed; it's possible that the repository's pre-revprop-change hook either Failed or is non-existent svn: At least one property change Failed; repository is unchanged svn: Error setting property 'log': Repository has not been enabled to accept revision propchanges; ask the administrator to create a pre-revprop-change hook
没问题,我想.我会补充一下:
$cd /var/www/svn/myrepo/hooks $# Create the simplest hook possible $echo '#!/bin/sh' > pre-revprop-change $echo 'exit 0' >> pre-revprop-change $# Check that it looks correct $cat pre-revprop-change #!/bin/sh exit 0 $# Looks good,now make it executable $chmod a+x pre-revprop-change $# Check the permissions $ls -al pre-revprop-change -rwxr-xr-x 1 apache apache 17 2012-05-24 12:05 pre-revprop-change $# Run it,to make sure it runs,and check the error code $./pre-revprop-change $echo $? 0
所以,根据我读过的所有其他东西,这应该是我需要使它的工作.但是,当我再次尝试编辑日志消息时,我仍然收到错误(这次是不同的):
$svn propset -r 557 --revprop svn:log "New message!" https://myserver/repos/myrepo svn: DAV request Failed; it's possible that the repository's pre-revprop-change hook either Failed or is non-existent svn: At least one property change Failed; repository is unchanged svn: Error setting property 'log': Revprop change blocked by pre-revprop-change hook (exit code 255) with no output.
有几点值得注意:
1)存储库托管在SELinux服务器(Fedora core 10)上.也许有些事情我需要关心这些权限?这是钩子的SE权限:
$ls -alZ pre-revprop-change -rwxr-xr-x apache apache unconfined_u:object_r:httpd_sys_content_rw_t:s0 pre-revprop-change
2)通过WebDAV访问存储库(请注意存储库名称中的https://).有没有什么我需要在WebDAV方面设置,以允许pre-revprop-change更改?
解决方法
经过几个小时的尝试,我找到了答案.而且,由于互联网上其他任何地方似乎都不存在,我会在这里发布
这个问题是由SELinux造成的(没有什么大惊喜).似乎apache(/usr/sbin / httpd)没有必要的权限来运行具有上述SE权限的挂接脚本.要使其执行,SELinux权限需要更改
$chcon -t httpd_exec_t pre-revprop-change
(我第一次尝试将其更改为httpd_sys_script_exec_t,但是这不足以让脚本执行,但是使用httpd_exec_t类型它是有效的)
最后一个问题:这是一个安全的事吗?