#1531 closed defect (fixed)

use ctypes.get_last_error instead of GetLastError to access Windows error code

Reported by: davidsarah Owned by: daira
Priority: normal Milestone: 1.11.0
Component: code Version: 1.9.0a1
Keywords: windows error GetLastError magic-folder Cc:
Launchpad Bug:

Description (last modified by zooko)

We have some code in src/allmydata/windows/fixups.py and src/allmydata/util/fileutil.py that calls Windows API functions, and then calls GetLastError if the API function fails. In theory, the Python interpreter could run code in-between on the same thread that changes the error code. See http://bugs.python.org/issue1798.

(We don't have any code in Tahoe proper that calls C runtime library functions, so this issue only affects us for GetLastError, not errno. It is somewhat less likely to happen with GetLastError than with errno, at least in CPython, but still possible.)

Change History (9)

comment:1 Changed at 2011-09-07T23:21:29Z by davidsarah

  • Milestone changed from undecided to eventually
  • Owner changed from somebody to davidsarah
  • Status changed from new to assigned

comment:2 Changed at 2014-04-30T02:12:53Z by daira

  • Description modified (diff)

Actually fixups.py never calls GetLastError (although perhaps it should).

comment:3 Changed at 2014-04-30T14:53:47Z by zooko

  • Description modified (diff)

comment:4 Changed at 2015-05-17T23:00:32Z by daira

  • Keywords drop-upload added
  • Owner changed from davidsarah to daira
  • Status changed from assigned to new

This also affects the Windows inotify code.

comment:5 Changed at 2015-05-18T00:43:55Z by Daira Hopwood <daira@…>

In 143af6151800efd8ecb750e682aa42da254ce5a7/trunk:

fileutil.py: use ctypes.get_last_error() instead of GetLastError?(). refs #1531

Signed-off-by: Daira Hopwood <daira@…>

comment:6 Changed at 2015-06-01T16:11:09Z by daira

  • Keywords magic-folder added

Add magic-folder keyword to all drop-upload tickets.

comment:7 Changed at 2015-10-28T23:27:10Z by daira

  • Keywords drop-upload removed
  • Priority changed from major to normal
  • Resolution set to fixed
  • Status changed from new to closed

This is fixed on the 2438.magic-folder-stable.5 branch. (The remaining instances in fixups.py and fileutil.py not related to the Magic Folder code were fixed at the same time; I don't think it is necessary to merge these before merging Magic Folder.)

Last edited at 2015-10-28T23:29:01Z by daira (previous) (diff)

comment:8 Changed at 2016-01-15T19:33:39Z by daira

  • Milestone changed from eventually to 1.10.3

The remaining instances were fixed on master as part of #2669, specifically e88e07a2781506a5eb661008ed6f5afde5ff5d4d.

Last edited at 2016-01-15T19:33:57Z by daira (previous) (diff)

comment:9 Changed at 2016-03-22T05:03:36Z by warner

  • Milestone changed from 1.10.3 to 1.11.0

Milestone renamed

Note: See TracTickets for help on using tickets.