Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#8278 closed defect (fixed)

svn_fs.py unit-tests fail with Subversion 1.6.1 on Windows

Reported by: Christian Boos Owned by: Christian Boos
Priority: normal Milestone: 0.11.5
Component: version control Version: none
Severity: normal Keywords: svn16
Cc: james82@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

There's a new SQLite database in the repository (db/rep-cache.db) which is apparently still opened by the Subversion code at the time we try to rmtree the repository.

I haven't managed to force the removal. Maybe it's a SVN issue, maybe it's the way we use the API… let's see if the issue persists with 1.6.2.

The first time the tests are executed, we get this error:

WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos\\db\\rep-cache.db'

The second time, we get that other error:

svn.core.SubversionException: ("'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos' is a subdirectory of an existing repository rooted at 'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos'", 165002)

(which is somehow normal, as the trac-svnrepos from the previous run is still there)

Attachments (0)

Change History (7)

comment:1 by Christian Boos, 15 years ago

Cc: james82@… added

Added a redirection to this ticket from the code in r8192, in case someone else gets hit by this problem.

… and adding David to the loop in case he has some insight (hope you don't mind ;-) ).

comment:2 by Christian Boos, 15 years ago

Same issue with 1.6.2.

comment:3 by Christian Boos, 15 years ago

Related: http://svn.haxx.se/dev/archive-2009-05/0061.shtml

We however already cleared the self.repos in the tearDown methods, so it's still not obvious what to do.

comment:4 by Christian Boos, 15 years ago

Milestone: 0.11.60.11.5
Resolution: fixed
Status: newclosed

Hm, it was due to our own Pool stuff, fixed in r8209.

By the way, the Subversion python bindings do their own automatic pool management since 1.4.x (or even earlier?), so maybe it's time to simplify things in this area…

Two other things that seem also perfectible:

  • calling core.apr_terminate() in SubversionRepositoryTestSetup.setUp doesn't seem right (An APR program must call this function at termination once it has stopped using APR services. from apr_terminate API)
  • in SubversionRepositoryTestSetup.tearDown, repos.delete(REPOS_PATH) would be simpler (idea stolen from the tests for the Subversion SWIG python bindings…)

comment:5 by Christian Boos, 15 years ago

Owner: set to Christian Boos

comment:6 by Christian Boos, 15 years ago

(a follow-up was needed, see r8212 - thanks Remy for noticing the problem)

comment:7 by Christian Boos, 13 years ago

With a new install (Python 2.7.2, svn 1.6.15, Windows 7), I have again similar errors, like:

  File "c:\Trac\repos\trunk\trac\versioncontrol\tests\svn_fs.py", line 86, in tearDown
    shutil.rmtree(REPOS_PATH)
  File "C:\Dev\Python272\lib\shutil.py", line 244, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Dev\Python272\lib\shutil.py", line 244, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Dev\Python272\lib\shutil.py", line 244, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Dev\Python272\lib\shutil.py", line 249, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "C:\Dev\Python272\lib\shutil.py", line 247, in rmtree
    os.remove(fullname)
WindowsError: [Error 5] Access is denied: 'c:\\users\\cboos\\appdata\\local\\temp\\trac-svnrepos\\db\\revs\\0\\0'

The following "strengthening" of rmtree in tearDown() fixes it:

  • svn_fs.py

     
    7979        if os.name == 'nt':
    8080            # The Windows version of 'shutil.rmtree' doesn't override the
    8181            # permissions of read-only files, so we have to do it ourselves:
    82             format_file = os.path.join(REPOS_PATH, 'db', 'format')
    83             if os.path.isfile(format_file):
    84                 os.chmod(format_file, stat.S_IRWXU)
    85             os.chmod(os.path.join(REPOS_PATH, 'format'), stat.S_IRWXU)
    86         shutil.rmtree(REPOS_PATH)
     82            def retry_remove(fn, path, excinfo):
     83                if path.startswith(REPOS_PATH): # safety check
     84                    if os.path.isfile(path):
     85                        os.chmod(path, stat.S_IRWXU)
     86                    fn(path) # 2nd try
     87        shutil.rmtree(REPOS_PATH, onerror=retry_remove)
    8788
    8889
    8990# -- Re-usable test mixins

But it seems even better to use the svn API for this, hence the final fix in r10794.

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.