Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#3063 closed defect (fixed)

Invalid environment verifier code when wrong environment path is used

Reported by: Emmanuel Blot Owned by: Christian Boos
Priority: normal Milestone: 0.10
Component: general Version: devel
Severity: trivial Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The following piece of code env.py is in trouble

    def verify(self):
        try:
            fd = open(os.path.join(self.path, 'VERSION'), 'r')
            assert fd.read(26) == 'Trac Environment Version 1'
        finally:
            fd.close()

if the path (environment path set by the user) is incorrect, open method fail, fd never gets initialized, and fd.close() fails with the following exception:

Failed to open environment. local variable 'fd' referenced before assignment
Traceback (most recent call last):
  File "/Users/eblot/Sources/Svn/edgewall.com/trunk/trac/scripts/admin.py", line 132, in env_open
    self.__env = Environment(self.envname)
  File "/Users/eblot/Sources/Svn/edgewall.com/trunk/trac/env.py", line 121, in __init__
    self.verify()
  File "/Users/eblot/Sources/Svn/edgewall.com/trunk/trac/env.py", line 173, in verify
    fd.close()
UnboundLocalError: local variable 'fd' referenced before assignment

Attachments (0)

Change History (2)

comment:1 by Christian Boos, 19 years ago

Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos
Priority: lowestnormal
Status: newassigned

oops, yes.

comment:2 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r3224.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos 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.