[ python-Bugs-1576443 ] cStringIO misbehaving with unicode
Bugs item #1576443, was opened at 2006-10-13 01:40 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576443&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: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Yang Zhang (yangzhang) Assigned to: Nobody/Anonymous (nobody) Summary: cStringIO misbehaving with unicode Initial Comment: The bug is the following: StringIO.StringIO(u'abc').getvalue() != cStringIO.StringIO(u'abc').getvalue() It all started with the following code: # client.py import cPickle as cp import xmlrpclib as x p=x.ServerProxy('http://localhost:8082') msg=u'abc' print msg print len(msg) p.foo(x.Binary(msg)) # client output abc 3 # server.py from twisted.web import server, xmlrpc class WikiXmlRpc(xmlrpc.XMLRPC): def xmlrpc_foo(self, x): print x.data print len(x.data) return 0 if __name__ == "__main__": import sys from twisted.internet import reactor siteRoot = WikiXmlRpc() reactor.listenTCP(8082, server.Site(siteRoot)) reactor.run( ) # server output abc 12 I wanted both hosts to agree on the length, so I started digging to find out what was up. Some time later ze: you found a bug in xmlrpclib ze: it's using cStringIO in a place where it can't odd. cStringIO does not react to unicode in a sane way cStringIO.StringIO(u'abc').getvalue() #=> 'a\x00b\x00c\x00' ... ze: the heart of the matter is that StringIO.StringIO(u'abc').getvalue() != cStringIO.StringIO(u'abc').getvalue() -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576443&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1576598 ] ftplib doesn't follow standard
Bugs item #1576598, was opened at 2006-10-13 18:46 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576598&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: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Denis S. Otkidach (ods) Assigned to: Nobody/Anonymous (nobody) Summary: ftplib doesn't follow standard Initial Comment: According to RFC 959 communication for the exchange of commands and replies must follow telnet protocol, but ftplib doesn't. This causes "550 No such file or directory" replies when path contains '\xFF' character (which is quite widely used in some languages). The bug applies to all versions of Python. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576598&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1124861 ] GetStdHandle in interactive GUI
Bugs item #1124861, was opened at 2005-02-17 11:23 Message generated for change (Comment added) made by codecraig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1124861&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: Windows Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: davids (davidschein) Assigned to: Nobody/Anonymous (nobody) Summary: GetStdHandle in interactive GUI Initial Comment: Using the suprocess module from with IDLE or PyWindows, it appears that calls GetStdHandle (STD__HANDLE) returns None, which causes an error. (All appears fine on Linux, the standard Python command-line, and ipython.) For example: >>> import subprocess >>> p = subprocess.Popen("dir", stdout=subprocess.PIPE) Traceback (most recent call last): File "", line 1, in -toplevel- p = subprocess.Popen("dir", stdout=subprocess.PIPE) File "C:\Python24\lib\subprocess.py", line 545, in __init__ (p2cread, p2cwrite, File "C:\Python24\lib\subprocess.py", line 605, in _get_handles p2cread = self._make_inheritable(p2cread) File "C:\Python24\lib\subprocess.py", line 646, in _make_inheritable DUPLICATE_SAME_ACCESS) TypeError: an integer is required The error originates in the mswindows implementation of _get_handles. You need to set one of stdin, stdout, or strerr because the first line in the method is: if stdin == None and stdout == None and stderr == None: ...return (None, None, None, None, None, None) I added "if not handle: return GetCurrentProcess()" to _make_inheritable() as below and it worked. Of course, I really do not know what is going on, so I am letting go now... def _make_inheritable(self, handle): ..."""Return a duplicate of handle, which is inheritable""" ...if not handle: return GetCurrentProcess() ...return DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), 0, 1, DUPLICATE_SAME_ACCESS) -- Comment By: craig (codecraig) Date: 2006-10-13 11:54 Message: Logged In: YES user_id=1258995 On windows, this seems to work from subprocess import * p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) in some cases (depending on what command you are executing, a command prompt window may appear). Do not show a window use this... import win32con p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, creationflags=win32con.CREATE_NO_WINDOW) ...google for Microsoft Process Creation Flags for more info -- Comment By: Steven Bethard (bediviere) Date: 2005-09-26 10:53 Message: Logged In: YES user_id=945502 This issue was discussed on comp.lang.python[1] and Roger Upole suggested: """ Basically, gui apps like VS don't have a console, so GetStdHandle returns 0. _subprocess.GetStdHandle returns None if the handle is 0, which gives the original error. Pywin32 just returns the 0, so the process gets one step further but still hits the above error. Subprocess.py should probably check the result of GetStdHandle for None (or 0) and throw a readable error that says something like "No standard handle available, you must specify one" """ [1]http://mail.python.org/pipermail/python-list/2005-September/300744.html -- Comment By: Steven Bethard (bediviere) Date: 2005-08-13 16:37 Message: Logged In: YES user_id=945502 I ran into a similar problem in Ellogon (www.ellogon.org) which interfaces with Python through tclpython (http://jfontain.free.fr/tclpython.htm). My current workaround is to always set all of stdin, stdout, and stderr to subprocess.PIPE. I never use the stderr pipe, but at least this keeps the broken GetStdHandle calls from happening. Looking at the code, I kinda think the fix should be:: if handle is None: return handle return DuplicateHandle(GetCurrentProcess(), ... where if handle is None, it stays None. But I'm also probably in over my head here. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1124861&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1576657 ] dict keyerror formatting and tuples
Bugs item #1576657, was opened at 2006-10-13 18:00 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576657&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: Python Interpreter Core Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: M.-A. Lemburg (lemburg) Assigned to: Nobody/Anonymous (nobody) Summary: dict keyerror formatting and tuples Initial Comment: Probably just a minor glitch, but one which caused me half an hour to track down: >>> d = {1:'x'} >>> v = (1,) >>> d[v] Traceback (most recent call last): File "", line 1, in KeyError: 1 Note the formatting of the error message. It reads '1', not '(1,)' as you would expect. The example is constructed. In the code I was debugging, I didn't know that v was a tuple and thought it was the integer 1 - so the KeyError itself was somewhat puzzling. Only after printing the key I found that the lookup failed due to a type error. This happens in Python 2.4 and 2.5. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576657&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1576174 ] str(WindowsError) wrong
Bugs item #1576174, was opened at 2006-10-12 22:12 Message generated for change (Comment added) made by theller You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576174&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: None Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Thomas Heller (theller) Assigned to: Nobody/Anonymous (nobody) Summary: str(WindowsError) wrong Initial Comment: str(WindowsError(1001, 'a message') in Python 2.5 gives '[Error 22] a message'. The attached patch with test fixes this. -- >Comment By: Thomas Heller (theller) Date: 2006-10-13 20:17 Message: Logged In: YES user_id=11105 My bad. I didn't test on Linux. -- Comment By: �iga Seilnacht (zseil) Date: 2006-10-12 23:53 Message: Logged In: YES user_id=1326842 The part of the patch that changes EnvironmentError_str should be removed (EnvironmentError doesn't have a winerror member, the change causes compilation errors). Otherwise the patch looks fine. -- Comment By: Thomas Heller (theller) Date: 2006-10-12 22:13 Message: Logged In: YES user_id=11105 See also: http://mail.python.org/pipermail/python-dev/2006-September/068869.html -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576174&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1576174 ] str(WindowsError) wrong
Bugs item #1576174, was opened at 2006-10-12 22:12 Message generated for change (Comment added) made by theller You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576174&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: None Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Thomas Heller (theller) Assigned to: Nobody/Anonymous (nobody) Summary: str(WindowsError) wrong Initial Comment: str(WindowsError(1001, 'a message') in Python 2.5 gives '[Error 22] a message'. The attached patch with test fixes this. -- >Comment By: Thomas Heller (theller) Date: 2006-10-13 20:17 Message: Logged In: YES user_id=11105 Uploaded a new patch which I actually tested under Linux also. -- Comment By: Thomas Heller (theller) Date: 2006-10-13 20:17 Message: Logged In: YES user_id=11105 My bad. I didn't test on Linux. -- Comment By: �iga Seilnacht (zseil) Date: 2006-10-12 23:53 Message: Logged In: YES user_id=1326842 The part of the patch that changes EnvironmentError_str should be removed (EnvironmentError doesn't have a winerror member, the change causes compilation errors). Otherwise the patch looks fine. -- Comment By: Thomas Heller (theller) Date: 2006-10-12 22:13 Message: Logged In: YES user_id=11105 See also: http://mail.python.org/pipermail/python-dev/2006-September/068869.html -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576174&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1576443 ] cStringIO misbehaving with unicode
Bugs item #1576443, was opened at 2006-10-13 08:40 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576443&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: Python Library Group: Python 2.4 >Status: Closed >Resolution: Out of Date Priority: 5 Submitted By: Yang Zhang (yangzhang) Assigned to: Nobody/Anonymous (nobody) Summary: cStringIO misbehaving with unicode Initial Comment: The bug is the following: StringIO.StringIO(u'abc').getvalue() != cStringIO.StringIO(u'abc').getvalue() It all started with the following code: # client.py import cPickle as cp import xmlrpclib as x p=x.ServerProxy('http://localhost:8082') msg=u'abc' print msg print len(msg) p.foo(x.Binary(msg)) # client output abc 3 # server.py from twisted.web import server, xmlrpc class WikiXmlRpc(xmlrpc.XMLRPC): def xmlrpc_foo(self, x): print x.data print len(x.data) return 0 if __name__ == "__main__": import sys from twisted.internet import reactor siteRoot = WikiXmlRpc() reactor.listenTCP(8082, server.Site(siteRoot)) reactor.run( ) # server output abc 12 I wanted both hosts to agree on the length, so I started digging to find out what was up. Some time later ze: you found a bug in xmlrpclib ze: it's using cStringIO in a place where it can't odd. cStringIO does not react to unicode in a sane way cStringIO.StringIO(u'abc').getvalue() #=> 'a\x00b\x00c\x00' ... ze: the heart of the matter is that StringIO.StringIO(u'abc').getvalue() != cStringIO.StringIO(u'abc').getvalue() -- >Comment By: Georg Brandl (gbrandl) Date: 2006-10-13 19:24 Message: Logged In: YES user_id=849994 This was fixed with bug #1548891 a short while ago. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576443&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1576861 ] potential buffer overflow in complexobject.c
Bugs item #1576861, was opened at 2006-10-13 22:06 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576861&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: Python Interpreter Core Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Jochen Voss (jvoss2) Assigned to: Nobody/Anonymous (nobody) Summary: potential buffer overflow in complexobject.c Initial Comment: python version 2.4.3 Hello, recently I came across the following bit of code in the source file Objects/complexobject.c: static void complex_to_buf(char *buf, int bufsz, PyComplexObject *v, int precision) { char format[32]; if (v->cval.real == 0.) { PyOS_snprintf(format, 32, "%%.%ig", precision); PyOS_ascii_formatd(buf, bufsz, format, v->cval.imag); strncat(buf, "j", bufsz); The strncat statement in the last line is potentially unsafe: the size argument of strncat determines how many characters are to be added maxmimally and not how large the buffer is in total. Also there needs to be space for an additional '\0' byte. This seems currently not exploitable, because the function 'complex_to_buf' is always called with a large enough buffer, but it should be fixed any way (for example to make sure that nobody copies this code for use in another context). I hope this helps, Jochen -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1576861&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com