Patches item #1709112, was opened at 2007-04-28 06:35 Message generated for change (Comment added) made by abkhd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1709112&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Tests Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: A.B., Khalid (abkhd) Assigned to: Nobody/Anonymous (nobody) Summary: test_1686475 of test_os & pagefile.sys Initial Comment: test_1686475 of test_os appears to rely on the existence of "pagefile.sys" on the C drive like so: def test_1686475(self): # Verify that an open file can be stat'ed try: os.stat(r"c:\pagefile.sys") except WindowsError, e: if e == 2: # file does not exist; cannot run test return self.fail("Could not stat pagefile.sys") But since pagefile.sys may not be on every C drive and since the exception object e is not a numeric then that test is probably going to fail if the pagefile.sys does not exist where it is expected. In such a case Windows returns "[Error 5] Access is denied: 'c:\\pagefile.sys'". So we need to test if e.winerror == 5 to skip this and return without failing. Patch "test_os.patch" is attached. By the way, I see the same problem in the trunk, so maybe this need to be applied there as well. ---------------------------------------------------------------------- >Comment By: A.B., Khalid (abkhd) Date: 2007-04-30 09:07 Message: Logged In: YES user_id=1079026 Originator: YES I had thought that the file was opened exclusively by Windows and so the latter denied access to it (including sharing). However, it might be worth a while to note how others handle this problem. Please see ntfs.c of MIT/GNU Scheme: http://www.koders.com/c/fid3A61BD3B46FA62F5E9F99E5860DCAE5BC2B7FA2C.aspx and ntfs.h of the same project: http://www.koders.com/c/fid5FA9A6766ABABAAB4DC09266CA61866F8270A139.aspx They actually test for both errors in addtion to ERROR_DRIVE_LOCKED to determine if stat has worked or not. Regards, Khalid More references: http://www.supportnet.de/stat/2002/7/id98848.asp http://www.cygwin.com/ml/cygwin/2000-01/msg00274.html http://ftp.gnu.org/gnu/mit-scheme/stable.pkg/7.7.1/changelog.txt ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2007-04-30 05:16 Message: Logged In: YES user_id=21627 Originator: NO Why should I not check for ERROR_SHARING_VIOLATION? The OP complains that he sees an error "The process cannot access the file because it is being used by another process" in 2.5.0, and can stat the file in 2.4. So it is clearly ERROR_SHARING_VIOLATION that is being returned (also on the system on which I developed the patch). ---------------------------------------------------------------------- Comment By: A.B., Khalid (abkhd) Date: 2007-04-30 01:52 Message: Logged In: YES user_id=1079026 Originator: YES Please see http://www.python.org/sf/1686475 for reference. Martin, I think you should be checking for ERROR_ACCESS_DENIED not ERROR_SHARING_VIOLATION as you do in your patch to r54685 and r54686. The attached posixmodule patch fixes this issue for me on MinGW. Can you try it out? File Added: test_1686475.patch ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1709112&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches