Hi Felix, On 25.01.21 17:28, Felix Dietrich wrote:
Hello,I noticed that wget does interrupt its --wait between retrieval of multiple files when my terminal window gets resized. Reading through the sources it seems that the “xsleep” function (in utils.c) only supports the continuation of interrupted sleeps when the system provides a nanosleep function, which mine do, and the appropriate code is enabled when HAVE_NANOSLEEP is defined – but HAVE_NANOSLEEP does not appear to still get defined anywhere. Previously, it was AC_DEFINEd by a custom macro WGET_NANOSLEEP which was removed with [1] when instead Gnulib’s nanosleep module was added. The nanosleep module, though, only sets the shell variable HAVE_NANOSLEEP and AC_SUBST it (via time.h.m4): it does not define a macro for the C preprocessor. This means that nanosleep is not used anymore, anywhere, even on systems that would support it. From here I am uncertain how to continue: - Has the fallback code to “usleep” and select become obsolete and should simply be removed from “xselect” as Gnulib takes care of the compatibility? (In this case the members of “struct timespec remaining”, probably, need to be initialised to 0 and checked before restarting nanosleep: the Gnulib’s fallback implementation does not appear to use or set it when interrupted.) - Should HAVE_NANOSLEEP be AC_DEFINEd again? - Maybe something else? So far, hopefully, I have analysed the issue correctly.
Thanks for looking into it ! Option 1 (fallback code is obsolete) seems to be appropriate. Can you test that e.g. by adding #define HAVE_NANOSLEEP 1 to src/config.h and then rebuild with make clean && make ?The mentioned commit [1] should have removed the fallback code and the '#ifdef HAVE_NANOSLEEP'.
If you confirm the feature working again when built with the above instructions, I am going to fix the code appropriately.
Regards, Tim
[1] Commit: a384f5e2e9afd11e363d011b474c2e5da5573103
OpenPGP_signature
Description: OpenPGP digital signature
