Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 905223 - fowners and fperms do not accept relative pathnames
Summary: fowners and fperms do not accept relative pathnames
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 905355 907720
Blocks: 563798
  Show dependency tree
 
Reported: 2023-04-28 09:19 UTC by Ulrich Müller
Modified: 2023-12-18 05:30 UTC (History)
2 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 Ulrich Müller gentoo-dev 2023-04-28 09:19:40 UTC
PMS section 12.3.9 says about fowners and fperms:

fowners
    Acts as for chown, but takes paths relative to the image directory. Failure behaviour is EAPI dependent as per section 12.3.1.

fperms
    Acts as for chmod, but takes paths relative to the image directory. Failure behaviour is EAPI dependent as per section 12.3.1.


However, when I try "fperms 700 usr/bin/foo", it miserably fails:

>>> Install app-misc/foo-1 into /tmp/portage/app-misc/foo-1/image
 * Relative path passed to 'fperms': usr/bin/foo
 * This is unsupported. Please use 'chmod' when you need to work on files
 * outside the installation image (${ED}).
chmod: cannot access 'usr/bin/foo': No such file or directory
 * ERROR: app-misc/foo-1::local failed (install phase):
 *   fperms failed

This is also inconsistent with other helpers like insinto or dostrip, which all accept pathnames relative to ${ED}.
Comment 1 Ulrich Müller gentoo-dev 2023-04-28 09:29:53 UTC
To clarify: After printing the QA warning, these helpers continue, but interpret the pathname relative to the current working directory, which is not what the spec says.
Comment 2 Larry the Git Cow gentoo-dev 2023-04-30 19:31:52 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=6fc4a7d45798f5ef6605419c684e0ddaa2e812ef

commit 6fc4a7d45798f5ef6605419c684e0ddaa2e812ef
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2023-04-28 09:20:02 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2023-04-30 07:54:34 +0000

    fowners, fperms: Fix handling of relative pathnames
    
    PMS section 12.3.9 specifies that fowners and fperms "[take] paths
    relative to the image directory."
    
    Currently, these helpers interpret any pathnames not beginning with a
    slash as relative to the current working directory (after printing a
    QA warning). This contradicts the spec.
    
    It is also inconsistent with other helpers like insinto or dostrip,
    which expand their pathnames relative to ${ED}.
    
    Bug: https://bugs.gentoo.org/905223
    Closes: https://github.com/gentoo/portage/pull/1027
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 NEWS                       |  3 +++
 bin/ebuild-helpers/fowners | 26 ++++++++++----------------
 bin/ebuild-helpers/fperms  | 25 ++++++++++---------------
 3 files changed, 23 insertions(+), 31 deletions(-)
Comment 3 Ulrich Müller gentoo-dev 2023-11-28 09:24:12 UTC
AFAICS, the fix is included in Portage 3.0.48. Can this bug be closed?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-28 16:19:56 UTC
Oops, yes, thanks!