Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Gentoo: Dev

RFC: check for enewuser, enewgroup outside of pkg_setup

 

 

Gentoo dev RSS feed   Index | Next | Previous | View Threaded


phajdan.jr at gentoo

Jan 19, 2011, 7:25 AM

Post #1 of 7 (551 views)
Permalink
RFC: check for enewuser, enewgroup outside of pkg_setup

There was a discussion on irc about a package that called enewuser and
enewgroup from pkg_preinst. That made it fail on fresh install, because
the new user was needed at the src_install time (for ownership of the
installed files). However, if the user was already present on the
system, it was just a no-op, making the issue very hard to detect for
the package's maintainer or anyone who had it previously installed.

To avoid this type of problem in the future, I'd like to add the
following check:

"If enewuser or enewgroup is called from outside of pkg_setup, fail"

Initially I was thinking about a repoman check, but in theory someone
may extract code to a function called from pkg_setup, confusing the tool.

An alternative solution would be to make enewuser and enewgroup check
which ebuild phase called them, and fail if it's not pkg_setup
(important: that must happen before the check for existing user/group).

To make transition easy, we can make the error non-fatal for some time.

What do you think?
Attachments: signature.asc (0.19 KB)


mgorny at gentoo

Jan 19, 2011, 7:47 AM

Post #2 of 7 (523 views)
Permalink
Re: RFC: check for enewuser, enewgroup outside of pkg_setup [In reply to]

On Wed, 19 Jan 2011 16:25:03 +0100
"Paweł Hajdan, Jr." <phajdan.jr [at] gentoo> wrote:

> "If enewuser or enewgroup is called from outside of pkg_setup, fail"

It is useful sometimes to call it in pkg_postinst(), if the user/group
is needed at runtime and not during install-time.

--
Best regards,
Michał Górny
Attachments: signature.asc (0.19 KB)


antarus at gentoo

Jan 19, 2011, 8:38 AM

Post #3 of 7 (509 views)
Permalink
Re: RFC: check for enewuser, enewgroup outside of pkg_setup [In reply to]

On Wed, Jan 19, 2011 at 3:47 PM, Michał Górny <mgorny [at] gentoo> wrote:
> On Wed, 19 Jan 2011 16:25:03 +0100
> "Paweł Hajdan, Jr." <phajdan.jr [at] gentoo> wrote:
>
>> "If enewuser or enewgroup is called from outside of pkg_setup, fail"
>
> It is useful sometimes to call it in pkg_postinst(), if the user/group
> is needed at runtime and not during install-time.

What difference is there if you run it during setup vs postinst?

-A

>
> --
> Best regards,
> Michał Górny
>


mgorny at gentoo

Jan 19, 2011, 9:18 AM

Post #4 of 7 (508 views)
Permalink
Re: RFC: check for enewuser, enewgroup outside of pkg_setup [In reply to]

On Wed, 19 Jan 2011 16:38:10 +0000
Alec Warner <antarus [at] gentoo> wrote:

> On Wed, Jan 19, 2011 at 3:47 PM, Michał Górny <mgorny [at] gentoo>
> wrote:
> > On Wed, 19 Jan 2011 16:25:03 +0100
> > "Paweł Hajdan, Jr." <phajdan.jr [at] gentoo> wrote:
> >
> >> "If enewuser or enewgroup is called from outside of pkg_setup,
> >> fail"
> >
> > It is useful sometimes to call it in pkg_postinst(), if the
> > user/group is needed at runtime and not during install-time.
>
> What difference is there if you run it during setup vs postinst?

If the build fails or user aborts the merge, his/her system
is not junked with an unnecessary account/group.

--
Best regards,
Michał Górny
Attachments: signature.asc (0.19 KB)


vapier at gentoo

Jan 19, 2011, 2:44 PM

Post #5 of 7 (499 views)
Permalink
Re: RFC: check for enewuser, enewgroup outside of pkg_setup [In reply to]

On Wednesday, January 19, 2011 12:18:24 Michał Górny wrote:
> On Wed, 19 Jan 2011 16:38:10 +0000 Alec Warner wrote:
> > On Wed, Jan 19, 2011 at 3:47 PM, Michał Górny wrote:
> > > On Wed, 19 Jan 2011 16:25:03 +0100 Paweł Hajdan, Jr. wrote:
> > >> "If enewuser or enewgroup is called from outside of pkg_setup,
> > >> fail"
> > >
> > > It is useful sometimes to call it in pkg_postinst(), if the
> > > user/group is needed at runtime and not during install-time.
> >
> > What difference is there if you run it during setup vs postinst?
>
> If the build fails or user aborts the merge, his/her system
> is not junked with an unnecessary account/group.

this is why we allow people to pick the appropriate step. ebuilds should be
using pkg_{pre,post}inst unless the user/group is needed at src_* time.
-mike
Attachments: signature.asc (0.82 KB)


xmw at gentoo

May 12, 2012, 3:48 PM

Post #6 of 7 (220 views)
Permalink
Re: RFC: check for enewuser, enewgroup outside of pkg_setup [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 01/19/2011 11:44 PM, Mike Frysinger wrote:
> this is why we allow people to pick the appropriate step. ebuilds
> should be using pkg_{pre,post}inst unless the user/group is needed
> at src_* time. -mike

I noticed a rather annoying test inside enewuser for existence of the
provided "shell" path in the filesystem ( user.eclass lines 153-156 ).

If you want to create an user and set the shell variable to an program
you just emerge, you have to call it from pkg_postinst.

(The example was a trivial desktop manager x11-misc/trivdm in [1])

[1]
http://git.overlays.gentoo.org/gitweb/?p=dev/xmw.git;a=tree;f=x11-misc/trivdm

- --
- --
Gentoo Dev
http://xmw.de/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iF4EAREIAAYFAk+u6KAACgkQknrdDGLu8JA+awD+K7HLWLkd+6eF+uNteODtIJxC
rM46lOPUc7WDf3TXkHoA/job97V3eGMSamAHKp2+kgh7nz1z0VmmNqKxxyD26UE7
=zq6G
-----END PGP SIGNATURE-----


mgorny at gentoo

May 13, 2012, 12:15 AM

Post #7 of 7 (226 views)
Permalink
Re: RFC: check for enewuser, enewgroup outside of pkg_setup [In reply to]

On Sun, 13 May 2012 00:48:00 +0200
Michael Weber <xmw [at] gentoo> wrote:

> On 01/19/2011 11:44 PM, Mike Frysinger wrote:
> > this is why we allow people to pick the appropriate step. ebuilds
> > should be using pkg_{pre,post}inst unless the user/group is needed
> > at src_* time. -mike
>
> I noticed a rather annoying test inside enewuser for existence of the
> provided "shell" path in the filesystem ( user.eclass lines 153-156 ).
>
> If you want to create an user and set the shell variable to an program
> you just emerge, you have to call it from pkg_postinst.

If you don't need it in install-time (i.e. don't install any files
owned by it), you should indeed defer the check as late as possible.
There's no point in creating user earlier when the emerge can still
fail/be aborted.

--
Best regards,
Michał Górny
Attachments: signature.asc (0.31 KB)

Gentoo dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.