delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/08/15/20:58:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: openssh-4.1p1-2/cygwin-1.5.18-1: write(2) misbehaving?
Date: Mon, 15 Aug 2005 19:57:56 -0500
Message-ID: <CB0EAF8A515FC4488F2B4B546BEE012CA0EAEF@islexch2k.isllcnets.studentloan.org>
From: "Dave Kilzer" <DKilzer AT StudentLoan DOT org>
To: <cygwin AT cygwin DOT com>
Note-from-DJ: This may be spam

------_=_NextPart_001_01C5A1FD.89C806B4
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

After upgrading my Cygwin packages recently (running cygwin-1.5.18-1), I
found that I could no longer log in to a variety of Linux servers
running various versions of sshd from OpenSSH (OpenSSH_3.5p1 on Red Hat
9, OpenSSH_3.8.1p1 on Debian 3.1, OpenSSH_4.1p1 on Debian
post-3.1-unstable).  Here's the output I'm getting from "ssh -v
hostname" (replaced real hostname with "hostname"; replaced real IP
address with "1.2.3.4"; replaced real home directory with "~"):

$ ssh -v hostname
OpenSSH_4.1p1, OpenSSL 0.9.8 05 Jul 2005
debug1: Connecting to hostname [1.2.3.4] port 22.
debug1: Connection established.
debug1: identity file ~/.ssh/identity type -1
debug1: identity file ~/.ssh/id_rsa type 1
debug1: identity file ~/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version
OpenSSH_3.8.1p1 Debian-8.sarge.4
debug1: match: OpenSSH_3.8.1p1 Debian-8.sarge.4 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'hostname' is known and matches the RSA host key.
debug1: Found key in ~/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
Write failed: No such file or directory

After some debugging, I found out that the error message after "Write
failed:" is simply the last errno entry populated in the course of
running ssh (in this case ENOENT), and doesn't actually represent the
error that is occurring.

I also discovered two distinct ways to fix this problem:

1. Configure openssh with the '--with-cflags=3D"-DPACKET_DEBUG=3D1"' switch,
then build openssh.  This prevents the bug from occurring at the cost of
copious debugging output of packet information.  The fact that this
works would indicate to me that there is some kind of compiler (code
generation) issue or that some kind of race condition exists that is
related to the network layer.

2. Apply the attached patch and (re)build openssh.  After reading the
manpage for write(2), it said that write(2) returns -1 on error, thus
errno will not contain a "related" error if checked when write(2)
returns 0.  (There were other mitigating circumstances when writing to
"real" files according to the manpage, but this did not apply.)  The
fact that this patch works tells me that write(2) seems to be broken,
and is actually returning 0 when it should be returning a positive
integer (e.g., the value of "len" in this case).

Note that I tried running "ssh.exe" from openssh-3.9p1-3/cygwin-1.5.13-1
with cygwin-1.5.18-1, and it had the exact same problem.  (I have not
tried compiling openssh-4.1p1-2 on the system running cygwin-1.5.13-1
yet, though.)

Any idea what's going on?

Dave


------_=_NextPart_001_01C5A1FD.89C806B4
Content-Type: application/octet-stream;
	name="openssh-4.1p1-2-cygwin-fix-write-failed.diff"
Content-Transfer-Encoding: base64
Content-Description: openssh-4.1p1-2-cygwin-fix-write-failed.diff
Content-Disposition: attachment;
	filename="openssh-4.1p1-2-cygwin-fix-write-failed.diff"

ZGlmZiAtdSBvcGVuc3NoLTQuMXAxLTIvcGFja2V0LmMub3JpZyBvcGVuc3No
LTQuMXAxLTIvcGFja2V0LmMNCi0tLSBvcGVuc3NoLTQuMXAxLTIvcGFja2V0
LmMub3JpZwkyMDA0LTExLTA1IDAzOjI3OjU1LjAwMTAwMDAwMCAtMDYwMA0K
KysrIG9wZW5zc2gtNC4xcDEtMi9wYWNrZXQuYwkyMDA1LTA4LTE1IDE5OjE0
OjEzLjQ4NzIyMjkwMCAtMDUwMA0KQEAgLTEzNTAsMTMgKzEzNTAsMTUgQEAN
CiAJaW50IGxlbiA9IGJ1ZmZlcl9sZW4oJm91dHB1dCk7DQogDQogCWlmIChs
ZW4gPiAwKSB7DQotCQlsZW4gPSB3cml0ZShjb25uZWN0aW9uX291dCwgYnVm
ZmVyX3B0cigmb3V0cHV0KSwgbGVuKTsNCi0JCWlmIChsZW4gPD0gMCkgew0K
KwkJaW50IHdyaXRlbGVuID0gd3JpdGUoY29ubmVjdGlvbl9vdXQsIGJ1ZmZl
cl9wdHIoJm91dHB1dCksIGxlbik7DQorCQlpZiAod3JpdGVsZW4gPCAwKSB7
DQogCQkJaWYgKGVycm5vID09IEVBR0FJTikNCiAJCQkJcmV0dXJuOw0KIAkJ
CWVsc2UNCiAJCQkJZmF0YWwoIldyaXRlIGZhaWxlZDogJS4xMDBzIiwgc3Ry
ZXJyb3IoZXJybm8pKTsNCiAJCX0NCisJCWlmICh3cml0ZWxlbiA+IDApDQor
CQkJbGVuID0gd3JpdGVsZW47DQogCQlidWZmZXJfY29uc3VtZSgmb3V0cHV0
LCBsZW4pOw0KIAl9DQogfQ0K


------_=_NextPart_001_01C5A1FD.89C806B4
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------_=_NextPart_001_01C5A1FD.89C806B4--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019