public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
@ 2020-08-29 19:53 Michał Górny
  2020-08-29 20:05 ` Alexey Sokolov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Michał Górny @ 2020-08-29 19:53 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Thanks to David Michael for the initial patch and upstream fixes.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/acct-group.eclass | 16 +++++++++++++++-
 eclass/acct-user.eclass  | 16 +++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 5550e4a2fb10..dc1562974870 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -80,7 +80,7 @@ S=${WORKDIR}
 
 
 # << Phase functions >>
-EXPORT_FUNCTIONS pkg_pretend pkg_preinst
+EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
 
 # @FUNCTION: acct-group_pkg_pretend
 # @DESCRIPTION:
@@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
 	fi
 }
 
+# @FUNCTION: acct-group_src_install
+# @DESCRIPTION:
+# Installs sysusers.d file for the group.
+acct-group_src_install() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	insinto /usr/lib/sysusers.d
+	newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
+		printf "g\t%q\t%q\n" \
+			"${ACCT_GROUP_NAME}" \
+			"${ACCT_GROUP_ID/#-*/-}"
+	)
+}
+
 # @FUNCTION: acct-group_pkg_preinst
 # @DESCRIPTION:
 # Creates the group if it does not exist yet.
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index e82f3c56dbbe..f9772c3cb111 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
 # @FUNCTION: acct-user_src_install
 # @DESCRIPTION:
 # Installs a keep-file into the user's home directory to ensure it is
-# owned by the package.
+# owned by the package, and sysusers.d file.
 acct-user_src_install() {
 	debug-print-function ${FUNCNAME} "${@}"
 
@@ -321,6 +321,20 @@ acct-user_src_install() {
 		# created yet
 		keepdir "${ACCT_USER_HOME}"
 	fi
+
+	insinto /usr/lib/sysusers.d
+	newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
+		printf "u\t%q\t%q\t%q\t%q\t%q\n" \
+			"${ACCT_USER_NAME}" \
+			"${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
+			"${DESCRIPTION//[:,=]/;}" \
+			"${ACCT_USER_HOME}" \
+			"${ACCT_USER_SHELL/#-*/-}"
+		if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
+			printf "m\t${ACCT_USER_NAME}\t%q\n" \
+				"${ACCT_USER_GROUPS[@]:1}"
+		fi
+	)
 }
 
 # @FUNCTION: acct-user_pkg_preinst
-- 
2.28.0



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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-08-29 19:53 [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files Michał Górny
@ 2020-08-29 20:05 ` Alexey Sokolov
  2020-08-29 20:08   ` Michał Górny
  2020-08-31 13:03 ` Marek Szuba
  2020-09-13 11:21 ` Andrew Savchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Alexey Sokolov @ 2020-08-29 20:05 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

As this doesn't depend on architecture, why /lib and not /share?

сб, 29 авг. 2020 г. в 20:53, Michał Górny <mgorny@gentoo.org>:
>
> Thanks to David Michael for the initial patch and upstream fixes.
>
> Signed-off-by: Michał Górny <mgorny@gentoo.org>
> ---
>  eclass/acct-group.eclass | 16 +++++++++++++++-
>  eclass/acct-user.eclass  | 16 +++++++++++++++-
>  2 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> index 5550e4a2fb10..dc1562974870 100644
> --- a/eclass/acct-group.eclass
> +++ b/eclass/acct-group.eclass
> @@ -80,7 +80,7 @@ S=${WORKDIR}
>
>
>  # << Phase functions >>
> -EXPORT_FUNCTIONS pkg_pretend pkg_preinst
> +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
>
>  # @FUNCTION: acct-group_pkg_pretend
>  # @DESCRIPTION:
> @@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
>         fi
>  }
>
> +# @FUNCTION: acct-group_src_install
> +# @DESCRIPTION:
> +# Installs sysusers.d file for the group.
> +acct-group_src_install() {
> +       debug-print-function ${FUNCNAME} "${@}"
> +
> +       insinto /usr/lib/sysusers.d
> +       newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
> +               printf "g\t%q\t%q\n" \
> +                       "${ACCT_GROUP_NAME}" \
> +                       "${ACCT_GROUP_ID/#-*/-}"
> +       )
> +}
> +
>  # @FUNCTION: acct-group_pkg_preinst
>  # @DESCRIPTION:
>  # Creates the group if it does not exist yet.
> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
> index e82f3c56dbbe..f9772c3cb111 100644
> --- a/eclass/acct-user.eclass
> +++ b/eclass/acct-user.eclass
> @@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
>  # @FUNCTION: acct-user_src_install
>  # @DESCRIPTION:
>  # Installs a keep-file into the user's home directory to ensure it is
> -# owned by the package.
> +# owned by the package, and sysusers.d file.
>  acct-user_src_install() {
>         debug-print-function ${FUNCNAME} "${@}"
>
> @@ -321,6 +321,20 @@ acct-user_src_install() {
>                 # created yet
>                 keepdir "${ACCT_USER_HOME}"
>         fi
> +
> +       insinto /usr/lib/sysusers.d
> +       newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
> +               printf "u\t%q\t%q\t%q\t%q\t%q\n" \
> +                       "${ACCT_USER_NAME}" \
> +                       "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
> +                       "${DESCRIPTION//[:,=]/;}" \
> +                       "${ACCT_USER_HOME}" \
> +                       "${ACCT_USER_SHELL/#-*/-}"
> +               if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
> +                       printf "m\t${ACCT_USER_NAME}\t%q\n" \
> +                               "${ACCT_USER_GROUPS[@]:1}"
> +               fi
> +       )
>  }
>
>  # @FUNCTION: acct-user_pkg_preinst
> --
> 2.28.0
>
>


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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-08-29 20:05 ` Alexey Sokolov
@ 2020-08-29 20:08   ` Michał Górny
  0 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2020-08-29 20:08 UTC (permalink / raw
  To: gentoo-dev

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

On Sat, 2020-08-29 at 21:05 +0100, Alexey Sokolov wrote:
> As this doesn't depend on architecture, why /lib and not /share?
> 

I can only imagine how thrilled systemd authors will be when you ask
them.

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-08-29 19:53 [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files Michał Górny
  2020-08-29 20:05 ` Alexey Sokolov
