ea1abz%gmail.com@localhost (Ramiro Aceves) writes:
Elinks package does not work properly in my Raspberry Pi Zero W board.
ERROR at select.c:585: The call to select() failed: 22 (Invalid argument)
That's a bug in elinks. It uses an internal data structure defined as
typedef struct { long sec; long usec; } timeval_T;
and passes that to select() as a 'struct timeval'.
A 'struct timeval' is:
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
That's 64bit for seconds and 32bit for microseconds on amd64 and arm.
The internal timeval_T type however is:
64bit seconds, 64bit microseconds on amd64.
-> seconds im ok, microseconds also reads the same because amd64
uses little endian and the extra 32bit, which are zero for
legal microsecond values, get ignored.
but on arm that's 32bit seconds and 32bit microseconds.
-> the system wi
and read the following (undefined) 32 bits as microseconds.
Fortunately the undefined bits happen to look invalid (negative
or larger than 999999). Thus the "Invalid argument" error.
Otherwise the "following bits" would be modified, which may
lead to a crash or worse.
The github version of elinks (0.17, pkgsrc has 0.16) fixes that
particular problem.