public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* getent services enumeration glitch
@ 2015-08-18  9:41 Mark Geisert
  2015-08-18 11:24 ` Corinna Vinschen
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Geisert @ 2015-08-18  9:41 UTC (permalink / raw)
  To: cygwin

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.

..mark


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: getent services enumeration glitch
  2015-08-18  9:41 getent services enumeration glitch Mark Geisert
@ 2015-08-18 11:24 ` Corinna Vinschen
  2015-08-18 17:27   ` Mark Geisert
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Corinna Vinschen @ 2015-08-18 11:24 UTC (permalink / raw)
  To: cygwin

[-- 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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: getent services enumeration glitch
  2015-08-18 11:24 ` Corinna Vinschen
@ 2015-08-18 17:27   ` Mark Geisert
  2015-08-18 18:18     ` Corinna Vinschen
  2015-08-18 18:43   ` Warren Young
  2015-08-18 21:49   ` Buchbinder, Barry (NIH/NIAID) [E]
  2 siblings, 1 reply; 13+ messages in thread
From: Mark Geisert @ 2015-08-18 17:27 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen writes:
> On Aug 18 09:40, Mark Geisert wrote:
> > $ getent services man
> > man                   9535/tcp
> > 
> > $ getent services | grep man
> > man                   16165/tcp
> > 
> 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

The new snapshot solves the issue for me.  I'll see if I can stumble upon a
more substantial bug next time :)
Cheers,

..mark

--
captcha: schussing




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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: getent services enumeration glitch
  2015-08-18 17:27   ` Mark Geisert
@ 2015-08-18 18:18     ` Corinna Vinschen
  0 siblings, 0 replies; 13+ messages in thread
From: Corinna Vinschen @ 2015-08-18 18:18 UTC (permalink / raw)
  To: cygwin

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

On Aug 18 17:27, Mark Geisert wrote:
> Corinna Vinschen writes:
> > On Aug 18 09:40, Mark Geisert wrote:
> > > $ getent services man
> > > man                   9535/tcp
> > > 
> > > $ getent services | grep man
> > > man                   16165/tcp
> > > 
> > 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
> 
> The new snapshot solves the issue for me.  I'll see if I can stumble upon a
> more substantial bug next time :)

Haha, yeah, but I think it's substantial enough.  I'm just puzzled that
this bug could live all this time unhampered.


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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: getent services enumeration glitch
  2015-08-18 11:24 ` Corinna Vinschen
  2015-08-18 17:27   ` Mark Geisert
@ 2015-08-18 18:43   ` Warren Young
  2015-08-18 19:01     ` Corinna Vinschen
  2015-08-18 21:49   ` Buchbinder, Barry (NIH/NIAID) [E]
  2 siblings, 1 reply; 13+ messages in thread
From: Warren Young @ 2015-08-18 18:43 UTC (permalink / raw)
  To: cygwin

On Aug 18, 2015, at 5:24 AM, Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:
> 
> Makes me wonder
> how often getservent is used in the wild…

I’d bet getservbyname() is used far more often.
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: getent services enumeration glitch
  2015-08-18 18:43   ` Warren Young
@ 2015-08-18 19:01     ` Corinna Vinschen
  0 siblings, 0 replies; 13+ messages in thread
From: Corinna Vinschen @ 2015-08-18 19:01 UTC (permalink / raw)
  To: cygwin

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

On Aug 18 12:43, Warren Young wrote:
> On Aug 18, 2015, at 5:24 AM, Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:
> > 
> > Makes me wonder
> > how often getservent is used in the wild…
> 
> I’d bet getservbyname() is used far more often.

I won't bet against you.


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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: getent services enumeration glitch
  2015-08-18 11:24 ` Corinna Vinschen
  2015-08-18 17:27   ` Mark Geisert
  2015-08-18 18:43   ` Warren Young
@ 2015-08-18 21:49   ` Buchbinder, Barry (NIH/NIAID) [E]
  2015-08-18 23:43     ` Mark Geisert
  2 siblings, 1 reply; 13+ messages in thread
From: Buchbinder, Barry (NIH/NIAID) [E] @ 2015-08-18 21:49 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen sent the following at Tuesday, August 18, 2015 7:24 AM
>On Aug 18 09:40, Mark Geisert wrote:
>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...

Not that I know what getent is, let alone having ever used it, shouldn't
finding a bug that old merit a gold star?

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: getent services enumeration glitch
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Geisert @ 2015-08-18 23:43 UTC (permalink / raw)
  To: cygwin

Buchbinder, Barry writes:
> Corinna Vinschen sent the following at Tuesday, August 18, 2015 7:24 AM
> >On Aug 18 09:40, Mark Geisert wrote:
> >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...
> 
> Not that I know what getent is, let alone having ever used it, shouldn't
> finding a bug that old merit a gold star?

Oh, please no.  A tin star if you must.  Let's keep gold stars for folks
doing the heavy lifting around here.

