[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

svnperms.py: won't match something it should match!

From: Alexis Huxley <ahuxley_at_gmx.net>
Date: 2006-10-26 11:47:53 CEST

I've got a repository laid out like this:

        foo/trunk/foo.c
        foo/tags/release-1.0/foo.c
        foo/tags/release-1.1/foo.c
        foo/branches/bug-coredump/foo.c
        bar/trunk/bar.c
        bar/tags/release-0.1/bar.c
        bar/branches/bug-crash-on-zero-val/bar.c

etc. I'm using a one line pre-commit hook calling:

        svnperms.py -r "$1" -t "$2"

and using svnperms.py's conf file to enforce that
only 'admins' can create top-level directories
(alongside 'foo' and 'bar'). So I did:

        [myrepo groups]
        admins = alexis

        [myrepo]
        [^/]+/ = @admins(add,remove,update)

There are no other regexps specified. But this does
not allow 'alexis' to create the create directories:

        Adding new-module
        svn: Commit failed (details follow):
        svn: 'pre-commit' hook failed with error output:
        error: you don't have enough permissions for this transaction:
        you can't add new-module/

By changing the regexp to .* I have verified that
the hook is being called, calling svnperms.py, that
its conf file is being read, that the group is interpreted
correctly and that I am authenticated as a member of
the group, etc.

I cannot find any documentation for svnperms.py, but
have managed by experimentation and examining source
code to work out that:

        - directories automatically get /-suffixed before
          comparison with the regex

        - all regexps are automatically surrounded by ^ and $

The regex does match the path as verified with:

        perl -e '"new-module/" =~ m@^[^/]+/$@ && print "match\n";'

svnperms.py is the one available now at
http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/svnperms.py.

Any help/advice appreciated! Thanks!

Alexis

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Oct 26 11:49:32 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.