public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: getent services enumeration glitch
Date: Tue, 18 Aug 2015 11:24:00 -0000	[thread overview]
Message-ID: <20150818112416.GN17917@calimero.vinschen.de> (raw)
In-Reply-To: <loom.20150818T113145-139@post.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]

Hi Mark,

On Aug 18 09:40, Mark Geisert wrote:
> There is a glitch when getent enumerates all services; it shows an incorrect
> port number.  Providing a service name on invocation shows the correct port
> number.  Examples:
> 
> $ getent services man
> man                   9535/tcp
> 
> $ getent services | grep man
> man                   16165/tcp
> 
> It looks like when all services are enumerated there is an extra or missing
> 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

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-08-18 11:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18  9:41 Mark Geisert
2015-08-18 11:24 ` Corinna Vinschen [this message]
2015-08-18 17:27   ` Mark Geisert
2015-08-18 18:18     ` Corinna Vinschen
2015-08-18 18:43   ` Warren Young
2015-08-18 19:01     ` Corinna Vinschen
2015-08-18 21:49   ` Buchbinder, Barry (NIH/NIAID) [E]
2015-08-18 23:43     ` Mark Geisert
2015-08-19  7:46       ` [SILVERY GOLDSTAR] " Corinna Vinschen
2015-08-19 12:23         ` Andrew Schulman
2015-08-19 16:27           ` Corinna Vinschen
2015-08-19 16:50           ` Andrey Repin
2015-08-20 13:23             ` Andrew Schulman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150818112416.GN17917@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).