Bug 441691 - less: Copy&pasting of wrapped lines adds carriage returns.
less: Copy&pasting of wrapped lines adds carriage returns.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: less (Show other bugs)
5.1
All Linux
low Severity low
: rc
: ---
Assigned To: Zdenek Prikryl
:
Depends On:
Blocks: 5.4/TechnicalNotes
  Show dependency treegraph
 
Reported: 2008-04-09 10:48 EDT by Tobias Sandhaas
Modified: 2013-04-12 15:40 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
The "less" command has been updated. Refer to RHBA-2009:0413. less no longer adds the "carriage return" character when wrapping long lines. Consequently, lines longer than the terminal width will be displayed incorrectly when browsing the file line per line. The command line option "--old-bot" forces less to behave as it did previously, with long text lines displayed correctly.
Story Points: ---
Clone Of:
: 493968 (view as bug list)
Environment:
Last Closed: 2009-04-08 03:46:10 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)
A patch which adds --old-bot options (2.62 KB, text/x-patch)
2008-04-10 09:27 EDT, Zdenek Prikryl
no flags Details

  None (edit)
Description Tobias Sandhaas 2008-04-09 10:48:04 EDT
Description of problem:
"Less" changelog mentions following fix:
"Don't output extraneous newlines, so copy & pasting lines from the output works
better."
In fact it is not possible to copy&paste lines longer than terminal-width
without have ugly(wrong) carriage-returns in the buffer. It is quite a hassle to
copy&paste long lines in multiple steps!


Version-Release number of selected component (if applicable):
less-394-5.el5


How reproducible:


Steps to Reproduce:
1. Use X with attached mouse and open eg. xterm.
2. $ echo "a very long line *fill this text*" > /tmp/longline.txt
2. $ less /tmp/longline.txt 
3. You should see the long line wrapped in multiple lines. Mark these lines by
using the mouse and paste the text in some other xterm or application.
  
Actual results:
After pasting the text there are additional line breaks due to wrapping. These
should not be there.

Expected results:
There should be no additional line breaks.


Additional info:
- This issue is only valid for RHEL5. There is no issue with RHEL4.
- Workaround: call less with option "-r".
- Additionally i see similar issues when using vim with the option "set
ttyfast". So in fact i think the cause of the issue may be in other software
(termcap/terminfo?). Updating "less" to a newer version fixes this issue though.
Comment 1 Zdenek Prikryl 2008-04-10 09:26:23 EDT
Hello,
in less-406 a option --old-bot is added. With this options you can enable
appending '\n'. So, I created a patch which does same thing. It means that if
you run $ less --old-bot <file> then less will append '\n'. If you don't use
this option, then less will not append '\n'. This behavior is same like in less-406.

Zdenek
Comment 2 Zdenek Prikryl 2008-04-10 09:27:27 EDT
Created attachment 301976 [details]
A patch which adds --old-bot options
Comment 3 Tobias Sandhaas 2008-04-21 09:11:45 EDT
Thanks. This patch is solving the issue.

Will this patch incorperated into less.rpm releases for RHEL 3/4/5?
Comment 4 Zdenek Prikryl 2008-04-22 04:16:54 EDT
I don't know it now, it depends on the product management.
Comment 10 errata-xmlrpc 2009-04-08 03:46:10 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0413.html
Comment 13 Olivier Fourdan 2009-07-10 09:00:22 EDT
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
[Known issues]

* The "less" command was updated and does not add the "carriage return" character when wrapping long lines anymore. This causes lines longer than the terminal width to be displayed incorrectly when browsing the file line per line. Using the command line option "--old-bot" with "less" will revert to the previous behavior and the long  lines are displayed correctly.
Comment 16 Ryan Lerch 2009-08-18 22:40:40 EDT
Release note updated. If any revisions are required, please set the 
"requires_release_notes"  flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

Diffed Contents:
@@ -1,3 +1 @@
-[Known issues]
+The "less" command has been updated. Refer to RHBA-2009:0413. less no longer adds the "carriage return" character when wrapping long lines. Consequently, lines longer than the terminal width will be displayed incorrectly when browsing the file line per line. The command line option "--old-bot" forces less to behave as it did previously, with long text lines displayed correctly.-
-* The "less" command was updated and does not add the "carriage return" character when wrapping long lines anymore. This causes lines longer than the terminal width to be displayed incorrectly when browsing the file line per line. Using the command line option "--old-bot" with "less" will revert to the previous behavior and the long  lines are displayed correctly.
Comment 17 Benjamin Ash 2010-01-11 15:17:56 EST
This fix seems to cause truncated output from less when using the "Scroll forward" feature (F).  What we see is only last few characters of lines wider than the width of the terminal.

It looks to be a regression that breaks a critical for us.

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