initdb username doc bug

Поиск
Список
Период
Сортировка
Искать

initdb username doc bug

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Вложения:
This commit:

	commit 910cab820d
	Author: Alvaro Herrera 
	Date:   Fri Nov 18 11:59:26 2022 +0100
	
	    Add glossary entries related to superusers
	
	    Extracted from a more ambitious patch.
	
	    Author: David G. Johnston 
	    Discussion: https://postgr.es/m/CAKFQuwZC4K0XYBm0bwBMDOZySBqhOSekDhLuaw4vPi+ozi8gqQ@mail.gmail.com

used this text for the --username option:

       -U username
       --username=username
           Selects the user name of the bootstrap superuser. This defaults
           to the name of the cluster owner.

This seems wrong since the cluster owner doesn't exist until the cluster
is created.  The text exists in PG 16 and master.  The attached patch
fixes this.

-- 
  Bruce Momjian          https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.

Re: initdb username doc bug

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Saturday, January 6, 2024, Bruce Momjian <bruce@momjian.us> wrote:
This commit:

        commit 910cab820d
        Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
        Date:   Fri Nov 18 11:59:26 2022 +0100

            Add glossary entries related to superusers

            Extracted from a more ambitious patch.

            Author: David G. Johnston <david.g.johnston@gmail.com>
            Discussion: https://postgr.es/m/CAKFQuwZC4K0XYBm0bwBMDOZySBqhOSekDhLuaw4vPi+ozi8gqQ@mail.gmail.com

used this text for the --username option:

       -U username
       --username=username
           Selects the user name of the bootstrap superuser. This defaults
           to the name of the cluster owner.

This seems wrong since the cluster owner doesn't exist until the cluster
is created.  The text exists in PG 16 and master.  The attached patch
fixes this.

The glossary defines cluster owner as the pre-existing operating system user.  There may be an argument that installation user is a better term but the existing choice isn’t wrong.  If you are going to change it you need to update the glossary as well.  The description in initdb uses cluster owner as well.

I agree we presently use a mix of set and specify in these definitions so the word choice of selects is out-of-place.

David J.

Re: initdb username doc bug

От:
Bruce Momjian <bruce@momjian.us>
Дата:
On Sat, Jan  6, 2024 at 08:11:14PM -0700, David G. Johnston wrote:
> On Saturday, January 6, 2024, Bruce Momjian  wrote:
> 
>     This commit:
> 
>             commit 910cab820d
>             Author: Alvaro Herrera 
>             Date:   Fri Nov 18 11:59:26 2022 +0100
> 
>                 Add glossary entries related to superusers
> 
>                 Extracted from a more ambitious patch.
> 
>                 Author: David G. Johnston 
>                 Discussion: https://postgr.es/m/CAKFQuwZC4K0XYBm0bwBMDOZySBqhO
>     SekDhLuaw4vPi+ozi8gqQ@mail.gmail.com
> 
>     used this text for the --username option:
> 
>            -U username
>            --username=username
>                Selects the user name of the bootstrap superuser. This defaults
>                to the name of the cluster owner.
> 
>     This seems wrong since the cluster owner doesn't exist until the cluster
>     is created.  The text exists in PG 16 and master.  The attached patch
>     fixes this.
> 
> 
> The glossary defines cluster owner as the pre-existing operating system user. 

No, it does not.

> There may be an argument that installation user is a better term but the
> existing choice isn’t wrong.  If you are going to change it you need to update
> the glossary as well.  The description in initdb uses cluster owner as well.
> 
> I agree we presently use a mix of set and specify in these definitions so the
> word choice of selects is out-of-place.

The patch says:

	+  
	+   Cluster owner
	+   
	+    
-->	+     The operating system user that owns the
-->	+     data directory
	+     and under which the postgres process is run.
	+     It is required that this user exist prior to creating a new
	+     database cluster.
	+    
	+    
	+     On operating systems with a root user,
	+     said user is not allowed to be the cluster owner.
	+    
	+   
	+  

How can you default to be the owner of something that doesn't exist before
it is created?

Also, the initdb code gets the default username from geteuid(), the
effective process owner; man geteuid says:

	geteuid() returns the effective user ID of the calling process.

so it is not the owner of the data dirctory, but the installation user.

I am open to saying that it is the owner of the data directory but we
would then need to change initdb to do that, and we aren't going to
backpatch that.

-- 
  Bruce Momjian          https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.


Re: initdb username doc bug

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Saturday, January 6, 2024, Bruce Momjian <bruce@momjian.us> wrote:
On Sat, Jan  6, 2024 at 08:11:14PM -0700, David G. Johnston wrote:
> On Saturday, January 6, 2024, Bruce Momjian <bruce@momjian.us> wrote:
>
>     This commit:
>
>             commit 910cab820d
>             Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
>             Date:   Fri Nov 18 11:59:26 2022 +0100
>
>                 Add glossary entries related to superusers
>
>                 Extracted from a more ambitious patch.
>
>                 Author: David G. Johnston <david.g.johnston@gmail.com>
>                 Discussion: https://postgr.es/m/CAKFQuwZC4K0XYBm0bwBMDOZySBqhO
>     SekDhLuaw4vPi+ozi8gqQ@mail.gmail.com
>
>     used this text for the --username option:
>
>            -U username
>            --username=username
>                Selects the user name of the bootstrap superuser. This defaults
>                to the name of the cluster owner.
>
>     This seems wrong since the cluster owner doesn't exist until the cluster
>     is created.  The text exists in PG 16 and master.  The attached patch
>     fixes this.
>
>
> The glossary defines cluster owner as the pre-existing operating system user. 

No, it does not.

