Bug 441691

Summary: less: Copy&pasting of wrapped lines adds carriage returns.
Product: Red Hat Enterprise Linux 5 Reporter: Tobias Sandhaas <tobias.sandhaas>
Component: lessAssignee: Zdenek Prikryl <zprikryl>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5.1CC: bash, ofourdan, rvokal, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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 07:46:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 513501    
Attachments:
Description Flags
A patch which adds --old-bot options none

Description Tobias Sandhaas 2008-04-09 14:48:04 UTC
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 13:26:23 UTC
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 13:27:27 UTC
Created attachment 301976 [details]
A patch which adds --old-bot options

Comment 3 Tobias Sandhaas 2008-04-21 13:11:45 UTC
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 08:16:54 UTC
I don't know it now, it depends on the product management.

Comment 10 errata-xmlrpc 2009-04-08 07:46:10 UTC
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 13:00:22 UTC
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-19 02:40:40 UTC
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 20:17:56 UTC
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.