Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 864160 - sys-apps/portage-3.0.34 getbinpkg uses pwd for fetching and then fails to copy the fetched file
Summary: sys-apps/portage-3.0.34 getbinpkg uses pwd for fetching and then fails to cop...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 866135 (view as bug list)
Depends on:
Blocks: 866087
  Show dependency tree
 
Reported: 2022-08-07 08:23 UTC by Nowa Ammerlaan
Modified: 2022-09-09 10:56 UTC (History)
8 users (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 Nowa Ammerlaan gentoo-dev 2022-08-07 08:23:13 UTC
With portage version 3.0.34 I can no longer use FEATURES="getbinpkg". Emerge starts to download the file in the current working directory (which feels wrong in the first place). And then fails to move the file to PKGDIR (permission denied).

For example, I start my emerge of ghostscript-gpl in /tmp/. I now get a folder /tmp/app-text/ghostscript-gpl with the following permissions:

andrew-gentoo-pc /tmp # ls -la /tmp/app-text/ghostscript-gpl
total 18900
drwxr-xr-x 2 root root       60 Aug  7 10:12 .
drwxr-xr-x 3 root root       60 Aug  7 10:12 ..
-rw-r--r-- 1 root root 19349642 Apr 16 13:08 ghostscript-gpl-9.55.0-r1-3.xpak.partial

Note only write perms for root. This is not inherited from /tmp/ since it has write perms for everyone.


The emerge now fails with the following error:

>>> Emerging binary (1 of 3) app-text/ghostscript-gpl-9.55.0-r1::gentoo
* Fetching in the background:
* app-text/ghostscript-gpl/ghostscript-gpl-9.55.0-r1-3.xpak.partial
* To view fetch progress, run in another terminal:
* tail -f /var/log/emerge-fetch.log
!!! copy app-text/ghostscript-gpl/ghostscript-gpl-9.55.0-r1-3.xpak.partial -> /home/andrew/NAS/binpkgs/app-text/ghostscript-gpl/ghostscript-gpl-9.55.0-r1-1.xpak failed.
!!! [Errno 13] Permission denied: b'/home/andrew/NAS/binpkgs/app-text/ghostscript-gpl/ghostscript-gpl-9.55.0-r1-1.xpak#new'
Exception in callback AsynchronousTask._exit_listener_cb(<bound method...7f1740d68640>>)
handle: <Handle AsynchronousTask._exit_listener_cb(<bound method...7f1740d68640>>)>
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/lib/python3.10/site-packages/_emerge/AsynchronousTask.py", line 210, in _exit_listener_cb
listener(self)
File "/usr/lib/python3.10/site-packages/_emerge/BinpkgPrefetcher.py", line 48, in _verifier_exit
self._bintree.inject(self.pkg.cpv, filename=self.pkg_path)
File "/usr/lib/python3.10/site-packages/portage/dbapi/bintree.py", line 1669, in inject
_movefile(filename, new_filename, mysettings=self.settings)
File "/usr/lib/python3.10/site-packages/portage/__init__.py", line 596, in _movefile
raise portage.exception.PortageException(f"mv '{src}' '{dest}'")
portage.exception.PortageException: mv 'app-text/ghostscript-gpl/ghostscript-gpl-9.55.0-r1-3.xpak.partial' '/home/andrew/NAS/binpkgs/app-text/ghostscript-gpl/ghostscript-gpl-9.55.0-r1-1.xpak'
zsh: terminated  emerge -1 -j1 ghostscript-gpl

The perms on the PKGDIR are:

andrew-gentoo-pc /tmp # ls -la /home/andrew/NAS/binpkgs/app-text/ghostscript-gpl
total 18924
drwxrwxr-x 1 root portage     4096 Aug  7 10:12 .
drwxrwxr-x 1 root portage     4096 Aug  7 09:18 ..
-rw-rw-r-- 1 root portage 19368112 Apr 17 18:58 ghostscript-gpl-9.56.1-1.xpak

Note the write perms for everyone in the portage group. The PKGDIR works just fine for xpak's that are already on there. New xpak's built on this machine get copied to the PKGDIR without problems. Only new xpak's that are fetched from a remote binhost produce this permission error.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-08-23 15:32:58 UTC
*** Bug 866135 has been marked as a duplicate of this bug. ***
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-04 01:49:58 UTC
Please test the fix at https://github.com/gentoo/portage/pull/896.
Comment 3 Nowa Ammerlaan gentoo-dev 2022-09-05 13:37:15 UTC
(In reply to Sam James from comment #2)
> Please test the fix at https://github.com/gentoo/portage/pull/896.

Seems to work for me. It fixes the problem and I have (so far) not experienced any side-effects.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-09 10:43:44 UTC
Fixed in https://github.com/gentoo/portage/pull/893.

commit fa901a6510c4a5f72dec6aad86db6fe7efd6e7b3 (HEAD -> master, origin/master, origin/HEAD)
Author: Sheng Yu <syu.os@protonmail.com>
Date:   Tue Sep 6 14:38:27 2022 -0400

    Add BUILD_ID to metadata during binary packaging

    Also create placeholder for new multi-instance package before actually
    packaging to avoid race.

    Signed-off-by: Sheng Yu <syu.os@protonmail.com>
    Closes: https://github.com/gentoo/portage/pull/893
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

commit 1d94992a2df2b5cc963c26c7978a899dc642deb1
Author: Sheng Yu <syu.os@protonmail.com>
Date:   Thu Sep 1 10:44:55 2022 -0400

    Move all files into basename/DATA structure

    Signed-off-by: Sheng Yu <syu.os@protonmail.com>
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

commit 020feffb39cd6c4c68a4a81be6ccd2426b062e8d
Author: Sheng Yu <syu.os@protonmail.com>
Date:   Fri Aug 19 16:40:59 2022 -0400

    Add gpkg-sign tool to sign exist GPKG files.

    Signed-off-by: Sheng Yu <syu.os@protonmail.com>
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

commit 52411290c67535d94c7b20fa996ae7108014adfb
Author: Sheng Yu <syu.os@protonmail.com>
Date:   Fri Aug 19 16:24:59 2022 -0400

    Detect binary package format if not in database

    Signed-off-by: Sheng Yu <syu.os@protonmail.com>
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
Comment 5 Larry the Git Cow gentoo-dev 2022-09-09 10:56:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06bf8d495327ebb5718821a27622f1b7eb944943

commit 06bf8d495327ebb5718821a27622f1b7eb944943
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-09 10:55:57 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-09 10:55:57 +0000

    sys-apps/portage: add 3.0.36
    
    Closes: https://bugs.gentoo.org/865905
    Closes: https://bugs.gentoo.org/864160
    Closes: https://bugs.gentoo.org/866087
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.36.ebuild | 273 +++++++++++++++++++++++++++++++++
 2 files changed, 274 insertions(+)