> There may be an argument that installation user is a better term but the
> existing choice isn’t wrong.  If you are going to change it you need to update
> the glossary as well.  The description in initdb uses cluster owner as well.
>
> I agree we presently use a mix of set and specify in these definitions so the
> word choice of selects is out-of-place.

The patch says:

        +  <glossentry id="glossary-cluster-owner">
        +   <glossterm>Cluster owner</glossterm>
        +   <glossdef>
        +    <para>
-->     +     The operating system user that owns the
-->     +     <glossterm linkend="glossary-data-directory">data directory</glossterm>
        +     and under which the <literal>postgres</literal> process is run.
        +     It is required that this user exist prior to creating a new
        +     <glossterm linkend="glossary-db-cluster">database cluster</glossterm>.
        +    </para>
        +    <para>
        +     On operating systems with a <literal>root</literal> user,
        +     said user is not allowed to be the cluster owner.
        +    </para>
        +   </glossdef>
        +  </glossentry>

How can you default to be the owner of something that doesn't exist before
it is created?

Also, the initdb code gets the default username from geteuid(), the
effective process owner; man geteuid says:

        geteuid() returns the effective user ID of the calling process.

so it is not the owner of the data dirctory, but the installation user.

I am open to saying that it is the owner of the data directory but we
would then need to change initdb to do that, and we aren't going to
backpatch that.

Ok, I see your point.  Given that the installation users becomes the cluster owner by virtue of doing the only job they have, running initdb, defining both seemed excessive but it is indeed more precise.  I would probably avoid install user though because of the probable confusion with the user that installed the distribution package as opposed to the one initializing the cluster (we don’t call it installing a cluster).

So maybe a new defined term “cluster initializer”?

David J.

Re: initdb username doc bug

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:


On Saturday, January 6, 2024, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Saturday, January 6, 2024, Bruce Momjian <bruce@momjian.us> wrote:

        geteuid() returns the effective user ID of the calling process.

so it is not the owner of the data dirctory, but the installation user.

I am open to saying that it is the owner of the data directory but we
would then need to change initdb to do that, and we aren't going to
backpatch that.

So maybe a new defined term “cluster initializer”?

Or just the bit more verbose “user running the initdb command” and don’t bother giving it a label, which is basically the approach used in the description for initdb anyway.

David J.

 

Re: initdb username doc bug

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"David G. Johnston"  writes:
> Or just the bit more verbose “user running the initdb command” and don’t
> bother giving it a label, which is basically the approach used in the
> description for initdb anyway.

Or if you want a few more words, "name of the operating-system user
running initdb".  I don't like "installation user", that's just about
as vague as could be.

			regards, tom lane


Re: initdb username doc bug

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Вложения:
On Sat, Jan  6, 2024 at 11:27:14PM -0500, Tom Lane wrote:
> "David G. Johnston"  writes:
> > Or just the bit more verbose “user running the initdb command” and don’t
> > bother giving it a label, which is basically the approach used in the
> > description for initdb anyway.
> 
> Or if you want a few more words, "name of the operating-system user
> running initdb".  I don't like "installation user", that's just about
> as vague as could be.

Agreed, updated patch attached.

-- 
  Bruce Momjian          https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.

Re: initdb username doc bug

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Mon, Jan 8, 2024 at 2:26 PM Bruce Momjian <bruce@momjian.us> wrote:
On Sat, Jan  6, 2024 at 11:27:14PM -0500, Tom Lane wrote:
> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > Or just the bit more verbose “user running the initdb command” and don’t
> > bother giving it a label, which is basically the approach used in the
> > description for initdb anyway.
>
> Or if you want a few more words, "name of the operating-system user
> running initdb".  I don't like "installation user", that's just about
> as vague as could be.

Agreed, updated patch attached.


+1

Thanks!

David J.

Re: initdb username doc bug

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian  writes:
> Agreed, updated patch attached.

WFM.

			regards, tom lane


Re: initdb username doc bug

От:
Bruce Momjian <bruce@momjian.us>
Дата:
On Mon, Jan  8, 2024 at 04:50:19PM -0500, Tom Lane wrote:
> Bruce Momjian  writes:
> > Agreed, updated patch attached.
> 
> WFM.

Patch applied back to PG 16, which is where the erroneous text was
added.

-- 
  Bruce Momjian          https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.


Re: initdb username doc bug

От:
Álvaro Herrera <alvherre@alvh.no-ip.org>
Дата:
On 2024-Jan-10, Bruce Momjian wrote:

> On Mon, Jan  8, 2024 at 04:50:19PM -0500, Tom Lane wrote:
> > Bruce Momjian  writes:
> > > Agreed, updated patch attached.
> > 
> > WFM.
> 
> Patch applied back to PG 16, which is where the erroneous text was
> added.

Thank you!  It looks good to me too.  Sorry I got a bit too late to this
thread.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
“Cuando no hay humildad las personas se degradan” (A. Christie)


Re: initdb username doc bug

От:
Bruce Momjian <bruce@momjian.us>
Дата:
On Wed, Jan 10, 2024 at 06:05:17PM +0100, Álvaro Herrera wrote:
> On 2024-Jan-10, Bruce Momjian wrote:
> 
> > On Mon, Jan  8, 2024 at 04:50:19PM -0500, Tom Lane wrote:
> > > Bruce Momjian  writes:
> > > > Agreed, updated patch attached.
> > > 
> > > WFM.
> > 
> > Patch applied back to PG 16, which is where the erroneous text was
> > added.
> 
> Thank you!  It looks good to me too.  Sorry I got a bit too late to this
> thread.

Sure, no problem, we got it!

-- 
  Bruce Momjian          https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.


FAQ