..mark


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [SILVERY GOLDSTAR] Re: getent services enumeration glitch
  2015-08-18 23:43     ` Mark Geisert
@ 2015-08-19  7:46       ` Corinna Vinschen
  2015-08-19 12:23         ` Andrew Schulman
  0 siblings, 1 reply; 13+ messages in thread
From: Corinna Vinschen @ 2015-08-19  7:46 UTC (permalink / raw)
  To: cygwin

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

On Aug 18 23:43, Mark Geisert wrote:
> Buchbinder, Barry writes:
> > Corinna Vinschen sent the following at Tuesday, August 18, 2015 7:24 AM
> > >On Aug 18 09:40, Mark Geisert wrote:
> > >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...
> > 
> > Not that I know what getent is, let alone having ever used it, shouldn't
> > finding a bug that old merit a gold star?
> 
> Oh, please no.  A tin star if you must.  Let's keep gold stars for folks
> doing the heavy lifting around here.

Oh, come one, don't be shy.  A silver star at least,

Andrew, do we have silver stars in the vaults?


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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [SILVERY GOLDSTAR] Re: getent services enumeration glitch
  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
  0 siblings, 2 replies; 13+ messages in thread
From: Andrew Schulman @ 2015-08-19 12:23 UTC (permalink / raw)
  To: cygwin

> On Aug 18 23:43, Mark Geisert wrote:
> > Buchbinder, Barry writes:
> > > Corinna Vinschen sent the following at Tuesday, August 18, 2015 7:24 AM
> > > >On Aug 18 09:40, Mark Geisert wrote:
> > > >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...
> > > 
> > > Not that I know what getent is, let alone having ever used it, shouldn't
> > > finding a bug that old merit a gold star?
> > 
> > Oh, please no.  A tin star if you must.  Let's keep gold stars for folks
> > doing the heavy lifting around here.
> 
> Oh, come one, don't be shy.  A silver star at least,
> 
> Andrew, do we have silver stars in the vaults?

But of course!  https://cygwin.com/goldstars/#MG


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [SILVERY GOLDSTAR] Re: getent services enumeration glitch
  2015-08-19 12:23         ` Andrew Schulman
@ 2015-08-19 16:27           ` Corinna Vinschen
  2015-08-19 16:50           ` Andrey Repin
  1 sibling, 0 replies; 13+ messages in thread
From: Corinna Vinschen @ 2015-08-19 16:27 UTC (permalink / raw)
  To: cygwin

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

On Aug 19 08:22, Andrew Schulman wrote:
> > On Aug 18 23:43, Mark Geisert wrote:
> > > Buchbinder, Barry writes:
> > > > Corinna Vinschen sent the following at Tuesday, August 18, 2015 7:24 AM
> > > > >On Aug 18 09:40, Mark Geisert wrote:
> > > > >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...
> > > > 
> > > > Not that I know what getent is, let alone having ever used it, shouldn't
> > > > finding a bug that old merit a gold star?
> > > 
> > > Oh, please no.  A tin star if you must.  Let's keep gold stars for folks
> > > doing the heavy lifting around here.
> > 
> > Oh, come one, don't be shy.  A silver star at least,
> > 
> > Andrew, do we have silver stars in the vaults?
> 
> But of course!  https://cygwin.com/goldstars/#MG

Thanks a lot!


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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [SILVERY GOLDSTAR] Re: getent services enumeration glitch
  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
  1 sibling, 1 reply; 13+ messages in thread
From: Andrey Repin @ 2015-08-19 16:50 UTC (permalink / raw)
  To: Andrew Schulman, cygwin

Greetings, Andrew Schulman!

>> On Aug 18 23:43, Mark Geisert wrote:
>> > Buchbinder, Barry writes:
>> > > Corinna Vinschen sent the following at Tuesday, August 18, 2015 7:24 AM
>> > > >On Aug 18 09:40, Mark Geisert wrote:
>> > > >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...
>> > > 
>> > > Not that I know what getent is, let alone having ever used it, shouldn't
>> > > finding a bug that old merit a gold star?
>> > 
>> > Oh, please no.  A tin star if you must.  Let's keep gold stars for folks
>> > doing the heavy lifting around here.
>> 
>> Oh, come one, don't be shy.  A silver star at least,
>> 
>> Andrew, do we have silver stars in the vaults?

> But of course!  https://cygwin.com/goldstars/#MG

s/fixing/finding/ ?


-- 
With best regards,
Andrey Repin
Wednesday, August 19, 2015 19:47:37

Sorry for my terrible english...


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [SILVERY GOLDSTAR] Re: getent services enumeration glitch
  2015-08-19 16:50           ` Andrey Repin
@ 2015-08-20 13:23             ` Andrew Schulman
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Schulman @ 2015-08-20 13:23 UTC (permalink / raw)
  To: cygwin

> s/fixing/finding/ ?

Right, thanks.  Fixed.


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-08-20 13:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18  9:41 getent services enumeration glitch Mark Geisert
2015-08-18 11:24 ` Corinna Vinschen
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

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).