Bug 141654 - less 'hangs' when viewing binary file
less 'hangs' when viewing binary file
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: less (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jindrich Novy
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-02 13:19 EST by Ralf Ertzinger
Modified: 2013-07-02 19:03 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-19 07:40:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ralf Ertzinger 2004-12-02 13:19:25 EST
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:
Comment 1 Jindrich Novy 2005-10-19 07:40:22 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.