Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 124440 - webapp.eclass calls emerge
Summary: webapp.eclass calls emerge
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Other
: Highest critical (vote)
Assignee: Gentoo Web Application Packages Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 127144
  Show dependency tree
 
Reported: 2006-02-28 10:27 UTC by Alec Warner
Modified: 2006-12-31 11:29 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
webapp-cleaner (webapp-cleaner,2.65 KB, text/plain)
2006-07-03 13:24 UTC, Renat Lumpau (RETIRED)
Details
webapp.eclass_emerge.patch (webapp.eclass_emerge.patch,1.13 KB, patch)
2006-07-03 13:26 UTC, Renat Lumpau (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Warner (RETIRED) archtester gentoo-dev Security 2006-02-28 10:27:45 UTC
You cannot call emege in any ebuild or eclass.  It is not safe as locking is not used everywhere and there are races in certain areas still.
Comment 1 Renat Lumpau (RETIRED) gentoo-dev 2006-02-28 10:28:40 UTC
thanks for reporting
Comment 2 SpanKY gentoo-dev 2006-02-28 20:55:32 UTC
> You cannot call emege in any ebuild or eclass.  It is not safe as locking is
> not used everywhere and there are races in certain areas still.

not only that, but emerge also utilizes environment pollution to pass information, and the sandbox gets very very pissed
Comment 3 Stuart Herbert (RETIRED) gentoo-dev 2006-03-01 01:44:25 UTC
(In reply to comment #2)
> not only that, but emerge also utilizes environment pollution to pass
> information, and the sandbox gets very very pissed

Do you have an example demonstrating how this breaks the sandbox?  I'm not aware of anyone ever having a problem installing a web-based app because of the interaction between the environment pollution and the sandbox.

Best regards,
Stu
Comment 4 Stuart Herbert (RETIRED) gentoo-dev 2006-03-01 01:47:09 UTC
(In reply to comment #0)
> You cannot call emege in any ebuild or eclass.  It is not safe as locking is
> not used everywhere and there are races in certain areas still.

I believe we've been able to get away with this so far because webapps are at the bottom of the resolver tree, so to speak.  Can you help me out by providing an example of where a missing lock or an existing race condition causes a problem with the way we're doing this?

Do you have any suggestions on how we can switch away from calling emerge?

Best regards,
Stu
Comment 5 Stuart Herbert (RETIRED) gentoo-dev 2006-03-01 05:02:27 UTC
I have a suggestion that might solve this.

We can introduce a new tool called webapp-cleaner.  Instead of calling emerge -C from the eclass, we'll call 'webapp-cleaner --check-if-clean-required' instead.  This mode will output a message if the user has web-based applications that need removing, and will prompt the user to run 'webapp-cleaner --clean ${PN}' for themselves.

webapp-cleaner --clean will remove all installed web-based apps that have *not* been installed using webapp-config, by building up a call to emerge -C.

This solution moves the emerge -C call out from the eclass into a tool that the user runs outside Portage.  I believe that would satisfy all parties?

Best regards,
Stu
Comment 6 solar (RETIRED) gentoo-dev 2006-03-01 05:07:49 UTC
I think you can safely unmerge files without the need of using portage at all.
It would take a little effort. But not so much.
I've been over this with the portage team before about calling emerge from within 
an ebuild. You are the first guy to take the stance of saying it's a QA problem. 
While it's not ideal it can be done correctly by exporting the right variables.
Comment 7 Ciaran McCreesh 2006-03-01 09:53:24 UTC
(In reply to comment #5)
> This solution moves the emerge -C call out from the eclass into a tool that the
> user runs outside Portage.  I believe that would satisfy all parties?

Works for me.
Comment 8 Gunnar Wrobel (RETIRED) gentoo-dev 2006-04-20 16:03:55 UTC
*** Bug 127144 has been marked as a duplicate of this bug. ***
Comment 9 Renat Lumpau (RETIRED) gentoo-dev 2006-07-03 13:24:54 UTC
Created attachment 90810 [details]
webapp-cleaner
Comment 10 Renat Lumpau (RETIRED) gentoo-dev 2006-07-03 13:26:17 UTC
Created attachment 90811 [details, diff]
webapp.eclass_emerge.patch
Comment 11 Renat Lumpau (RETIRED) gentoo-dev 2006-07-03 13:28:13 UTC
I've attached webapp-cleaner and a corresponding patch to webapp.eclass. If this looks sane, I'd like to commit both soon.
Comment 12 Renat Lumpau (RETIRED) gentoo-dev 2006-07-19 15:38:48 UTC
webapp-cleaner is part of webapp-config-1.50.15
Comment 13 Elfyn McBratney (beu) (RETIRED) gentoo-dev 2006-11-20 04:48:34 UTC
Ping?  Any progress on this?
Comment 14 Elfyn McBratney (beu) (RETIRED) gentoo-dev 2006-11-20 04:52:01 UTC
What I should have noted in comment #13 is that this is still causing problems as the eclass is still calling emerge...
Comment 15 Stuart Herbert (RETIRED) gentoo-dev 2006-11-20 05:33:03 UTC
We are currently waiting for a new version of webapp-config to be released (plus the 30 days required to get it stable).

Best regards,
Stu
Comment 16 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-11-30 17:53:32 UTC
The ~arch version of portage causes locking issues, since the parent emerge locks the vdb, and then in the eclass another emerge is executed, which then blocks waiting for the parent.  This is a deadlock condition.

This bug blocks the stabling of that version of portage and breaks webapps for ~arch users.

Adding dev-portage to the CC

Webapp team, how is your replacement coming along?
Comment 17 Gunnar Wrobel (RETIRED) gentoo-dev 2006-12-05 08:52:52 UTC
I restarted webapp-config development now and will try to fix this asap. 
Comment 18 Zac Medico gentoo-dev 2006-12-23 03:55:34 UTC
(In reply to comment #16)
> The ~arch version of portage causes locking issues, since the parent emerge
> locks the vdb, and then in the eclass another emerge is executed, which then
> blocks waiting for the parent.  This is a deadlock condition.

As a workaround this, the eclass can remove ${ROOT}/var/db/.pkg.portage_lockfile before calling emerge.  Yes, it defeats the whole purpose of the lock, but it's  probably a better alternative than the deadlock that users are currently exposed to.
Comment 19 Ciaran McCreesh 2006-12-23 04:14:29 UTC
What? That's a horrible idea. This thing needs fixed, not worked around. Are you seriously suggesting adding yet another hack to webapp.eclass???
Comment 20 Zac Medico gentoo-dev 2006-12-24 18:16:36 UTC
(In reply to comment #19)
> What? That's a horrible idea. This thing needs fixed, not worked around. Are
> you seriously suggesting adding yet another hack to webapp.eclass???

The current behavior is broken, and removing the lock file won't really make it it any worse than it already is.  I just want the webapp.eclass maintainers to know all possible options.
Comment 21 Zac Medico gentoo-dev 2006-12-25 00:09:04 UTC
In cvs I've added an ewarn message so that users experiencing a deadlock won't have to search in order to find out what went wrong:

 * This action may result in a deadlock.  Please refer to
 * http://bugs.gentoo.org/show_bug.cgi?id=124440 for more information.
Comment 22 Renat Lumpau (RETIRED) gentoo-dev 2006-12-31 11:29:09 UTC
done