Bug 1270248

Summary: backspace in interactive session does not delete multi-byte Unicode characters correctly
Product: [Fedora] Fedora Reporter: Petr Spacek <pspacek>
Component: opensshAssignee: Jakub Jelen <jjelen>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: jjelen, mattias.ellert, mbasti, mgrepl, plautrba, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openssh-7.1p1-6.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-22 22:00:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Spacek 2015-10-09 12:05:14 UTC
Description of problem:
Backspace in interactive session does not delete multi-byte Unicode characters completely. To delete a character complerely, user has to press backspace as many times as number of bytes used to represent the Unicode character. See the example below.

Version-Release number of selected component (if applicable):
openssh-7.1p1-3.fc23.x86_64
openssh-clients-7.1p1-3.fc23.x86_64
openssh-server-7.1p1-3.fc23.x86_64

How reproducible:
100 %

Steps to Reproduce:
1. SSH into a F23 machine.
2. $ cat > test
3. Use this as a input for cat command:
Á<press backspace once><press CTRL+D><press CTRL+D>
4. $ hexdump test

Actual results:
0000000 00c3                                   
0000001

Expected results:
The file "test" should be empty.

Additional info:
"Á" is represented by two bytes.

This does not happen when SSH is not in use. If you try the same sequence of keys locally the file will be actually empty. This is PITA when you work with Unicode texts over SSH, because you never know what was deleted and it can leave incomplete Unicode sequences in files you edit over SSH.

Comment 1 Jakub Jelen 2015-10-09 13:25:04 UTC
Hi Petr.
Thank you for a report.

It looks this behaviour is the same even with older openssh versions since they probably don't count with multibyte characters.

I was able to reproduce your test case. I will file upstream bug, because it can be confusing and it should be solved upstream.

Workaround for this case is to set remote tty to handle utf8 correctly (successfully tested)
$ stty iutf8

Solution is creation of remote tty's with these flags (IUTF8, which is unfortunately not POSIX so we will have to think about portability in upstream), according to article (last paragraph about tty) [1].

[1] https://www.cl.cam.ac.uk/~mgk25/unicode.html#mod

Comment 2 Fedora Update System 2015-12-18 14:41:51 UTC
openssh-7.1p1-6.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-8e6294b5c2

Comment 3 Fedora Update System 2015-12-19 20:00:37 UTC
openssh-7.1p1-6.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update openssh'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-8e6294b5c2

Comment 4 Fedora Update System 2015-12-22 22:00:02 UTC
openssh-7.1p1-6.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.