Domanda

I use trac as my issue tracking system, together with svn. Lately I have discovered that commit messages may also modify tickets (add comments, close them) with the distributed CommitTicketUpdater (appears in tracopt), starting from trac 0.12 (the version I use).

This is installed on ubuntu 12.04. My post-commit code is as simple as that:

REV="$2"
/usr/bin/trac-admin /var/trac/proj changeset added robo $REV

where 'robo' is the name of my repository, as defined in trac. This actually works quite well; changesets appear in trac, together with the commit message as written during svn commit. The problem is not here.

The plugin (http://trac.edgewall.org/wiki/CommitTicketUpdater) should look for strings such as "see #22" or "fix #23" in the commit message, and update/close the relevant ticket. This is quite flexible in syntax. I've had the plugin enabled from the admin web tab (and applied changes), and even tried to upgrade (though, no upgrade was needed).

I have configured the plugin under [ticket] in my trac.ini file so:

commit_ticket_update_envelope =
commit_ticket_update_commands.close = close closed closes fix fixed fixes
commit_ticket_update_commands.refs = <ALL>
commit_ticket_update_check_perms = false
commit_ticket_update_notify = false

but I have tried many other variations, including commenting some of these lines. I have also tried to put [] in the envelope option, but that did not change.

Bottom line is that while changesets are added, nothing changes in the ticket.

I was thinking that this might be a permissions issue. Hence, I have added TRAC_ADMIN to anonymous, but that hasn't changed anything. I have realized that I am not sure how trac handles linux users; they do not authenticate to the web server in any way... But how else can that be done?

So I have committed with root, and it worked. So this is all about linux permissions. Though, my user belongs to 'svn' group, that has writing permission all over my project folder. This does not suffice, though, committing with root does work.

My next direction was to add myself (and any other committer) to sudoers, with no password for the operation of that hook.

This was done so: I have added 'hansz debi = NOPASSWD: /usr/bin/trac-admin' (where debi is the server name and hansz is my user name), and modified the post-commit line to:

sudo -u root /usr/bin/trac-admin /var/trac/proj changeset added robo $REV

That has not helped as well. Committing as root works, and as myself - not.

This is where I stop trying, and ask for your help.

È stato utile?

Soluzione

CommitTicketUpdater takes the author of the changeset for permission checks (and you disabled permission checks anyway). It doesn't use the UNIX user for anything.

Giving TRAC_ADMIN to anonymous also wouldn't do anything, because authenticated users inherit the permissions of authenticated, not anonymous.

The fact that updating tickets works when you run trac-admin $ENV changeset added as root indeed points at a (filesystem) permission issue. Why it doesn't work with sudo is slightly mysterious. Note that the user running trac-admin needs read and write permissions to all the Trac environment.

Are you using the repository type svn for your repository, or svn-direct? In the latter case, changesets would appear in Trac even if you didn't have permission to write to the environment.

I would suggest cranking up your logging level to DEBUG and see if the logs tell you anything. I would also suggest joining the trac-users mailing list and asking there. You'll reach more people who are familiar with Trac setups. Also, SO is a great platform for asking questions but it's not as ideal for debugging an installation.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top