--- Begin Message ---
Subject: |
tail command does not hang on /dev/random |
Date: |
Fri, 19 Apr 2024 21:40:35 +0300 |
The following command hangs indefinitely, as expected:
tail -c 4096 /dev/random
The following command immediately returns 4097 bytes, unexpectedly:
tail -c 4097 /dev/random
Details:
- Source code obtained from: git://git.sv.gnu.org/coreutils
- Commit id: 9ab1f9db94479eca4dd2c29b4e21550ff2bcd5bb
- System:
$ uname -a
Linux zinc 6.1.0-20-amd64 #1 SMP PREEMPT_DYNAMIC Debian
6.1.85-1 (2024-04-11) x86_64 GNU/Linux
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#70477: tail command does not hang on /dev/random |
Date: |
Fri, 19 Apr 2024 21:52:20 -0700 |
User-agent: |
Mozilla Thunderbird |
On 2024-04-19 11:40, Ionut Nicula wrote:
The following command hangs indefinitely, as expected:
tail -c 4096 /dev/random
The following command immediately returns 4097 bytes, unexpectedly:
tail -c 4097 /dev/random
Thanks for the bug report. Although the two commands should behave
similarly, neither should loop: they should both output the requested
number of random bytes. Similarly for /dev/zero. I installed the
attached patch to do that.
0001-tail-avoid-infloop-with-c-on-dev-zero.patch
Description: Text Data
--- End Message ---