Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

#12104 closed defect (fixed)

AttributeError: 'NoneType' object has no attribute 'get_youngest_rev'

Reported by: user Owned by: Jun Omae
Priority: normal Milestone: 1.0.7
Component: version control Version: 1.0.5
Severity: normal Keywords: webadmin
Cc: Branch:
Release Notes:

Fix raising AttributeError in repository admin with aliases to non-existent default repository.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

I am getting this error. I tried [13810]. But it still gives an error.

How to Reproduce

While doing a GET operation on /admin/versioncontrol/repository, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'cat_id': u'versioncontrol', 'panel_id': u'repository', 'path_info': None}

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36

System Information

Trac 1.0.5
Babel 0.9.6
Genshi 0.6 (without speedups)
GIT 1.9.5.msysgit.1
mod_wsgi 3.5 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
pysqlite 2.6.3
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
setuptools 7.0
SQLite 3.7.6.2
Subversion 1.8.4 (r1534716)
jQuery 1.7.2
jQuery UI 1.8.21
jQuery Timepicker 1.0.1

Enabled Plugins

tracaccountmanager 0.3.2

Python Traceback

Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\web\main.py", line 513, in _dispatch_request
    dispatcher.dispatch(req)
  File "build\bdist.win32\egg\trac\web\main.py", line 222, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win32\egg\trac\admin\web_ui.py", line 120, in process_request
    path_info)
  File "build\bdist.win32\egg\trac\versioncontrol\admin.py", line 334, in render_admin_panel
    for (reponame, info) in all_repos.iteritems())
  File "build\bdist.win32\egg\trac\versioncontrol\admin.py", line 334, in <genexpr>
    for (reponame, info) in all_repos.iteritems())
  File "build\bdist.win32\egg\trac\versioncontrol\admin.py", line 356, in _extend_info
    youngest_rev = repos.get_youngest_rev()
AttributeError: 'NoneType' object has no attribute 'get_youngest_rev'

Attachments (0)

Change History (11)

comment:1 by Jun Omae, 5 years ago

Component: generalversion control
Description: modified (diff)

comment:2 by Ryan J Ollos, 5 years ago

Please share your [repositories] section from trac.ini and the output of trac-admin $env repository list.

comment:3 by anonymous, 5 years ago

@rjollos.

Here is the screenshot for trac-admin $env repository list.

Name              Type  Alias      Directory
-----------------------------------------------------
(default)               (default)
project_lib       git              c:\project\lib
project_user_lib  git              c:\project\userlib

comment:4 by anonymous, 5 years ago

I removed the empty directory (using repository remove "" which was set to be the default and it fixed this issue.

Before

Name              Type  Alias      Directory
-----------------------------------------------------
(default)               (default)
project_lib       git              c:\project\lib
project_user_lib  git              c:\project\userlib

After applying the fix

trac-admin "C:\Users\test\Bitnami Trac Stack projects\project" repository remove ""

trac-admin "C:\Users\chrisa\Bitnami Trac Stack projects\project" repository list

Name              Type  Alias  Directory
----------------------------------------------------------------------------
(default)                      C:\Users\test\Bitnami Trac Stack repository
project_lib       git          c:\project\lib
project_user_lib  git          c:\project\userlib

Thank you for your help. Just wanted to report this. Please test if the user add an empty repository from Admin page by mistake.

comment:5 by Jun Omae, 5 years ago

Milestone: 1.0.7

Thanks for the feedback.

It is unable to add alias (default) to (default) repository via repository admin. However, the alias can be added via repository alias command.

Welcome to trac-admin 1.0.5
Interactive Trac administration console.
Copyright (C) 2003-2013 Edgewall Software

Type:  '?' or 'help' for help on commands.

Trac [/dev/shm/t12104]> repository list

Name  Type  Alias  Directory
----------------------------

Trac [/dev/shm/t12104]> repository alias '' ''
Trac [/dev/shm/t12104]> repository list

Name       Type  Alias      Directory
-------------------------------------
(default)        (default)

Trac [/dev/shm/t12104]>
$ sqlite3 /dev/shm/t12104/db/trac.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from repository;
1|name|
1|dir|
1|alias|

comment:6 by Jun Omae, 5 years ago

Owner: set to Jun Omae
Status: newassigned

Proposed changes in [4e0fd898c/jomae.git]. This issue occurs when an alias refer non-existent default repository.

comment:7 by Ryan J Ollos, 5 years ago

Keywords: webadmin added

The changes look good. Separate but related issue that we could address in another ticket:

Since the repository admin panel prevents adding an alias for a non-existent repository. We could also check that the repository name exists before allowing an alias to be added by the repository alias command.

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

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

The changes look good.

Thanks for the reviewing.

Separate but related issue that we could address in another ticket:

Since the repository admin panel prevents adding an alias for a non-existent repository. We could also check that the repository name exists before allowing an alias to be added by the repository alias command.

Added the check for existence of target repository in repository alias in [81d0c6ae6/jomae.git].

Related issue is that referenced repository from repository aliases can be removed via admin panel and repository remove command. We should prevent removing a repository referenced from repository aliases.

comment:9 by Jun Omae, 5 years ago

I noticed another related issue. The repository alias command allow to add an alias to an alias. The alias to an alias to a repository doesn't work. We should also prevent adding such an alias.

comment:10 by Jun Omae, 5 years ago

Additional changes in jomae.git@t12104:

comment:11 by Jun Omae, 5 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [14142:14143] and merged to trunk in [14144].

The issue for invalid repository aliases is filed in #12118 for next stable milestone. Fixes for the issue is needed to update message catalogs.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


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