Edgewall Software

Opened 12 years ago

Last modified 3 months ago

#9208 new defect

Support for SVN repository on a UNC path on Windows

Reported by: morphiend@… Owned by:
Priority: normal Milestone: unscheduled
Component: version control Version: 0.11
Severity: normal Keywords: svn patch needfixup
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

While setting up a Trac installation a year ago, I ran into a problem where my SVN repository was stored on a UNC accessible path on a Windows-based Apache system. In other words, I was running Trac on Apache for Windows, with the python module for Apache. Our SVN repository was stored on a separate network drive and only accessible via a UNC path.

At the time I was using Trac 0.11.x (not sure of the revision, and I no longer operate that system).

The problem is due to SubversionRepository __init__ not handling the UNC slashes properly. When the path is fixed by converting the '\'\' to '\' the UNC slashes were being transformed to just '\' instead of staying '\'\'. I corrected this by adding splitunc() call before the replace and only performing the replace on the non-UNC portion of the path.

I've attached a diff patch making the similar change to the latest version from the 0.12 trunk, as well as the original modified version from my 0.11 installation.

Attachments (3)

svn_fs.py.011 (39.4 KB ) - added by morphiend@… 12 years ago.
Patched version from 0.11 source
svn_fs.py.012.rev9444 (37.9 KB ) - added by morphiend@… 12 years ago.
Patched version from 0.12 source, rev 9444
t9208.diff (1.9 KB ) - added by Jun Omae 6 years ago.

Download all attachments as: .zip

Change History (9)

by morphiend@…, 12 years ago

Attachment: svn_fs.py.011 added

Patched version from 0.11 source

by morphiend@…, 12 years ago

Attachment: svn_fs.py.012.rev9444 added

Patched version from 0.12 source, rev 9444

comment:1 by Christian Boos, 12 years ago

Milestone: next-minor-0.12.x


But please have a look at TracDev/SubmittingPatches, we prefer to get submissions as patches instead of whole files, as this makes it much easier to see the changes from the ticket and comment on it.

One thing I can already comment on: splitunc is not available on Unix, so you should either make the code platform dependent (if os.name == 'nt':) or add a trac.util.compat.splitunc utility function that encapsulate this.

comment:2 by Christian Boos, 11 years ago

Keywords: needfixup added

comment:3 by Christian Boos, 11 years ago

Milestone: next-minor-0.12.xunscheduled

No fixup in one year, unscheduling.

If someone is interested by the feature, please provide a patch as suggested above.

by Jun Omae, 6 years ago

Attachment: t9208.diff added

comment:4 by Jun Omae, 6 years ago

Revised patch: t9208.diff for 1.0-stable.

I get weird behavior of trac-admin. The 2 backslash character in UNC path is converted to 3 backslash characters. Even though the behavior, the patch works well for UNC path in repository browser, file view and blame view.

Trac [C:\usr\var\trac\1.0]> repository add unc \\machine\share\path\to\repos svn
Trac [C:\usr\var\trac\1.0]> repository list

Name          Type  Alias  Directory
unc           svn          \\\machine\share\path\to\repos
C:> sqlite3 C:\usr\var\trac\1.0\db\trac.db
SQLite version 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from repository where name='dir' and value like '%machine%';

comment:5 by Ryan J Ollos, 6 years ago

Description: modified (diff)

comment:6 by anonymous, 3 months ago

Just stubled on this error with trac 1.4.2, I need to change a repository path due to server migration.

No Idea how i got it correctly as \\server\dir the last time, now if I run
repository set myrepo \\server2\dirto switch it to \\server2\dir I get \\\server2\dir

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.