@ 2020-08-31 13:03 ` Marek Szuba
  2020-09-13 11:21 ` Andrew Savchenko
  2 siblings, 0 replies; 9+ messages in thread
From: Marek Szuba @ 2020-08-31 13:03 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 671 bytes --]

On 2020-08-29 21:53, Michał Górny wrote:

> +	newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
> +		printf "u\t%q\t%q\t%q\t%q\t%q\n" \
> +			"${ACCT_USER_NAME}" \
> +			"${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
> +			"${DESCRIPTION//[:,=]/;}" \

Maybe it's a fault in how I have tested this (i.e. in an interactive
bash session, by setting all the variables and copy-pasting the relevant
printf lines by hand) but for me this results in an unquoted GECOS
string with spaces escaped with backslashes, whereas sysusers.d(5)
explicitly states this should be enclosed in quotation marks. Could you
double-check, please?

Otherwise LGTM.

-- 
MS


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-08-29 19:53 [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files Michał Górny
  2020-08-29 20:05 ` Alexey Sokolov
  2020-08-31 13:03 ` Marek Szuba
@ 2020-09-13 11:21 ` Andrew Savchenko
  2020-09-13 11:36   ` Marek Szuba
                     ` (3 more replies)
  2 siblings, 4 replies; 9+ messages in thread
From: Andrew Savchenko @ 2020-09-13 11:21 UTC (permalink / raw
  To: gentoo-dev

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

On Sat, 29 Aug 2020 21:53:45 +0200 Michał Górny wrote:
> Thanks to David Michael for the initial patch and upstream fixes.
> 
> Signed-off-by: Michał Górny <mgorny@gentoo.org>
> ---
>  eclass/acct-group.eclass | 16 +++++++++++++++-
>  eclass/acct-user.eclass  | 16 +++++++++++++++-
>  2 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> index 5550e4a2fb10..dc1562974870 100644
> --- a/eclass/acct-group.eclass
> +++ b/eclass/acct-group.eclass
> @@ -80,7 +80,7 @@ S=${WORKDIR}
>  
>  
>  # << Phase functions >>
> -EXPORT_FUNCTIONS pkg_pretend pkg_preinst
> +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
>  
>  # @FUNCTION: acct-group_pkg_pretend
>  # @DESCRIPTION:
> @@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
>  	fi
>  }
>  
> +# @FUNCTION: acct-group_src_install
> +# @DESCRIPTION:
> +# Installs sysusers.d file for the group.
> +acct-group_src_install() {
> +	debug-print-function ${FUNCNAME} "${@}"
> +
> +	insinto /usr/lib/sysusers.d
> +	newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
> +		printf "g\t%q\t%q\n" \
> +			"${ACCT_GROUP_NAME}" \
> +			"${ACCT_GROUP_ID/#-*/-}"
> +	)
> +}
> +
>  # @FUNCTION: acct-group_pkg_preinst
>  # @DESCRIPTION:
>  # Creates the group if it does not exist yet.
> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
> index e82f3c56dbbe..f9772c3cb111 100644
> --- a/eclass/acct-user.eclass
> +++ b/eclass/acct-user.eclass
> @@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
>  # @FUNCTION: acct-user_src_install
>  # @DESCRIPTION:
>  # Installs a keep-file into the user's home directory to ensure it is
> -# owned by the package.
> +# owned by the package, and sysusers.d file.
>  acct-user_src_install() {
>  	debug-print-function ${FUNCNAME} "${@}"
>  
> @@ -321,6 +321,20 @@ acct-user_src_install() {
>  		# created yet
>  		keepdir "${ACCT_USER_HOME}"
>  	fi
> +
> +	insinto /usr/lib/sysusers.d
> +	newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
> +		printf "u\t%q\t%q\t%q\t%q\t%q\n" \
> +			"${ACCT_USER_NAME}" \
> +			"${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
> +			"${DESCRIPTION//[:,=]/;}" \
> +			"${ACCT_USER_HOME}" \
> +			"${ACCT_USER_SHELL/#-*/-}"
> +		if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
> +			printf "m\t${ACCT_USER_NAME}\t%q\n" \
> +				"${ACCT_USER_GROUPS[@]:1}"
> +		fi
> +	)
>  }

Why these files are installed unconditionally?

Of course we have a common "small files" policy that USE flags
should not control small files in packages, such rule was designed
for common packages where:
  1) small files are insignificant disk usage compared to a whole
package;
  2) an average package takes significant time to rebuild and mass
rebuild will cause problems during USE flip.

While both arguments are valid for a common packages which provide
real software, this is not true for very special acct-* packages:
  1) They may (and usually do) have zero size of installed files,
this makes sysusers.d stuff an infinite times larger than a
whole typical acct-* package (it will still be much larger if one
will consider size of new passw/group records).
  2) acct-* packages are very fast to rebuild, so such price will
be small compared to other changes necessary when USE="systemd" is
being flipped.

So it will be reasonable to add USE="systemd" to acct-* eclasses
to control the changes proposed above.

Best regards,
Andrew Savchenko

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

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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-09-13 11:21 ` Andrew Savchenko
@ 2020-09-13 11:36   ` Marek Szuba
  2020-09-13 21:57   ` Mike Gilbert
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Marek Szuba @ 2020-09-13 11:36 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 498 bytes --]

On 2020-09-13 13:21, Andrew Savchenko wrote:

> So it will be reasonable to add USE="systemd" to acct-* eclasses
> to control the changes proposed above.

Having thought about this some more, another benefit of this approach
would be - unless I am wrong of course - that all currently installed
acct-* ebuilds will automatically pick up the eclass change of a world
update with --newuse or --changed-use. In other words, I second making
this conditional on USE=systemd.

-- 
Marecki


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-09-13 11:21 ` Andrew Savchenko
  2020-09-13 11:36   ` Marek Szuba
@ 2020-09-13 21:57   ` Mike Gilbert
  2020-09-14  9:03   ` David Seifert
  2020-09-14 10:31   ` Michał Górny
  3 siblings, 0 replies; 9+ messages in thread
From: Mike Gilbert @ 2020-09-13 21:57 UTC (permalink / raw
  To: Gentoo Dev

On Sun, Sep 13, 2020 at 7:21 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
>
> On Sat, 29 Aug 2020 21:53:45 +0200 Michał Górny wrote:
> > Thanks to David Michael for the initial patch and upstream fixes.
> >
> > Signed-off-by: Michał Górny <mgorny@gentoo.org>
> > ---
> >  eclass/acct-group.eclass | 16 +++++++++++++++-
> >  eclass/acct-user.eclass  | 16 +++++++++++++++-
> >  2 files changed, 30 insertions(+), 2 deletions(-)
> >
> > diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> > index 5550e4a2fb10..dc1562974870 100644
> > --- a/eclass/acct-group.eclass
> > +++ b/eclass/acct-group.eclass
> > @@ -80,7 +80,7 @@ S=${WORKDIR}
> >
> >
> >  # << Phase functions >>
> > -EXPORT_FUNCTIONS pkg_pretend pkg_preinst
> > +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
> >
> >  # @FUNCTION: acct-group_pkg_pretend
> >  # @DESCRIPTION:
> > @@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
> >       fi
> >  }
> >
> > +# @FUNCTION: acct-group_src_install
> > +# @DESCRIPTION:
> > +# Installs sysusers.d file for the group.
> > +acct-group_src_install() {
> > +     debug-print-function ${FUNCNAME} "${@}"
> > +
> > +     insinto /usr/lib/sysusers.d
> > +     newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
> > +             printf "g\t%q\t%q\n" \
> > +                     "${ACCT_GROUP_NAME}" \
> > +                     "${ACCT_GROUP_ID/#-*/-}"
> > +     )
> > +}
> > +
> >  # @FUNCTION: acct-group_pkg_preinst
> >  # @DESCRIPTION:
> >  # Creates the group if it does not exist yet.
> > diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
> > index e82f3c56dbbe..f9772c3cb111 100644
> > --- a/eclass/acct-user.eclass
> > +++ b/eclass/acct-user.eclass
> > @@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
> >  # @FUNCTION: acct-user_src_install
> >  # @DESCRIPTION:
> >  # Installs a keep-file into the user's home directory to ensure it is
> > -# owned by the package.
> > +# owned by the package, and sysusers.d file.
> >  acct-user_src_install() {
> >       debug-print-function ${FUNCNAME} "${@}"
> >
> > @@ -321,6 +321,20 @@ acct-user_src_install() {
> >               # created yet
> >               keepdir "${ACCT_USER_HOME}"
> >       fi
> > +
> > +     insinto /usr/lib/sysusers.d
> > +     newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
> > +             printf "u\t%q\t%q\t%q\t%q\t%q\n" \
> > +                     "${ACCT_USER_NAME}" \
> > +                     "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
> > +                     "${DESCRIPTION//[:,=]/;}" \
> > +                     "${ACCT_USER_HOME}" \
> > +                     "${ACCT_USER_SHELL/#-*/-}"
> > +             if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
> > +                     printf "m\t${ACCT_USER_NAME}\t%q\n" \
> > +                             "${ACCT_USER_GROUPS[@]:1}"
> > +             fi
> > +     )
> >  }
>
> Why these files are installed unconditionally?
>
> Of course we have a common "small files" policy that USE flags
> should not control small files in packages, such rule was designed
> for common packages where:
>   1) small files are insignificant disk usage compared to a whole
> package;
>   2) an average package takes significant time to rebuild and mass
> rebuild will cause problems during USE flip.
>
> While both arguments are valid for a common packages which provide
> real software, this is not true for very special acct-* packages:
>   1) They may (and usually do) have zero size of installed files,
> this makes sysusers.d stuff an infinite times larger than a
> whole typical acct-* package (it will still be much larger if one
> will consider size of new passw/group records).
>   2) acct-* packages are very fast to rebuild, so such price will
> be small compared to other changes necessary when USE="systemd" is
> being flipped.
>
> So it will be reasonable to add USE="systemd" to acct-* eclasses
> to control the changes proposed above.

If a USE flag is introduced for this, please use something other than
"systemd". While the only existing implementation is systemd-sysusers,
there is nothing stopping someone from developing a similar tool to
apply the same configuration data.


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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-09-13 11:21 ` Andrew Savchenko
  2020-09-13 11:36   ` Marek Szuba
  2020-09-13 21:57   ` Mike Gilbert
@ 2020-09-14  9:03   ` David Seifert
  2020-09-14 10:31   ` Michał Górny
  3 siblings, 0 replies; 9+ messages in thread
From: David Seifert @ 2020-09-14  9:03 UTC (permalink / raw
  To: gentoo-dev

On Sun, 2020-09-13 at 14:21 +0300, Andrew Savchenko wrote:
> On Sat, 29 Aug 2020 21:53:45 +0200 Michał Górny wrote:
> > Thanks to David Michael for the initial patch and upstream fixes.
> > 
> > Signed-off-by: Michał Górny <mgorny@gentoo.org>
> > ---
> >  eclass/acct-group.eclass | 16 +++++++++++++++-
> >  eclass/acct-user.eclass  | 16 +++++++++++++++-
> >  2 files changed, 30 insertions(+), 2 deletions(-)
> > 
> > diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> > index 5550e4a2fb10..dc1562974870 100644
> > --- a/eclass/acct-group.eclass
> > +++ b/eclass/acct-group.eclass
> > @@ -80,7 +80,7 @@ S=${WORKDIR}
> >  
> >  
> >  # << Phase functions >>
> > -EXPORT_FUNCTIONS pkg_pretend pkg_preinst
> > +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
> >  
> >  # @FUNCTION: acct-group_pkg_pretend
> >  # @DESCRIPTION:
> > @@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
> >  	fi
> >  }
> >  
> > +# @FUNCTION: acct-group_src_install
> > +# @DESCRIPTION:
> > +# Installs sysusers.d file for the group.
> > +acct-group_src_install() {
> > +	debug-print-function ${FUNCNAME} "${@}"
> > +
> > +	insinto /usr/lib/sysusers.d
> > +	newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
> > +		printf "g\t%q\t%q\n" \
> > +			"${ACCT_GROUP_NAME}" \
> > +			"${ACCT_GROUP_ID/#-*/-}"
> > +	)
> > +}
> > +
> >  # @FUNCTION: acct-group_pkg_preinst
> >  # @DESCRIPTION:
> >  # Creates the group if it does not exist yet.
> > diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
> > index e82f3c56dbbe..f9772c3cb111 100644
> > --- a/eclass/acct-user.eclass
> > +++ b/eclass/acct-user.eclass
> > @@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
> >  # @FUNCTION: acct-user_src_install
> >  # @DESCRIPTION:
> >  # Installs a keep-file into the user's home directory to ensure it
> > is
> > -# owned by the package.
> > +# owned by the package, and sysusers.d file.
> >  acct-user_src_install() {
> >  	debug-print-function ${FUNCNAME} "${@}"
> >  
> > @@ -321,6 +321,20 @@ acct-user_src_install() {
> >  		# created yet
> >  		keepdir "${ACCT_USER_HOME}"
> >  	fi
> > +
> > +	insinto /usr/lib/sysusers.d
> > +	newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
> > +		printf "u\t%q\t%q\t%q\t%q\t%q\n" \
> > +			"${ACCT_USER_NAME}" \
> > +			"${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
> > +			"${DESCRIPTION//[:,=]/;}" \
> > +			"${ACCT_USER_HOME}" \
> > +			"${ACCT_USER_SHELL/#-*/-}"
> > +		if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
> > +			printf "m\t${ACCT_USER_NAME}\t%q\n" \
> > +				"${ACCT_USER_GROUPS[@]:1}"
> > +		fi
> > +	)
> >  }
> 
> Why these files are installed unconditionally?
> 
> Of course we have a common "small files" policy that USE flags
> should not control small files in packages, such rule was designed
> for common packages where:
>   1) small files are insignificant disk usage compared to a whole
> package;
>   2) an average package takes significant time to rebuild and mass
> rebuild will cause problems during USE flip.
> 
> While both arguments are valid for a common packages which provide
> real software, this is not true for very special acct-* packages:
>   1) They may (and usually do) have zero size of installed files,
> this makes sysusers.d stuff an infinite times larger than a
> whole typical acct-* package (it will still be much larger if one
> will consider size of new passw/group records).

Using a multiplicative factor here seems purely for trying to make an
argument. Any filesystem space taken here seems negligible.

>   2) acct-* packages are very fast to rebuild, so such price will
> be small compared to other changes necessary when USE="systemd" is
> being flipped.
> 
> So it will be reasonable to add USE="systemd" to acct-* eclasses
> to control the changes proposed above.

Why not add these paths to INSTALL_MASK to ease the burden on the number
of installed files?

There's another argument to be made: every USE flag added potentially
increases the complexity of the depgraph. Given the tradeoffs, I'm
willing to accept a tiny file more here.



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

* Re: [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files
  2020-09-13 11:21 ` Andrew Savchenko
                     ` (2 preceding siblings ...)
  2020-09-14  9:03   ` David Seifert
@ 2020-09-14 10:31   ` Michał Górny
  3 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2020-09-14 10:31 UTC (permalink / raw
  To: gentoo-dev, Andrew Savchenko

Dnia September 13, 2020 11:21:28 AM UTC, Andrew Savchenko <bircoph@gentoo.org> napisał(a):
>On Sat, 29 Aug 2020 21:53:45 +0200 Michał Górny wrote:
>> Thanks to David Michael for the initial patch and upstream fixes.
>> 
>> Signed-off-by: Michał Górny <mgorny@gentoo.org>
>> ---
>>  eclass/acct-group.eclass | 16 +++++++++++++++-
>>  eclass/acct-user.eclass  | 16 +++++++++++++++-
>>  2 files changed, 30 insertions(+), 2 deletions(-)
>> 
>> diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
>> index 5550e4a2fb10..dc1562974870 100644
>> --- a/eclass/acct-group.eclass
>> +++ b/eclass/acct-group.eclass
>> @@ -80,7 +80,7 @@ S=${WORKDIR}
>>  
>>  
>>  # << Phase functions >>
>> -EXPORT_FUNCTIONS pkg_pretend pkg_preinst
>> +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
>>  
>>  # @FUNCTION: acct-group_pkg_pretend
>>  # @DESCRIPTION:
>> @@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
>>  	fi
>>  }
>>  
>> +# @FUNCTION: acct-group_src_install
>> +# @DESCRIPTION:
>> +# Installs sysusers.d file for the group.
>> +acct-group_src_install() {
>> +	debug-print-function ${FUNCNAME} "${@}"
>> +
>> +	insinto /usr/lib/sysusers.d
>> +	newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
>> +		printf "g\t%q\t%q\n" \
>> +			"${ACCT_GROUP_NAME}" \
>> +			"${ACCT_GROUP_ID/#-*/-}"
>> +	)
>> +}
>> +
>>  # @FUNCTION: acct-group_pkg_preinst
>>  # @DESCRIPTION:
>>  # Creates the group if it does not exist yet.
>> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
>> index e82f3c56dbbe..f9772c3cb111 100644
>> --- a/eclass/acct-user.eclass
>> +++ b/eclass/acct-user.eclass
>> @@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
>>  # @FUNCTION: acct-user_src_install
>>  # @DESCRIPTION:
>>  # Installs a keep-file into the user's home directory to ensure it
>is
>> -# owned by the package.
>> +# owned by the package, and sysusers.d file.
>>  acct-user_src_install() {
>>  	debug-print-function ${FUNCNAME} "${@}"
>>  
>> @@ -321,6 +321,20 @@ acct-user_src_install() {
>>  		# created yet
>>  		keepdir "${ACCT_USER_HOME}"
>>  	fi
>> +
>> +	insinto /usr/lib/sysusers.d
>> +	newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
>> +		printf "u\t%q\t%q\t%q\t%q\t%q\n" \
>> +			"${ACCT_USER_NAME}" \
>> +			"${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
>> +			"${DESCRIPTION//[:,=]/;}" \
>> +			"${ACCT_USER_HOME}" \
>> +			"${ACCT_USER_SHELL/#-*/-}"
>> +		if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
>> +			printf "m\t${ACCT_USER_NAME}\t%q\n" \
>> +				"${ACCT_USER_GROUPS[@]:1}"
>> +		fi
>> +	)
>>  }
>
>Why these files are installed unconditionally?
>
>Of course we have a common "small files" policy that USE flags
>should not control small files in packages, such rule was designed
>for common packages where:
>  1) small files are insignificant disk usage compared to a whole
>package;
>  2) an average package takes significant time to rebuild and mass
>rebuild will cause problems during USE flip.
>
>While both arguments are valid for a common packages which provide
>real software, this is not true for very special acct-* packages:
>  1) They may (and usually do) have zero size of installed files,
>this makes sysusers.d stuff an infinite times larger than a
>whole typical acct-* package (it will still be much larger if one
>will consider size of new passw/group records).

Did you realize that your mail is infinite times larger than if you never wrote it? 

>  2) acct-* packages are very fast to rebuild, so such price will
>be small compared to other changes necessary when USE="systemd" is
>being flipped.

The price of reading it is also infinite times larger. Not to mention actually addressing it.

>
>So it will be reasonable to add USE="systemd" to acct-* eclasses
>to control the changes proposed above.
>
>Best regards,
>Andrew Savchenko


--
Best regards, 
Michał Górny


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

end of thread, other threads:[~2020-09-14 10:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-29 19:53 [gentoo-dev] [PATCH] acct-*.eclass: Create sysusers.d files Michał Górny
2020-08-29 20:05 ` Alexey Sokolov
2020-08-29 20:08   ` Michał Górny
2020-08-31 13:03 ` Marek Szuba
2020-09-13 11:21 ` Andrew Savchenko
2020-09-13 11:36   ` Marek Szuba
2020-09-13 21:57   ` Mike Gilbert
2020-09-14  9:03   ` David Seifert
2020-09-14 10:31   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox