From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041114 Firefox/1.0 Description of problem: I am viewing a binary file with less. It was created by 'dd if=/dev/null of=file bs=1k count=16k', thus it is 16MB in size. When trying to view this file with less, less warns that the file may be binary (obviously). When replying yes, less starts to use all available processor power, and stops reacting to all keypresses (including ctrl-c). strace reveals a lot of mmap going on: ...... read(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8192) = 8192 mmap2(NULL, 2625536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6825000 mmap2(NULL, 2625536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf65a4000 munmap(0xf6323000, 2625536) = 0 munmap(0xf6d25000, 2625536) = 0 mmap2(NULL, 2625536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6d25000 mmap2(NULL, 2625536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6323000 munmap(0xf65a4000, 2625536) = 0 munmap(0xf6825000, 2625536) = 0 mmap2(NULL, 2629632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6824000 mmap2(NULL, 2629632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf60a1000 munmap(0xf6323000, 2625536) = 0 munmap(0xf6d25000, 2625536) = 0 mmap2(NULL, 2629632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6d24000 mmap2(NULL, 2629632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf65a2000 munmap(0xf60a1000, 2629632) = 0 munmap(0xf6824000, 2629632) = 0 ...... I think it looks for linebreaks, so I expect it will stop once less reaches the end of the file. but given the speed this may take a minute or longer. Version-Release number of selected component (if applicable): less-382-5 How reproducible: Always Steps to Reproduce: 1. View large binary file with less 2. 3. Actual Results: less seems to hang, and uses lots of CPU Expected Results: less should at least react to ctrl-c, and display a warning that the operation may take longer. Additional info:
Seems to be fixed by the latest less-392. It uses the full CPU time, but just for a while even in the case of large binary files.