Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#8725 closed defect (fixed)

Test env.get_known_users broken on Vista by r8635

Reported by: Christian Boos Owned by: Christian Boos
Priority: high Milestone: 0.11.6
Component: general Version: 0.11-stable
Severity: normal Keywords: rename
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Traceback (most recent call last):
  File "C:\Workspace\src\trac\repos\trunk\trac\tests\env.py", line 15, in setUp
    self.env = Environment(env_path, create=True)
  File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 206, in __init__
    self.create(options)
  File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 330, in create
    self.config.save()
  File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
    fileobj.close()
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
    rename(self._temp, self._path)
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 108, in rename
    raise ctypes.WinError()
WindowsError: [Error 6700] The transaction handle associated with this operation is not valid.

I didn't notice it at first because the Python version I preferably use for running the tests on 0.11-stable doesn't have ctypes…

Attachments (0)

Change History (9)

comment:1 by Remy Blank, 15 years ago

Mmh… Does that mean you were able to replace an open file with the default compatibility code?

comment:2 by Christian Boos, 15 years ago

All tests passed when I used Python 2.3.5 which doesn't have ctypes, but I don't think we have a test for exercising the rename to an opened file, do we?

in reply to:  2 ; comment:3 by Christian Boos, 15 years ago

Replying to cboos:

All tests passed when I used Python 2.3.5 which doesn't have ctypes, but I don't think we have a test for exercising the rename to an opened file, do we?

Scratch that, now it doesn't. I was probably only testing my stuff (r8644) and was not up to date…

So yes, without ctypes it also fails, but differently of course:

ERROR: test_set_and_save (trac.tests.config.ConfigurationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 173, in test_set_and_save
    config.save()
  File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
    fileobj.close()
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
    rename(self._temp, self._path)
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 123, in rename
    os.rename(src, dst)
OSError: [Errno 17] File exists

======================================================================
ERROR: test_set_and_save_inherit (trac.tests.config.ConfigurationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 221, in test_set_and_save_in
    self._test_with_inherit(testcb)
  File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 334, in _test_with_inherit
    testcb()
  File "C:\Workspace\src\trac\repos\trunk\trac\tests\config.py", line 203, in testcb
    config.save()
  File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
    fileobj.close()
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
    rename(self._temp, self._path)
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 123, in rename
    os.rename(src, dst)
OSError: [Errno 17] File exists

======================================================================
ERROR: Testing env.get_known_users
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Workspace\src\trac\repos\trunk\trac\tests\env.py", line 15, in setUp
    self.env = Environment(env_path, create=True)
  File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 206, in __init__
    self.create(options)
  File "C:\Workspace\src\trac\repos\trunk\trac\env.py", line 330, in create
    self.config.save()
  File "C:\Workspace\src\trac\repos\trunk\trac\config.py", line 226, in save
    fileobj.close()
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 174, in commit
    rename(self._temp, self._path)
  File "C:\Workspace\src\trac\repos\trunk\trac\util\__init__.py", line 123, in rename
    os.rename(src, dst)
OSError: [Errno 17] File exists

in reply to:  2 ; comment:4 by Remy Blank, 15 years ago

Replying to cboos:

I don't think we have a test for exercising the rename to an opened file, do we?

No, I was referring to comment:17:ticket:8623.

About the failures in comment:3, this is strange. I thought I had run the test suite on Windows with ctypes disabled, but I must have missed something… I'll check tonight.

in reply to:  4 comment:5 by Christian Boos, 15 years ago

Replying to rblank:

Replying to cboos:

I don't think we have a test for exercising the rename to an opened file, do we?

No, I was referring to comment:17:ticket:8623.

Well, there I only tested the rename() function alone, in a python shell.

in reply to:  3 comment:6 by Remy Blank, 15 years ago

Owner: set to Remy Blank

Replying to cboos:

Scratch that, now it doesn't. I was probably only testing my stuff (r8644) and was not up to date…

This should be fixed in [8648]. It seems that Python 2.3 raised an OSError instead of a WindowsError when the rename destination existed. I have also added some basic unit tests for AtomicFile.

I'm still trying to get access to a Vista box for the initial issue.

comment:7 by Christian Boos, 15 years ago

Got it ;-)

After creating the transaction, ta was -1, and raising a ctypes.WinError() right after that displayed: WindowsError: [Error 87] The parameter is incorrect.

The parameter in question was the last one, which was probably too long or contained illegal characters or whatnot. When using the same message but only the basename of the files, it worked.

comment:8 by Christian Boos, 15 years ago

Resolution: fixed
Status: newclosed

For the final change [8650], I used a fixed description 'Trac forced rename' - as that should be always fine.

in reply to:  7 comment:9 by Remy Blank, 15 years ago

Owner: changed from Remy Blank to Christian Boos

Replying to cboos:

Got it ;-)

Good, as I'm still halfway through a Vista install :-)

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.