Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 692224 - app-portage/portage-utils-0.80 - add back qlop support for chroots/containers
Summary: app-portage/portage-utils-0.80 - add back qlop support for chroots/containers
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-15 16:31 UTC by Ben Kohler
Modified: 2019-10-20 10:26 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Kohler gentoo-dev 2019-08-15 16:31:17 UTC
Hello,

First, thanks for all your recent work on portage-utils and qlop in particular.  One thing that got lost in 0.80 is the ability to see inside chroots.  Is it possible to add this back, for qlop -r on 0.80?

Old (0.74) behavior:

$ qlop -c
 * sys-devel/gcc-9.2.0
     started: Thu Aug 15 11:29:37 2019
     elapsed: 51 seconds
 * www-client/firefox-68.0.2
     started: Thu Aug 15 10:25:23 2019
     elapsed: 1 hour, 5 minutes, 5 seconds
 * net-irc/irssi-1.2.1
     started: Thu Aug 15 11:30:24 2019
     elapsed: 4 seconds
     chroot:  /root/gentoo-systemd
$

Thanks!
Comment 1 Fabian Groffen gentoo-dev 2019-08-16 18:14:10 UTC
Hmmm, what do you mean with "inside chroot"?  From itside the chroot, or are you lacking ROOT support?
Comment 2 Ben Kohler gentoo-dev 2019-08-16 18:17:34 UTC
In 0.74, I could run "qlop -c" from outside the chroot, and it would see the emerges going on inside chroot.

https://gitweb.gentoo.org/proj/portage-utils.git/tree/qlop.c?id=054b993a9433a45c00086fb2841a8150d85eb437#n470

It would also (if run as root) show the chroot path by reading /proc/*/root.
Comment 3 Fabian Groffen gentoo-dev 2019-08-16 18:21:20 UTC
Yeah, I just figured, because it was looking up sandbox in the process list.
Comment 4 Fabian Groffen gentoo-dev 2019-08-16 18:30:15 UTC
I think what I can do is make qlop respect ROOT, such that it would operate like other tools that out outside the chroot but work in the chroot.  You won't get a "free" pass to see your chroot emerges from outside the chroot without help.  I can't see how to "detect" chroots, except from bringing the botched process list checking code back.  Note that some people plan on removing sandbox, so the process was unreliable.
Comment 5 Ben Kohler gentoo-dev 2019-08-16 18:34:00 UTC
Is it really that impossible?

for i in $(pgrep emerge); do readlink /proc/${i}/root; done

Is that too hacky?
Comment 6 Fabian Groffen gentoo-dev 2019-08-16 18:38:50 UTC
(In reply to Ben Kohler from comment #5)
> Is it really that impossible?
> 
> for i in $(pgrep emerge); do readlink /proc/${i}/root; done
> 
> Is that too hacky?

I guess that makes a pretty good alias or script if you want it to work...
Comment 7 Ben Kohler gentoo-dev 2019-08-16 18:41:24 UTC
Yes, if you are giving up on implementing this feature, that is what I'll do.

If you do not think you can reliably find the PID of a running emerge, this surprises me, but I won't argue about it.
Comment 8 Ben Kohler gentoo-dev 2019-08-16 18:42:23 UTC
FYI the above for loop wasn't meant to be implemented as-is, of course.

Just illustrating that it can be done.
Comment 9 Fabian Groffen gentoo-dev 2019-08-16 18:47:33 UTC
(In reply to Ben Kohler from comment #8)
> FYI the above for loop wasn't meant to be implemented as-is, of course.
> 
> Just illustrating that it can be done.

It's difficult, in particular cross-platform, the process listing code isn't nice either.

The only reason to put it in, would be to suit this particular case.
Comment 10 Ben Kohler gentoo-dev 2019-08-16 18:48:42 UTC
Ah, I wasn't thinking about other platforms.  If you can add ROOT= support, I can write the necessary wrapper on my end.

Thanks!
Comment 11 Larry the Git Cow gentoo-dev 2019-08-17 08:37:04 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=74219ab70d2a5bcad327c3795f5fa9b881d433ad

commit 74219ab70d2a5bcad327c3795f5fa9b881d433ad
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-08-17 08:35:39 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-08-17 08:35:39 +0000

    qlop: add ROOT support, bug #692224
    
    Respect ROOT when set, to ease scripting of qlop interaction with
    chroots.
    
    Bug: https://bugs.gentoo.org/692224
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 qlop.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Comment 12 Larry the Git Cow gentoo-dev 2019-10-20 10:26:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b04f542749e2fb95c627364bf58b075c164c4f6

commit 0b04f542749e2fb95c627364bf58b075c164c4f6
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-10-20 10:25:14 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-10-20 10:25:38 +0000

    app-portage/portage-utils: version bump to v0.81
    
    - 697094: qfile incorrectly matching /usr/lib
    - 697068: qlop -r not showing ongoing merges from parallel merges
    - 696078: qgrep not matching revisioned ebuilds
    - 695586: qpkg double frees and incorrect unpacking
    - 694972: qlop -r/-a speedups
    - 692224: qlop support for alternate ROOT
    - 677982: qfile report matches from prune lib registry
    
    Closes: https://bugs.gentoo.org/697094
    Closes: https://bugs.gentoo.org/697068
    Closes: https://bugs.gentoo.org/696078
    Closes: https://bugs.gentoo.org/695586
    Closes: https://bugs.gentoo.org/694972
    Closes: https://bugs.gentoo.org/692224
    Closes: https://bugs.gentoo.org/677982
    Package-Manager: Portage-2.3.76, Repoman-2.3.16
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 app-portage/portage-utils/Manifest                 |  1 +
 .../portage-utils/portage-utils-0.81.ebuild        | 87 ++++++++++++++++++++++
 2 files changed, 88 insertions(+)