New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 799141 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 758466
Owner: ----
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

hterm: Copy pasting long lines adds a new line

Project Member Reported by mur...@google.com, Jan 4 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36

Steps to reproduce the problem:
1. Run some command which outputs a line longer than width of terminal (so one logical line spans multiple physical lines). Eg.

====
Some command with a lots[GOES TO NEXT LINE DUE TO TERM WIDTH]
and lots of flags
====

2. Use mouse to try to copy-paste the entire line including the newline at the end of the command (dont think newline at end of command matters)

What is the expected behavior?
I can execute the command as expected.

What went wrong?
A new line gets inserted when line length overflow term width. So instead what gets executed is

$ Some command with a lots
$ and lots of flags

which depending on the actual command and flags of course fails.

WebStore page: https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo

Did this work before? N/A 

Chrome version: 63.0.3239.108  Channel: n/a
OS Version: 
Flash Version: Shockwave Flash 28.0 r0

It is an annoyance and means for long command lines I need to copy-paste each section carefully to not pick up the newline.
 
Cc: sc00335...@techmahindra.com
Components: Blink>DataTransfer
Labels: Needs-Feedback Triaged-ET Needs-Triage-M63
Tested this issue on reported version 63.0.3239.108 using Ubuntu 14.04 with steps mentioned below.

1. Added secure shell app from https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo and launched it.
2. Inputed hostname and clicked on connect
3.Loading NaCl plug-in... done.
ssh: connect to host sc00335628-hp-compaq-pro-6300-sff port 22: Connection refused
NaCl plug-in exited with status code 255.
(R)econnect, (C)hoose another connection or E(x)it?
 failed! :( error is seen in shell.

@Reporter: Could you please guide us in using this app or provide us alternate app where you are seeing this issue. This would help in further triaging of the issue.

Thanks!

Issue 799141.ogv
2.7 MB View Download

Comment 2 by mur...@google.com, Jan 5 2018

Find some linux host you can successfully ssh to.

Test1
$ seq -w -s'-' 1 100 | cat -vet
001-002-003-004-005-006-007-008-009-010-011-012-013-014-015-016-017-018-019-020-021-022-023-024-025-026-027-028-029-030-031-032-033-034-035-036-037-038-039-040-041-042-043-044-045-046-047-048-049-050-051-052-053-054-055-056-057-058-059-060-061-062-063-064-065-066-067-068-069-070-071-072-073-074-075-076-077-078-079-080-081-082-083-084-085-086-087-088-089-090-091-092-093-094-095-096-097-098-099-100$

Note the lone '$' at the end.

Test2
$ echo '001-002-003-004-005-006-007-008-009-010-011-012-013-014-015-016-017-018-019-020-021-022-023-024-025-026-027-028-029-030-031-032-033-034-035-036-037-038-039-040-041-042-043-044-045-046-047-048-049-050-051-052-053-054-055-056-057-058-059-060-061-062-063-064-065-066-067-068-069-070-071-072-073-074-075-076-077-078-079-080-081-082-083-084-085-086-087-088-089-090-091-092-093-094-095-096-097-098-099-100' | cat -vet

has the exact same output.

Test3
Now 
* type in [echo ']
* use your mouse to copy-paste the complete output of the first or second command without including the trailing $
* type in [' | cat -vet] (to close the single quote) and hit enter

Expected output is the same as the first two. But observed output is

====
001-002-003-004-005-006-007-008-009-010-011-012-013-014-015-016-017-018-019-020-021-022-023-024-025-026-027-028-029-030-031-032-033-034-035-036$
-037-038-039-040-041-042-043-044-045-046-047-048-049-050-051-052-053-054-055-056-057-058-059-060-061-062-063-064-065-066-067-068-069-070-071-072-073-074-075-076-077-078-079-08
$
0-081-082-083-084-085-086-087-088-089-090-091-092-093-094-095-096-097-098-099-100$
====

NOTE the extra $ signs (which represent newline chars) after 36 and in the middle of 80. The actual location of extra $ and number of extra $ (depends on your terminal width) doesn't matter, the fact that we have extra $ signs is the issue.

Comment 3 by mur...@google.com, Jan 5 2018

Clarfication... When I said "Find some linux host you can successfully ssh to.", I meant ssh using the chrome extension.
Project Member

Comment 4 by sheriffbot@chromium.org, Jan 5 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "sc00335628@techmahindra.com" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: rginda@chromium.org bsittler@chromium.org
Components: Platform>Apps>Default>Hterm
I believe this is specific to "Secure Shell". Other terminals not using chromium-hterm do not seem to exhibit the same behavior.

rginda, do you agree? Or is this likely fixable on the data transfer side?
Status: Available (was: Unconfirmed)
Also I am able to confirm the misbehavior, unfortunately. It is present in both Secure Shell and Secure Shell (dev) versions.
Cc: pwnall@chromium.org
+pwnall who may have better ideas about how or where to fix this

I don't yet understand the chromium-hterm implementation well enough to know where the string used by drag-and-drop originates. It does not seem to be a simple innerText, as the DOM does not actually seem to have newlines or <br>s in it.

Shell (bash/sh/ksh) command I used during testing, since my terminal window size is likely not identical:

( echo -n :\ ;x=0;while test $x -lt $COLUMNS; do x=`expr $x + 1`;echo -n .;done; echo )

Labels: allpublic
Mergedinto: 758466
Status: Duplicate (was: Available)
Summary: hterm: Copy pasting long lines adds a new line (was: Copy pasting long lines adds a new line)
you can work around it by using ctrl+c instead
Based on the comment #8, this seems like a problem specific to hterm.

If it turns out there's something missing from DataTransfer that makes it difficult to get the right behavior into hterm, let's use this issue (or file a new issue) to track DataTransfer improvements.

Sign in to add a comment