IDA in wine stopping because of IDAPython

Discussion in 'Technical Discussion' started by Andlabs, May 1, 2013.

  1. Andlabs

    Andlabs

    「いっきまーす」 Wiki Sysop
    2,175
    0
    0
    Writing my own MD/Genesis sound driver :D
    A while ago IDAPython started to fail to load because it couldn't perform an import site (done by Python initialization). I upgraded my IDAPython from the Python 2.6 version to the Python 2.7 version as Treeki suggested (it works for him/her) to see what was going on, and now it errors with

    Code (Text):
    1. Traceback (most recent call last):
    2.   File "C:\Python27\Lib\site.py", line 62, in <module>
    3.     import os
    4. RuntimeError: unable to get file status from 'C:\Python27\Lib\os.py'
    and closes IDA itself, making me unable to use it. The peculiar thing is that if I run the python command line executable from wine (either directly or thorugh wine cmd), everything just works (site imports fine and I can use python). I tried asking both #python and #winehq on Freenode multiple times but to no avail. I also tried looking into the site.py problem myself, noticing that it opens site.py fine and can run the import sys that comes immediately before the import os. Does anyone here know what is going on? Thanks.

    Linux Mint 13 64-bit; wine 1.5.29 from the official wine PPA; IDA Pro Advanced 6.1; IDAPython 1.5.2 for IDA 6.1 for Python 2.7; Python 2.7.4 32-bit
     
  2. Andlabs

    Andlabs

    「いっきまーす」 Wiki Sysop
    2,175
    0
    0
    Writing my own MD/Genesis sound driver :D
    Fixed it with the help of some wine developers: I had to go in winecfg and set a library override so that msvcr100 always used the builtin option. I also set up a fresh 32-bit prefix; not sure if this would have fixed my existing prefixes but oh well. Thanks anyway!

    Technical explanation from #winehq on freenode:
    Code (Text):
    1. [13:35] <focht> no bug :)
    2. [13:35] <focht> its expected behaviour
    3. ...
    4. [13:38] <focht> if wine drops "prefer native over builtin" for msvcr100 the setting will not be needed anymore but for now it's still needed until the API is considered 80%+ complete
    5. [13:39] <me> oh
    6. [13:39] <me> so it's falling back to native for some functions, including th eone tripping up the fstat()?
    7. [13:40] <focht> pietro10: well internal API implementation differences, mixing builtin msvcrt and native msvcrXX causes this kind of bugs
    and ColdPie on #tcrf on BadnikNET adds
    Code (Text):
    1. [13:41] <ColdPie> could be python includes msvc*
    2. ...
    3. [13:43] <ColdPie> andlabs: ah, that makes sense, I forgot we do that sometimes. python (or IDA) must include its own msvcrt DLLs, then?
    4. (I don't know the answer to this question...)
    (The error Python was giving me comes from here; look for the fsat() call in load_source_module.)