From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117456 invoked by alias); 18 Aug 2015 11:24:21 -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 117448 invoked by uid 89); 18 Aug 2015 11:24:20 -0000 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 Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Aug 2015 11:24:19 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id B8DFEA80903; Tue, 18 Aug 2015 13:24:16 +0200 (CEST) Date: Tue, 18 Aug 2015 11:24:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: getent services enumeration glitch Message-ID: <20150818112416.GN17917@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.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) X-SW-Source: 2015-08/txt/msg00303.txt.bz2 --svZFHVx8/dhPCe52 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1178 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 Content-length: 819 -----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--