[issue25778] winreg.EnumValue does not truncate strings correctly

2017-03-31 Thread Donald Stufft
Changes by Donald Stufft : -- pull_requests: +899 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-29 Thread Edward K. Ream
Edward K. Ream added the comment: Thank you, Steve, et. al. for resolving this issue. -- ___ Python tracker ___ ___ Python-bugs-list m

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-28 Thread Steve Dower
Changes by Steve Dower : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed versions: -Python 2.7, Python 3.5 ___ Python tracker ___ __

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-25 Thread Ezio Melotti
Changes by Ezio Melotti : Removed file: http://bugs.python.org/file46032/IMG-20161224-WA0004.jpg ___ Python tracker ___ ___ Python-bugs-list m

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-25 Thread Ezio Melotti
Changes by Ezio Melotti : Removed file: http://bugs.python.org/file46030/IMG-20161224-WA0004.jpg ___ Python tracker ___ ___ Python-bugs-list m

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-25 Thread Ezio Melotti
Changes by Ezio Melotti : Removed file: http://bugs.python.org/file46031/IMG-20161224-WA0004.jpg ___ Python tracker ___ ___ Python-bugs-list m

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-25 Thread Dany Jalil
Changes by Dany Jalil : Added file: http://bugs.python.org/file46032/IMG-20161224-WA0004.jpg ___ Python tracker ___ ___ Python-bugs-list maili

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-25 Thread Dany Jalil
Changes by Dany Jalil : Added file: http://bugs.python.org/file46031/IMG-20161224-WA0004.jpg ___ Python tracker ___ ___ Python-bugs-list maili

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-25 Thread Dany Jalil
Changes by Dany Jalil : Added file: http://bugs.python.org/file46030/IMG-20161224-WA0004.jpg ___ Python tracker ___ ___ Python-bugs-list maili

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-17 Thread Steve Dower
Steve Dower added the comment: I've committed to 3.6.1 and 3.7, but I'm not convinced that the problem is worth the risk of changing the behaviour in 2.7.14 and 3.5.3. Considering we kept forgetting to commit this for so long and largely got away with it, I assume there aren't hundreds of peop

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8cee4862fb34 by Steve Dower in branch '3.6': Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) https://hg.python.org/cpython/rev/8cee4862fb34 New changeset 3014854e68e4 by Steve Dower in branch 'default': Issue #25778: winr

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-03 Thread Edward K. Ream
Edward K. Ream added the comment: On Sat, Dec 3, 2016 at 1:37 PM, Steve Dower wrote: ​Thanks, Steve and David, for your replies. Getting this issue fixed eventually will do.​ Glad to hear it was a mistake, and not policy ;-) EKR -- ___ Python track

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-03 Thread Steve Dower
Steve Dower added the comment: This looks like it was my fault - I said I'd commit the patches and then never got back to it. I've assigned the issue to me so it doesn't fall off my radar again (though if someone else wants to do it first they're welcome to). But at this stage I suspect it's

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-03 Thread R. David Murray
R. David Murray added the comment: Looks like it fell off everyone's radar.It is now also too late in the 3.6 release cycle: it isn't "release critical" in the sense of being a breaking regression from 3.5, so it is not likely to get in. Keep in mind that this is a distributed, mostly volu

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-12-03 Thread Edward K. Ream
Edward K. Ream added the comment: The last message on this thread was in January, and this item is Open. According to Pep 478, 3.5.2 final was released Sunday, June 26, 2016. How is this issue not a release blocker? Why does there appear to be no urgency in fixing this bug? This bug bites for

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-16 Thread Zachary Ware
Zachary Ware added the comment: Go for it :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-16 Thread Steve Dower
Steve Dower added the comment: Zach - you still got this or do you want me to commit it? -- ___ Python tracker ___ ___ Python-bugs-lis

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Eryk Sun added the comment: I've added a patch for 2.7 that updates Py2Reg to use PyString_GET_SIZE instead of strlen and updates Reg2Py to use strnlen instead of returning strings with embedded NULs. -- ___ Python tracker

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Changes by Eryk Sun : Added file: http://bugs.python.org/file41470/issue25778_py36_2.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Changes by Eryk Sun : Added file: http://bugs.python.org/file41469/issue25778_py27_1.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Eryk Sun added the comment: The current test works for 3.x because we keep the full string length via PyUnicode_AsWideCharString(value, &len) when creating a REG_SZ value. OTOH, 2.x Py2Reg gets the length via strlen. I'd prefer to make this consistent with 3.x by using the full string length f

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Zachary Ware
Zachary Ware added the comment: Missed the boat on 3.4. I tried out the new test on 2.7, and it does not fail with no change to _winreg.c. Eryk, do you want to provide a patch for 2.7? I'm not interested enough to figure out what's going on there, but if you provide a patch I'll commit it.

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Zachary Ware
Zachary Ware added the comment: Ok, that example is an argument I'll accept. I'll give the patch another couple of days for others to review, and commit if nobody beats me to it. It's too late for 3.5.1, but it can probably make 3.4.4. -- stage: patch review -> commit review versions:

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Eryk Sun
Eryk Sun added the comment: > I don't like the idea of having a mismatch between what we set and > what we get, even if what we're setting technically shouldn't be > allowed. Currently if you set a string with null, you won't see it using either regedit.exe or reg.exe: >>> import os, winr

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread random832
random832 added the comment: Your "backward compatibility" argument makes me think of https://xkcd.com/1172/ 99% of programs written in C or other languages will cut the value off at the first null. One consequence of which is that no-one (except an unfortunate Python program) will _notice_ th

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Anshul Agrawal
Anshul Agrawal added the comment: Thanks David, and yes I had guessed as much. Will continue to monitor these emails for a while, in case action is needed from my side. >From an end user perspective, it was discouraging to encounter a bug like this >at such an early stage of using Python3 (an

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Zachary Ware
Zachary Ware added the comment: There's also backward compatibility to consider here; someone somewhere is depending on getting back \0 in his REG_SZes. If we were to make a change, it could only go in 3.6. With that restriction, I don't see a particularly nice way to get the same behavior f

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread R. David Murray
R. David Murray added the comment: Anshul: you don't need to worry about this technical discussion unless our windows experts decide this is in fact a bug in matplotlib and/or your machine's registry :) -- ___ Python tracker

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Eryk Sun
Eryk Sun added the comment: > add a QueryRawValue[Ex] function Or QueryValueEx and EnumValue could take a boolean argument named "raw" or "binary", which if True forces the data to be returned as REG_BINARY regardless of its assigned type. -- ___

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Eryk Sun
Eryk Sun added the comment: REG_SZ and REG_EXPAND_SZ are documented as null-terminated strings [1], which shouldn't have an embedded null character. As such, the default result in the high-level environment of Python shouldn't have embedded nulls. However, since the buffer is sized, I think se

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread random832
random832 added the comment: > The winreg module is a low-level interface High enough to return a string instead of bytes, an int for REG_DWORD, and to parse out REG_MULTI_SZ into a list. Maybe for if people really want the blob there should be an interface that always returns bytes and doesn'

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Zachary Ware
Zachary Ware added the comment: So then this is actually matplotlib's bug: Python is returning the blob as it should, but matplotlib is assuming too much about what it contains. However, I suspect that this particular issue isn't entirely matplotlib's fault; it looks to me like the entries nu

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread random832
random832 added the comment: > All registry values are blobs and it's up to the caller to decide how to read > it - the "types" are hints and are not binding. Just out of curiosity, what do we do if a REG_DWORD is more (or less?) than four bytes? Can that happen? -- _

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Steve Dower
Steve Dower added the comment: All registry values are blobs and it's up to the caller to decide how to read it - the "types" are hints and are not binding. I don't mind the default behavior being to trim at the first null, but it is a lossy operation on our side and so we really ought to prov

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Zachary Ware
Zachary Ware added the comment: > Is it possible that Python 2 is using a non-unicode Windows API to get the > values It does, but according to Anshul's nullcheck2.py output that doesn't matter. -- ___ Python tracker

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread random832
random832 added the comment: > I don't see why the original issue with matplotlib would only happen with > Python 3 and not Python 2, though. Is it possible that Python 2 is using a non-unicode Windows API to get the values, and the non-unicode API is converting the string (which is, of course

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Zachary Ware
Zachary Ware added the comment: Left one minor comment on Rietveld. However, I'm not yet convinced that this is a bug in Python. I can't find an authoritative source to say whether \0 is valid in a REG_SZ value, but the fact that you can set one and get it back makes me think it is (for certa

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Anshul Agrawal
Anshul Agrawal added the comment: Thanks Eryk, but I'm afraid I didn't follow most of what you said in your post. As an end-user, I just wanted to be able to install the packages, import them, and then use within Python. It is still not clear to me whether this is a problem with Python3, or

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
Eryk Sun added the comment: Here's a patch for Python 3 that modifies the Reg2Py function in PC/winreg.c for the case of REG_SZ/REG_EXPAND_SZ. The existing code took a conservative approach by only removing a null character at the end of a buffer. I modified it to use wcsnlen instead. I added

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Anshul Agrawal
Anshul Agrawal added the comment: Here it is: [python2.7] C:\Users\Anshul\Downloads\Python>python -V Python 2.7.10 :: Continuum Analytics, Inc. [python2.7] C:\Users\Anshul\Downloads\Python>python nullcheck2.py Checking: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts (u'tahoma.ttf\x000\

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
Eryk Sun added the comment: I only wrote it for Python 3, but it would be interesting to see what you get with Python 2. Please try nullcheck2.py. -- Added file: http://bugs.python.org/file41213/nullcheck2.py ___ Python tracker

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Anshul Agrawal
Anshul Agrawal added the comment: Ok thanks. Here's what I got: C:\Users\Anshul\Downloads\Python>conda info --envs # conda environments: # python2.7.10 C:\Anaconda3\envs\python2.7.10 root * C:\Anaconda3 C:\Users\Anshul\Downloads\Python>python -V Python 3.5.0 :: A

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
Eryk Sun added the comment: You should be able to run nullcheck.py in the command prompt by changing to the directory where it's saved and entering nullcheck.py. For example, if you saved it in your Downloads folder: >cd /d C:\Users\Anshul\Downloads >nullcheck.py If that fails because

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread SilentGhost
SilentGhost added the comment: Anshul, it's attached to this issue, before messages start under Files heading. Here is the direct link https://bugs.python.org/file41208/nullcheck.py -- nosy: +SilentGhost ___ Python tracker

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Anshul Agrawal
Anshul Agrawal added the comment: Please tell me where I can find nullcheck.py and how I should run it (I assume something like "python nullcheck.py" in the Windows Command Prompt?) I'm relatively new to Python, so explicit instructions would be appreciated. Thanks! --

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
Eryk Sun added the comment: Based on matplotlib's win32InstalledFonts function [1], I created a small test to check the data strings returned by winreg.EnumValue for the presence of null characters. I tested on Windows 7 and 10 but couldn't reproduce the problem. Please run nullcheck.py to che

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Anshul Agrawal
Anshul Agrawal added the comment: Before I got the "one line patch" on stackoverflow, I tried creating a new environment with Python 2.7.10 and did *not* get the error message I got with Python 3.5.0. Here's an outline of what I did: 1) Created a new environment to use Python 2.7.10: conda cr

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread R. David Murray
Changes by R. David Murray : -- title: Error on import matplotlib.pyplot and seaborn (Python3 - Windows 10 64-bit issue) -> winreg.EnumValue does not truncate strings correctly ___ Python tracker _