From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81188 invoked by alias); 27 Jul 2017 18:38:02 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 80173 invoked by uid 89); 27 Jul 2017 18:38:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=interactive, stepped, cfd, replay X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Jul 2017 18:37:59 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 257B09D767 for ; Thu, 27 Jul 2017 18:37:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 257B09D767 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com Received: from [10.10.120.22] (ovpn-120-22.rdu2.redhat.com [10.10.120.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71F2A61F3E for ; Thu, 27 Jul 2017 18:37:57 +0000 (UTC) Subject: Re: [ANNOUNCEMENT] Updated: libreadline7-7.0.3-3 To: cygwin@cygwin.com References: <58f1a28e.0a2c9d0a.f2ec.8160@mx.google.com> <5dbbf0e4-6374-a9bb-21e5-dd5537e0e19a@redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: Date: Thu, 27 Jul 2017 21:39:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <5dbbf0e4-6374-a9bb-21e5-dd5537e0e19a@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FJ5JwGR83mQ7Kw45Hl9uFvrU6NrMtDqrS" X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00392.txt.bz2 --FJ5JwGR83mQ7Kw45Hl9uFvrU6NrMtDqrS Content-Type: multipart/mixed; boundary="aCmxE8AicQDmtLDJb8meUTwK9Ub2H9vJL"; protected-headers="v1" From: Eric Blake To: cygwin@cygwin.com Message-ID: Subject: Re: [ANNOUNCEMENT] Updated: libreadline7-7.0.3-3 References: <58f1a28e.0a2c9d0a.f2ec.8160@mx.google.com> <5dbbf0e4-6374-a9bb-21e5-dd5537e0e19a@redhat.com> In-Reply-To: <5dbbf0e4-6374-a9bb-21e5-dd5537e0e19a@redhat.com> --aCmxE8AicQDmtLDJb8meUTwK9Ub2H9vJL Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Content-length: 3518 On 07/27/2017 12:08 PM, Eric Blake wrote: > So I'm back to cmd to try and debug things. Next, I tried: >=20 > c:\cygwin\bin> .\dash > >=20 > and again got =CE=A9; pressing complains that ./dash: 1: =CE=A9: = not found To double check things, I started .\dash, typed 'echo $$', then in a second terminal, typed 'gdb --pid XXX' with the dash pid. (gdb) b read (gdb) b select (gdb) c then in the first window, typed to get dash back to its input loop and the second window hit a breakpoint in read. But that didn't get me very far: Thread 1 hit Breakpoint 1, read (fd=3D0, ptr=3D0x41b540 , len=3D10= 24) at /usr/src/debug/cygwin-2.8.2-1/winsup/cygwin/syscalls.cc:1118 1118 { (gdb) fin Run till exit from #0 read (fd=3D0, ptr=3D0x41b540 , len=3D1024) at /usr/src/debug/cygwin-2.8.2-1/winsup/cygwin/syscalls.cc:1118 [New Thread 628.0x70c] readline: readline_callback_read_char() called with no handler! Aborted (core dumped) Urgh - gdb uses readline, so debugging readline with gdb may prove harder than planned if I don't time things right. A second time around, and instead of using fin, I stepped through: 1118 { (gdb) n ... (gdb) n 1139 cfd->read (ptr, len); (gdb) n [New Thread 736.0x960] at the point of the new thread, I typed in the first terminal, which let the read return, and the buffer contents are correct: 1140 res =3D len; (gdb) p len $1 =3D 3 (gdb) p/x ((char*)ptr)[0] $2 =3D 0xce (gdb) p/x ((char*)ptr)[1] $3 =3D 0xa9 (gdb) p ((char*)ptr)[2] $4 =3D '\n' so whatever dash did, it read a solid block of input from the terminal; from there, I quit debugging - obviously dash is not doing things piecemeal, and manages to replay the same output as it just read in input (when you aren't trying hard to be interactive, life is easy). >=20 > However, when I try: >=20 > c:\cygwin\bin> .\bash --norc > >=20 > the display shows :\251 Repeating the gdb attach trick, I'm able to catch bash at this breakpoint, even without hitting , just by typing : Thread 1 hit Breakpoint 1, read (fd=3D0, ptr=3D0x28c013, len=3D1) at /usr/src/debug/cygwin-2.8.2-1/winsup/cygwin/syscalls.cc:1118 Notice a difference? dash had the terminal set up in line-oriented mode, and blindly reads until EOL or until len=3D1024 is exhausted; bash has the terminal set up in byte-oriented mode, and is only reading len=3D1 at a time. So when entering a UTF-8 character to dash, the whole character lands in the buffer at once, while under bash (presumably, as I haven't debugged that far yet), bash must reconstruct the Unicode characters from the individual bytes. Stepping through the breakpoints on sees 0xce on the first read, and 0xa9 on the second. But, in between the two read breakpoints, the first terminal displayed ':'. So the input is still making it correctly INTO readline; but being munged on the way to output; and it very much looks like readline's fault rather than cygwin's. I'm still trying to put breakpoints in the right places (the call stack at read() points to rl_getc(), from rl_read_key(), from readline_internal_char()...), but this is at least to let you know how I'm tackling the issue, in case it helps someone else spot a solution faster than me by starting from the same information. --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --aCmxE8AicQDmtLDJb8meUTwK9Ub2H9vJL-- --FJ5JwGR83mQ7Kw45Hl9uFvrU6NrMtDqrS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 619 -----BEGIN PGP SIGNATURE----- Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAll6Mv8ACgkQp6FrSiUn Q2oHPgf/fEfog2adNpqosKrabS7d8wQNs3DyxT8mLo0vto3oD2gm5M1ru1nGDIAR YhvsYvPEsCDcWQ4gBh7AskHmOjLHSWx1sbjoDgftiqEOBHw+5YDzBYY1FkIJZ2Zh ukqskIWwkmIoCiyHrWpDpA3o/Rli16G5V9msASWHq2BJPRItMdPeP3STh6gavSf3 aKMn6cUBpelW1qlwBvEIyzwdm04zaP5vgYQx36Uwc1P1ZfBMb80Bz3BWmUy3X+m1 K1NKh3ubqL72yRhvGJUJ6PWh1f+7Wy2eEFYXVweDvPClsdJAKHa7q4qfTJ9aYWJO bO6RwfzzAM037SteJkMzig0dlotdHQ== =w74+ -----END PGP SIGNATURE----- --FJ5JwGR83mQ7Kw45Hl9uFvrU6NrMtDqrS--