socket-error-symbol for interrupted-error is always EINTR even if errno was originally EAGAIN

Bug #2060157 reported by Anton Kovalenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

DEFINE-SOCKET-CONDITION expansions in sockets.lisp add :initform to defined conditions, writing appropriate sockint:* errno symbol to the SYMBOL slot (with SOCKET-ERROR-SYMBOL as reader). This SOCKET-ERROR-SYMBOL is used in the :report clause of the socket-error condition, supposedly representing an original errno value.

It goes wrong when there is a single condition for multiple errnos, like interrupted-error for EINTR and EAGAIN. Interrupted-error gets redefined, and the last redefinition's initform wins, providing the same socket-error-symbol for all kinds of interrupted-error.

While debugging an usocket issue https://github.com/usocket/usocket/issues/106, I've got WSAEWOULDBLOCK from Winsock (on connect() with a non-blocking socket), that got translated to EAGAIN by constants-win32.lisp. The error message I got is this:

Socket error in "connect": EINTR (NIL)

Due to redefinition of interrupted-error condition, I had no chance to see the original EAGAIN.

I'd propose a change in (defun socket-error ...) that would provide a :symbol argument to the newly-created condition, looked up by errno-to-symbol mapping (a new *symbols-for-errno* alist should probably be added).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.