linux – SVN钩子pre-revprop-change不起作用

前端之家收集整理的这篇文章主要介绍了linux – SVN钩子pre-revprop-change不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道以前曾多次问过,但我相信我的情况是不同的.

我正在尝试在SVN信息库中添加一个pre-revprop-change钩子,以便对日志消息进行更改.

在我添加pre-revprop-change文件之前,我收到这个错误

  1. $svn propset -r 557 --revprop svn:log "New message!" https://myserver/repos/myrepo
  2. svn: DAV request Failed; it's possible that the repository's pre-revprop-change hook either Failed or is non-existent
  3. svn: At least one property change Failed; repository is unchanged
  4. svn: Error setting property 'log':
  5. Repository has not been enabled to accept revision propchanges;
  6. ask the administrator to create a pre-revprop-change hook

没问题,我想.我会补充一下:

  1. $cd /var/www/svn/myrepo/hooks
  2.  
  3. $# Create the simplest hook possible
  4. $echo '#!/bin/sh' > pre-revprop-change
  5. $echo 'exit 0' >> pre-revprop-change
  6.  
  7. $# Check that it looks correct
  8. $cat pre-revprop-change
  9. #!/bin/sh
  10. exit 0
  11.  
  12. $# Looks good,now make it executable
  13. $chmod a+x pre-revprop-change
  14.  
  15. $# Check the permissions
  16. $ls -al pre-revprop-change
  17. -rwxr-xr-x 1 apache apache 17 2012-05-24 12:05 pre-revprop-change
  18.  
  19. $# Run it,to make sure it runs,and check the error code
  20. $./pre-revprop-change
  21. $echo $?
  22. 0

所以,根据我读过的所有其他东西,这应该是我需要使它的工作.但是,当我再次尝试编辑日志消息时,我仍然收到错误(这次是不同的):

  1. $svn propset -r 557 --revprop svn:log "New message!" https://myserver/repos/myrepo
  2. svn: DAV request Failed; it's possible that the repository's pre-revprop-change hook either Failed or is non-existent
  3. svn: At least one property change Failed; repository is unchanged
  4. svn: Error setting property 'log':
  5. Revprop change blocked by pre-revprop-change hook (exit code 255) with no output.

有几点值得注意:

1)存储库托管在SELinux服务器(Fedora core 10)上.也许有些事情我需要关心这些权限?这是钩子的SE权限:

  1. $ls -alZ pre-revprop-change
  2. -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权限需要更改

  1. $chcon -t httpd_exec_t pre-revprop-change

(我第一次尝试将其更改为httpd_sys_script_exec_t,但是这不足以让脚本执行,但是使用httpd_exec_t类型它是有效的)

最后一个问题:这是一个安全的事吗?

猜你在找的Linux相关文章