Edgewall Software
Modify

Opened 8 years ago

Last modified 3 years ago

#10480 new defect

forward slash in repository name causes errors

Reported by: Andrew C Martin <andrew.c.martin@…> Owned by:
Priority: low Milestone: next-stable-1.2.x
Component: version control/browser Version: 0.12dev
Severity: minor Keywords: repository browser
Cc: Ryan J Ollos Branch:
Release Notes:
API Changes:

Description

When adding a repository to my new Trac 0.12 installation, I made the mistake of using the URL as the repository name. It turns out that Trac does not like forward slashes in the repository name.

Here's the command I used:

[root@svn-server:/var/lib/trac/projects/trac-env]# trac-admin $PWD repository add "svn://svn-server" /path/to/svn/repos/ svn

Here's the error that is displayed when I try to browse the source: screenshot of error

Here's the warning out of the log. Note that it only diplays one out of the two forward slashes.

2011-11-22 12:17:13,017 Trac[env] INFO: -------------------------------- environment startup [Trac 0.12.2] --------------------------------
2011-11-22 12:17:13,160 Trac[env] WARNING: base_url option not set in configuration, generated links may be incorrect
2011-11-22 12:17:13,188 Trac[api] INFO: Synchronized '' repository in 0.02 seconds
2011-11-22 12:17:13,191 Trac[main] WARNING: HTTPNotFound: 404 Trac Error (No node svn:/svn-server)

When I use the "(default)" name for the same repository instead of the name with forward slashes, everything works fine.

Attachments (1)

trac_browse_source_error.png (47.3 KB ) - added by Andrew C Martin <andrew.c.martin@…> 8 years ago.
screenshot of error

Download all attachments as: .zip

Change History (9)

by Andrew C Martin <andrew.c.martin@…>, 8 years ago

screenshot of error

comment:1 by Remy Blank, 8 years ago

Milestone: next-minor-0.12.x

At some point, we wanted to allow slashes in repository names to create some kind of virtual repository hierarchy, i.e. if you defined repositories named projects/proj1 and projects/proj2, you would see a virtual folder "projects", and you would find "proj1" and "proj2" in it.

Until this is implemented, I would suggest we simply disallow the use of forward slashes in repository names.

comment:2 by Ryan J Ollos, 6 years ago

Cc: Ryan J Ollos added

Another effect is that a repository name containing a forward slash, such as proj/one, can't be edited from the repository admin page. When clicking on the link to navigate to the detail page an error message is displayed: Repository 'proj/one' not found, and the href is /admin/versioncontrol/repository/proj/one.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:3 by Ryan J Ollos, 6 years ago

Milestone: next-minor-0.12.xnext-stable-1.0.x
Owner: set to Ryan J Ollos
Status: newassigned

in reply to:  2 ; comment:4 by Jun Omae, 6 years ago

Replying to rjollos:

Another effect is that a repository name containing a forward slash, such as proj/one, can't be edited from the repository admin page. When clicking on the link to navigate to the detail page an error message is displayed: Repository 'proj/one' not found, and the href is /admin/versioncontrol/repository/proj/one.

I cannot reproduce it. Works for me with tracd of 1.0-stable and 0.12-stable.

Also, the original issue maybe is caused by mod_wsgi that collapses double slashes, #10048.

Last edited 6 years ago by Jun Omae (previous) (diff)

in reply to:  4 ; comment:5 by Ryan J Ollos, 6 years ago

Replying to jomae:

I cannot reproduce it. Works for me with tracd of 1.0-stable and 0.12-stable.

Also, the original issue maybe is caused by mod_wsgi that collapses double slashes, #10048.

I may have provided the incorrect parameters to reproduce. I can reproduce with name /proj/one and path /var/​www/​svn/​proj/​one. I'm not sure the leading slash is needed to reproduce the error in every circumstance; I'm still working on narrowing in on the exact parameters needed to reproduce.

in reply to:  5 comment:6 by Jun Omae, 6 years ago

Replying to rjollos:

Replying to jomae:

I cannot reproduce it. Works for me with tracd of 1.0-stable and 0.12-stable.

I may have provided the incorrect parameters to reproduce. I can reproduce with name /proj/one and path /var/​www/​svn/​proj/​one. I'm not sure the leading slash is needed to reproduce the error in every circumstance; I'm still working on narrowing in on the exact parameters needed to reproduce.

Reproduced, thanks. The issue has been reported in #7617.

trac.web.href:Href class strips leading and trailing slash characters.

>>> from trac.web.href import Href
>>> href = Href('http://localhost')
>>> href()
'http://localhost'
>>> href.admin('versioncontrol', 'repository')
'http://localhost/admin/versioncontrol/repository'
>>> href.admin('versioncontrol', 'repository', 'proj/one')
'http://localhost/admin/versioncontrol/repository/proj/one'
>>> href.admin('versioncontrol', 'repository', '///proj/one')
'http://localhost/admin/versioncontrol/repository/proj/one'
>>> href.admin('versioncontrol', 'repository', 'proj/one///')
'http://localhost/admin/versioncontrol/repository/proj/one'

comment:7 by Ryan J Ollos, 4 years ago

Owner: Ryan J Ollos removed
Status: assignednew

comment:8 by Ryan J Ollos, 3 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned. Next status will be 'new'.
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.