emacs-devel
[Top][All Lists]
Advanced

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

Re: wait_reading_process_ouput hangs in certain cases (w/ patches)


From: Paul Eggert
Subject: Re: wait_reading_process_ouput hangs in certain cases (w/ patches)
Date: Sun, 19 Nov 2017 09:06:07 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Eli Zaretskii wrote:
Cc: address@hidden
From: Paul Eggert <address@hidden>
Date: Sat, 18 Nov 2017 23:07:37 -0800

* Fix the bug with carryover that I mentioned in
<https://lists.gnu.org/r/emacs-devel/2017-11/msg00283.html>.

Not sure what bug is that, and how would you propose to fix it.

The bug is that with the patch as written, wait_reading_process_output might return a positive value even though it didn't read anything (nor did any timers or filters).

    got_some_output = min (INT_MAX, (wait_proc->infd_num_bytes_read
                                     - initial_wait_proc_num_bytes_read));
If we are using uintmax_t, why limit this by INT_MAX?

Because got_some_output is an int. And it's an int because the function's callers (either directly or indirectly) expect int. And the callers don't care what the value is, so long as it's positive (this is documented in the comments describing wait_reading_process_output etc.).

We could change got_some_output and all its users to employ the type intmax_t rather than int, but even then we'd need to limit it to INTMAX_MAX, so why bother? It wouldn't fix any bugs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]