Re: Change atoi to strtol in same place

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Joe Nelson <joe(at)begriffs(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Surafel Temesgen <surafel3000(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: Change atoi to strtol in same place
Date: 2019-10-07 07:05:19
Message-ID: CAE9k0PmuDf9z33H7wRbdfoimVpdt=-X+2OJemueXhMAEmwZQPA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 7, 2019 at 11:05 AM David Rowley
<david(dot)rowley(at)2ndquadrant(dot)com> wrote:
>
> On Mon, 7 Oct 2019 at 18:27, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> wrote:
> > AFAIU from the information given in the wiki page -[1], the port
> > numbers in the range of 1-1023 are for the standard protocols and
> > services. And there is nowhere mentioned that it is only true for some
> > OS and not for others. But, having said that I've just verified it on
> > Linux so I'm not aware of the behaviour on Windows.
> >
> > [1] - https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
>
> Here are the results of a quick test on a windows machine:
>
> L:\Projects\Postgres\install\bin>echo test > c:\windows\test.txt
> Access is denied.
>
> L:\Projects\Postgres\install\bin>cat ../data/postgresql.conf | grep "port = "
> port = 543 # (change requires restart)
>
> L:\Projects\Postgres\install\bin>psql -p 543 postgres
> psql (11.5)
> WARNING: Console code page (850) differs from Windows code page (1252)
> 8-bit characters might not work correctly. See psql reference
> page "Notes for Windows users" for details.
> Type "help" for help.
>
> postgres=#
>

Oh then that means all the unused ports (be it dedicated for some
particular protocol or service) can be used on Windows. I just tried
using port number 21 and 443 for postgres on my old Windows setup and
it worked. See below,

C:\Users\ashu\git-clone-postgresql\postgresql\TMP\test\bin>.\pg_ctl -D
..\data -c -w -l logfile -o "
-p 21" start
waiting for server to start.... done
server started

C:\Users\ashu\git-clone-postgresql\postgresql\TMP\test\bin>.\psql -d
postgres -p 21
psql (10.5)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

postgres=# \q

C:\Users\ashu\git-clone-postgresql\postgresql\TMP\test\bin>.\pg_ctl -D
..\data -c -w -l logfile stop

waiting for server to shut down.... done
server stopped

C:\Users\ashu\git-clone-postgresql\postgresql\TMP\test\bin>.\pg_ctl -D
..\data -c -w -l logfile -o "
-p 443" start
waiting for server to start.... done
server started

C:\Users\ashu\git-clone-postgresql\postgresql\TMP\test\bin>.\psql -d
postgres -p 443
psql (10.5)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.

This looks a weird behaviour to me. I think this is probably one
reason why people don't prefer using Windows. Anyways, thanks David
for putting that point, it was really helpful.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anders Åstrand 2019-10-07 07:14:38 PATCH: Add uri percent-encoding for binary data
Previous Message Michael Paquier 2019-10-07 07:01:55 Re: Fix for Bug #16032