Bug 841771

Summary: sftp completion hook breaks on file name with multi-byte
Product: [Fedora] Fedora Reporter: Kamil Dudka <kdudka>
Component: opensshAssignee: Petr Lautrbach <plautrba>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 19CC: czochanski, dtucker, hego.one, jeff, kdudka, loganjerry, mattias.ellert, mgrepl, plautrba, rustyBSD, scorpy_sk, tmraz
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openssh-6.2p2-4.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 840598 Environment:
Last Closed: 2013-07-28 01:08:49 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:
Attachments:
Description Flags
File: backtrace none

Description Kamil Dudka 2012-07-20 08:43:00 UTC
+++ This bug was initially created as a clone of Bug #840598 +++

Hi,
I was in my banana tree when I noticed a segfault with sftp on Fedora 17.
It segfaults with autocompletion of a local accentued folder/(file?).

Steps to Reproduce:
$ mkdir Modèles
$ sftp root@localhost
sftp> put Mo [press TAB]
And it segfaults.
  
Actual results:
SEGFAULT

Expected results:
'put Modèles'

Max

--- Additional comment from kdudka on 2012-07-18 13:29:11 CEST ---

This fixes the SIGSEGV in libedit:

diff --git a/src/chared.c b/src/chared.c
index 0a95913..1b6fa68 100644
--- a/src/chared.c
+++ b/src/chared.c
@@ -612,7 +612,7 @@ FUN(el,insertstr)(EditLine *el, const Char *s)
 {
    size_t len;

-   if ((len = Strlen(s)) == 0)
+   if (s == NULL || (len = Strlen(s)) == 0)
        return -1;
    if (el->el_line.lastchar + len >= el->el_line.limit) {
        if (!ch_enlargebufs(el, len))

However, if you want sftp to actually support UTF-8, you need to fix sftp so that complete_match() does not call el_insertstr() with incomplete multibyte sequences.

Comment 1 Petr Lautrbach 2012-11-26 15:04:48 UTC
*** Bug 862282 has been marked as a duplicate of this bug. ***

Comment 2 czochanski 2012-11-28 20:46:28 UTC
Error on pressing <tab> in sftp while the name of the file has a utf-8 character in it.

backtrace_rating: 4
Package: openssh-clients-5.9p1-27.fc17
OS Release: Fedora release 17 (Beefy Miracle)

Comment 3 czochanski 2012-11-28 20:46:32 UTC
Created attachment 653751 [details]
File: backtrace

Comment 4 Darren Tucker 2013-06-01 22:52:49 UTC
Upstream bug (now with patch): https://bugzilla.mindrot.org/show_bug.cgi?id=1990

Comment 5 Fedora Update System 2013-06-20 08:58:21 UTC
openssh-6.1p1-9.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/openssh-6.1p1-9.fc18

Comment 6 Fedora Update System 2013-06-20 10:03:19 UTC
openssh-5.9p1-30.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/openssh-5.9p1-30.fc17

Comment 7 Fedora Update System 2013-06-21 01:59:43 UTC
Package openssh-5.9p1-30.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing openssh-5.9p1-30.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-11392/openssh-5.9p1-30.fc17
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2013-06-27 01:59:11 UTC
openssh-6.1p1-9.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2013-07-01 01:41:30 UTC
openssh-5.9p1-30.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Štefan Gurský 2013-07-07 03:43:18 UTC
I experience this (or very similar) bug in Fedora 19.

After doing steps to reproduce from first post (using same name Modèles), after pressing Tab, this is the last line in terminal before bash prompt appears:

sftp> put Moel_insertstr failed

and then terminal is in state where it does not echo any input.

Name        : openssh
Version     : 6.2p2
Release     : 3.fc19

Comment 11 Kamil Dudka 2013-07-08 11:35:28 UTC
I can see the patch already pushed to the f19 branch, but there is no build of openssh that includes the patch.  The last build is checked out from 66608a1d whereas the patch was introduced in 2ee68109.  This needs to be built for f19.

Comment 12 Fedora Update System 2013-07-23 14:39:25 UTC
openssh-6.2p2-4.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/openssh-6.2p2-4.fc19

Comment 13 Fedora Update System 2013-07-24 03:23:12 UTC
Package openssh-6.2p2-4.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing openssh-6.2p2-4.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-13457/openssh-6.2p2-4.fc19
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2013-07-28 01:08:49 UTC
openssh-6.2p2-4.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.