Package: less
Version: 394-1
Severity: normal

Piping data to less makes the command pause, as shown with the
following test case.

---- lessbuffbug -------------------------------------------------
#!/bin/bash
[[ -c "$1" ]] || { echo "Usage: lessbuffbug <tty>" >&2; exit 1; }
for (( i=0; i<30000; i++ ))
do
  printf "Line.... %6d\n" $i
  ((i%10)) || echo "Line $i" > "$1"
done
------------------------------------------------------------------

To use it, open two terminals and type in the first one:

  ./lessbuffbug <tty> | less

where <tty> is the tty file of the second terminal (given by the
"tty" command), and wait a few seconds. The data displayed in the
second terminal stop at some line from "Line 4160" to "Line 4600",
showing the lessbuffbug command has paused. Typing spaces in less
leads to more data displyed in the other terminal.

According to the documentation, this behavior is incorrect:

    -B or --auto-buffers
        By default, when data is read  from  a  pipe,  buffers  are
        allocated  automatically  as  needed.  If a large amount of
        data is read from the pipe, this can cause a  large  amount
        of  memory  to  be  allocated.  The -B option disables this
        automatic allocation of buffers for pipes, so that only 64K
        (or the amount of space specified by the -b option) is used
        for the pipe.  Warning: use of -B can result  in  erroneous
        display,  since  only  the most recently viewed part of the
        file is kept in memory; any earlier data is lost.

I don't use the -B option, so I should be in the default case, where
"buffers are allocated automatically as needed".

This is particularly annoying with commands that need a lot of time
to complete.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (900, 'testing'), (900, 'stable'), (200, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-20050829
Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1)

Versions of packages less depends on:
ii  debianutils                   2.15.2     Miscellaneous utilities specific t
ii  libc6                         2.3.5-8    GNU C Library: Shared libraries an
ii  libncurses5                   5.5-1      Shared libraries for terminal hand

less recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to