pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: www/elinks does not work in raspberry pi Zero W



El 18/2/24 a las 23:27, Michael van Elst escribió:
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

ll interpret all 64 bits as the seconds value
    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.


Hello Michael,
Thanks so much for your great explanation that makes sense. I have to try in my 386 machine, it should also fail. I do not know what the solution will be in cases like this. Try to compile 0.17 version from github directly? try to tweak the pkgsrc elinks for 0.17? I am not in a hurry and can use links that works. just as an exercise to learn something.

Many thanks.
Ramiro




Home | Main Index | Thread Index | Old Index