Bad handling of zero-length writes

Bug #550474 reported by Per Cederqvist on 2010-03-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone
expect (Ubuntu)

Bug Description

Binary package hint: expect

expect writes this in the debug log:

  write() failed to write anything - will sleep(1) and retry...

The cause is that ExpOutputProc() can be called with toWrite == 0. I will attach a patch that fixes the problem.

The problem isn't easy to reproduce. I have not been able to create a small test case. But if you attempt to run
the test suite of it will fail with strange locking
errors. The errors disappear if you fix this expect bug.

I have reported this to Don Libes but not gotten any response yet. This problem was apparently introduced when
expect started to use non-blocking I/O.

I'm using Ubuntu 9.10. This problem exists in all versions of expect 5.43.0: I'm using 5.43.0-17.

(One could possibly argue that it is a TCL bug that ExpOutputProc() is called with 0 as argument. I have not investigated if it would make more sense to fix the problem there. Given that ExpOutputProc() checks if toWrite is less than 0, I think it makes sense that it also handles the case when toWrite is 0 in a sane way.)

Per Cederqvist (ceder) wrote :
Per Cederqvist (ceder) wrote :

I see now that this was fixed upstream in september 2005:

The fix is included in the Debian package (and maybe earlier; I have not checked).

I'd like this fix to be backported to the supported versions of Ubuntu. I hope it will make it into the next version of Ubuntu.

David Futcher (bobbo) on 2010-06-09
tags: added: backports patch-accepted-debian
Matthias Klose (doko) on 2017-07-17
Changed in expect (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers