X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=e3DlM03BNhyjRqdr1W04h749gVjGwG2g+q25/Lgl1joXo1YNjNzRx Auw0NeV9wlGTkqtozf7GkbnWXhaC0r9KRCCbJxM8/V3aiTYjXUeVlGirvWEbCqCc BLW0PrbYJwqIimxCsy1+mWRnAEpsD4xZ5SB0cLdGJIn85TWbTKiyT0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=2b9lkuO8gLt4VkfK9+ZJsSmPn0Q=; b=hAfTP9DSl4mcvsfmKOEM5XZUeoRt MBFiGhPCT+r3/kZbejLPUt2MRjMD/Y9HvUVwtNW0rBm10dyqK5g+ht9BNCRfxwux gKZPwgl9gAMBVFAC+uFpNlgTSEzDvne19hBXzEOetNEkzifUYI0OSmhwfZgdp14L 8+j03GHTJDioIaE= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: calimero.vinschen.de Date: Tue, 18 Aug 2015 13:24:16 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: getent services enumeration glitch Message-ID: <20150818112416.GN17917@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="svZFHVx8/dhPCe52" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) --svZFHVx8/dhPCe52 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Mark, On Aug 18 09:40, Mark Geisert wrote: > There is a glitch when getent enumerates all services; it shows an incorr= ect > port number. Providing a service name on invocation shows the correct po= rt > number. Examples: >=20 > $ getent services man > man 9535/tcp >=20 > $ getent services | grep man > man 16165/tcp >=20 > It looks like when all services are enumerated there is an extra or missi= ng > byte swap call to htons() or ntohs(). This can be observed by comparing = the > hex values of the two port numbers shown above, giving 0x253F and 0x3F25. Congratulations! You found a 13 years old bug in Cygwin's getservent implementation, which returned the port number in host byte order instead of in network byte order for all this time. Makes me wonder how often getservent is used in the wild... Since I uploaded 2.2.1-0.2 just before your bug report, I quickly created a new snapshot with the patch on https://cygwin.com/snapshots/ Please give it a try. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --svZFHVx8/dhPCe52 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJV0xXgAAoJEPU2Bp2uRE+gDnEQAKaXyGPM3g2EPsVI4fUrWWcU 984tSRJTddFfALb5IKJ1UjfthPPDMl58PQGrKnRASMu5unmVfPOkGnAIsFF+7zsV g+AN1CReZKBb/dH2xkWBnqwprtMGETQ8bLuQ8AJqZAA9Y06cf1JJG+nasagss7wO 9Bzksn5W1vYsq68Cg2KGlvLpDykUuACERQQY1qjat5QHpvt+1c1yrHxCESWH5rAc 5edjNOqsnusi4qUpTDuevPbQiTkPydzMNV0FC8RH1s+K34dF28Ihc6OI0OW/nxb7 Se8UPIuOwgTIxpVB7EUD+NZcC9gMBtQl1pIEr4WGOfVAlyxfpJChoMCYWPxvyugs 0B1muTTmhI7KttcKC6lcIK2YLSn1XqqSOn8eKcmIrPW1tX1YevSp+DqVDwWwzGyH MuHXJqcQCDepw/VeRHGAcubq/Z8JFX7qjdv8cVK9Ul6gaSDU0Bmpl/QBgHPmhDJe DPcERU9qqqU2yFrWFF0oLVtlDPfm7frbvibP7q6ZxKUke24zn1dOM44dNC0R2JXK tD7mxylFgpKSI4UEnVpgJU1/90TMDqUGjOI16zziepEiwoFlzMY+gAvo4+Mt/DnM E4kF8SU3GcrdNcejdrIc8+qIarKNE5532j4/+qEoxMVJImySTGS2oKWSUswvUBq7 LZtVoXkYFdod7bao6aiY =hUw1 -----END PGP SIGNATURE----- --svZFHVx8/dhPCe52--