Re: BUG #18712: inet value ::2 handling goes not as expected

From: Denis Feklushkin <feklushkin(dot)denis(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: denis(dot)feklushkin(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18712: inet value ::2 handling goes not as expected
Date: 2024-11-18 05:17:51
Message-ID: CAHY2gWfDGqZHQB7nKhtmPGBGYxvhS5OqY4k_BaAP5PSwHyW8Tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

вс, 17 нояб. 2024 г. в 20:05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > I think that statement
> > select '::0.0.0.2'::inet;
> > should return '::0.0.0.2' value, not '::2'
>
> > I think this is what was intended in the Postgres sources. But it seems
> that
> > this line is never executed:
> >
> https://github.com/postgres/postgres/blob/7b88529f4363994450bd4cd3c172006a8a77e222/src/port/inet_net_ntop.c#L260
>
> Hmm ... you are right that that code doesn't do what it seems to
> intend to, because by the time that we get to this logic we have
> i == 7 not i == 6.

Yes, this code block should be placed at first place inside of for loop

> But I'm not sure if we should change it after
> all this time. We're about as likely to get complaints as kudos,
> I fear. And the output isn't incorrect, just not-per-style.
>
> I wonder whether ISC ever changed their version?
>

https://github.com/openbsd/src/blob/f7304f605db8e3a4de0a0d1c1488830678f77517/sys/netinet/inet_ntop.c#L196
Looks, they don't used 0x0001 check, so, they version was always as intended

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Raghu Dev Ramaiah 2024-11-18 05:55:45 Getting error while building PSQL 17.1 on AIX box
Previous Message Michael Paquier 2024-11-18 03:09:11 Re: BUG #18710: "pg_get_viewdef" triggers assertions in special scenarios