Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount directories #1051

Merged
merged 3 commits into from Jun 14, 2023

Conversation

floppym
Copy link
Contributor

@floppym floppym commented Jun 6, 2023

@floppym floppym force-pushed the bug890812-portage-tmpdir-automount branch 2 times, most recently from 4ea5141 to afe5f7e Compare June 6, 2023 18:53
@floppym
Copy link
Contributor Author

floppym commented Jun 8, 2023

If anyone wants to test this, you can set up an automount using systemd via an fstab entry like this:

tmpfs /path/to/mount tmpfs mode=0770,uid=root,gid=portage,x-systemd.automount 0 0

Then run systemctl daemon-reload and systemctl start path-to-mount.automount.

@thesamesam
Copy link
Member

I'll test this out tomorrow, thank you!

@thesamesam
Copy link
Member

thesamesam commented Jun 13, 2023

If anyone wants to test this, you can set up an automount using systemd via an fstab entry like this:

tmpfs /path/to/mount tmpfs mode=0770,uid=root,gid=portage,x-systemd.automount 0 0

Then run systemctl daemon-reload and systemctl start path-to-mount.automount.

The patch lgtm, but I couldn't reproduce the bug with:

tmpfs /mnt/testing-this-bug tmpfs mode=0770,uid=root,gid=portage,x-systemd.automount 0 0

I could see this when I start the automount:

systemd-1 on /mnt/testing-this-bug type autofs (rw,relatime,fd=60,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)

And after Portage tries to use it with PORTAGE_TMPDIR=/mnt/testing-this-bug emerge -v1 google-chrome:

tmpfs on /mnt/testing-this-bug type tmpfs (rw,relatime,mode=770,gid=250,x-systemd.automount)

The merge succeeded.

@floppym
Copy link
Contributor Author

floppym commented Jun 13, 2023

To reproduce the original issue, I guess you would need to include "/portage" in the mount point. For example:

tmpfs /mnt/testing-this-bug/portage tmpfs mode=0770,uid=root,gid=portage,x-systemd.automount 0 0

Then, set PORTAGE_TMPDIR=/mnt/testing-this-bug

@thesamesam
Copy link
Member

Ah, thanks! I should've clocked that. Let me try.

Copy link
Member

@thesamesam thesamesam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced, thanks!

It might be nice to put that in the commit message but it's not a big deal if you object.

@floppym
Copy link
Contributor Author

floppym commented Jun 13, 2023

Can do.

Calling os.access() on ${PORTAGE_TMPDIR}/portage will not trigger any
automount that the user may have configured there.

Instead, just try to create a file and catch PermissionError.

Bug: https://bugs.gentoo.org/890812
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
If DISTDIR is an automount, os.stat() will not trigger it.
Just try to create a file instead.

Bug: https://bugs.gentoo.org/485100
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
@floppym floppym force-pushed the bug890812-portage-tmpdir-automount branch from afe5f7e to 62906c2 Compare June 14, 2023 19:23
@gentoo-bot gentoo-bot merged commit 62906c2 into gentoo:master Jun 14, 2023
16 checks passed
@floppym floppym deleted the bug890812-portage-tmpdir-automount branch June 14, 2023 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants