Bug 2477 - backspace in interactive session does not delete multi-byte Unicode characters correctly
Summary: backspace in interactive session does not delete multi-byte Unicode character...
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 7.1p1
Hardware: Other Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_7_3
  Show dependency treegraph
 
Reported: 2015-10-10 01:00 AEDT by Jakub Jelen
Modified: 2016-08-02 10:42 AEST (History)
3 users (show)

See Also:


Attachments
patch adding IUTF8 flag, if available (341 bytes, patch)
2015-10-10 01:00 AEDT, Jakub Jelen
no flags Details | Diff
Add terminal mode, document in PROTOCOL (881 bytes, patch)
2015-10-23 13:48 AEDT, Damien Miller
dtucker: ok-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelen 2015-10-10 01:00:54 AEDT
Created attachment 2723 [details]
patch adding IUTF8 flag, if available

After report in our bugzilla [1] about utf8 support in remote terminals I dived a bit into this topic and found that openssh doesn't count with termios flag IUTF8 for handling utf8 characters interactively. This flag exists for some time and is available in Linux kernel since version 2.6. Really nice article [2] describes this issue (last paragraph).

Minimal test case is also described in original bugzilla, but I will copy it also here:

1. ssh to machine with openssh
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.

Solution is quite simple. Adding this this mode into ttymodes.h solves this issue. Problematic is that this changes things on both sides to apply.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1270248
[2] https://www.cl.cam.ac.uk/~mgk25/unicode.html#mod
Comment 1 Darren Tucker 2015-10-22 14:41:24 AEDT
Even more problematic is that the value you are using is not defined in RFC4254 section 8.
Comment 2 Jakub Jelen 2015-10-22 21:04:19 AEDT
Yeah, I see.

Now I found some discussion years ago on IETF and there are much more about this topic, But having a track about this also in this bugzilla will not hurt (I hope I didn't miss any dupplicate).
http://www.ietf.org/mail-archive/web/secsh/current/msg00658.html

Yes, this would require addition to protocol specification. Do you know if is some revision planned in close future? Or is there something I can help with?
Comment 3 Damien Miller 2015-10-23 13:48:28 AEDT
Created attachment 2736 [details]
Add terminal mode, document in PROTOCOL

If we do this (and I don't see why we shouldn't), we should mention the assignment in the PROTOCOL file.
Comment 4 Darren Tucker 2015-10-23 13:56:57 AEDT
Comment on attachment 2736 [details]
Add terminal mode, document in PROTOCOL

I think we should at least attempt to get this assigned via the proper process.
Comment 5 Darren Tucker 2016-05-03 22:43:19 AEST
Simon Tatham has submitted an internet-draft for this:
http://www.ietf.org/id/draft-sgtatham-secsh-iutf8-00.txt

and it's currently implemented in the development branches of OpenSSH and PuTTY.
Comment 6 Damien Miller 2016-08-02 10:42:52 AEST
Close all resolved bugs after 7.3p1 release