[Python-Dev] noreply@sourceforge.net: [Python-bugs-list] [Bug #111620] lots of use of send() without verifyi ng amount of data sent.

Guido van Rossum guido@beopen.com
Fri, 11 Aug 2000 07:55:29 -0500


I just noticed this.  Is this true?  Shouldn't we change send() to
raise an error instead of returning a small number?  (The number of
bytes written can be an attribute of the exception.)

Don't look at me for implementing this, sorry, no time...

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)

------- Forwarded Message

Date:    Thu, 10 Aug 2000 16:39:48 -0700
From:    noreply@sourceforge.net
To:      scott@chronis.pobox.com, 0@delerium.i.sourceforge.net,
	 python-bugs-list@python.org
Subject: [Python-bugs-list] [Bug #111620] lots of use of send() without verifyi
	  ng amount of data sent.

Bug #111620, was updated on 2000-Aug-10 16:39
Here is a current snapshot of the bug.

Project: Python
Category: Library
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: lots of use of send() without verifying amount of data sent.

Details: a quick grep of the standard python library (below) shows that there
is lots of unchecked use of the send() function.  Every unix system I've every 
used states that send() returns the number of bytes sent, which can be < length
(<string>).  Using socket.send(s) without verifying that the return value is eq
ual to the length of s is careless and can result in loss of data.

I just submitted a patch for smtplib's use of send(), have patched a piece of Z
ope the same way, and get the feeling that it's becoming standard to call send(
) without checking 
that the amount of data sent is the intended amount.  While this is OK for a qu
ick script, I don't feel it's OK for library code or anything that might be use
d in production.

scott

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=111620&group_id=5470

_______________________________________________
Python-bugs-list maillist  -  Python-bugs-list@python.org
http://www.python.org/mailman/listinfo/python-bugs-list

------- End of Forwarded Message