Bug 1830

Summary: Patch to get py-bcrypt to build for Python 2.6 on Windows
Product: py-bcrypt Reporter: Rasjid <rasjidw>
Component: DefaultAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm, mutuka+mindrot, tweir
Priority: P2    
Version: -current   
Hardware: All   
OS: All   
Attachments: Patch for building on Win32
Build log (with errors) of current version (without patches).

Description Rasjid 2010-10-19 12:07:49 AEDT
Patch to get py-bcrypt module to build on Windows (using VS2008, Python 2.6).
Comment 1 Rasjid 2010-10-19 12:08:46 AEDT
Created attachment 1938 [details]
Patch for building on Win32
Comment 2 Damien Miller 2010-11-01 10:50:51 AEDT
What error does this fix? I'd prefer not to make extra copies of the password as each increases the chance that it will remain in memory.
Comment 3 Rasjid 2010-11-01 14:27:49 AEDT
(In reply to comment #2)
> What error does this fix? I'd prefer not to make extra copies of the
> password as each increases the chance that it will remain in memory.

See attached build log.  This was on Windows XP SP3, using MS Visual C++ 2008 Express Edition as the compiler.

There may well be a better way of fixing this.  Although I've been programming in Python for quite a while, I'm extremely new to C.
Comment 4 Rasjid 2010-11-01 14:29:34 AEDT
Created attachment 1941 [details]
Build log (with errors) of current version (without patches).
Comment 5 wahaa 2011-03-07 01:18:25 AEDT
(In reply to comment #2)
> What error does this fix? I'd prefer not to make extra copies of the
> password as each increases the chance that it will remain in memory.

The patch only moves the declarations of the variables to the beginning of the block, so no extra copies. 

With it applied, py-bcrypt builds (and tests) successfully with both Python 2.6.6 and Python 2.7.1 (using MSVC 2008).
Comment 6 tweir 2011-03-28 10:36:10 AEDT
It looks like the MSVC compiler is being extra strict. I.e. enforcing C the standard (declare all variables at top of function) as opposed to the less strict c++ style rule (declare anywhere, prior to first use).

I'd strongly recommend accepting this patch. The patch only moves the declaration of the variables, it does not affect the duplication operation in anyway.
Comment 7 Damien Miller 2011-03-28 12:04:33 AEDT
Patch has been committed: http://code.google.com/p/py-bcrypt/source/detail?r=1cbdb1427b
Comment 8 Damien Miller 2011-09-06 15:32:51 AEST
close resolved bugs now that openssh-5.9 has been released