Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 595030

Summary: [Future EAPI] Formalize initial working directory for all phase functions
Product: Gentoo Hosted Projects Reporter: Mike Gilbert <floppym>
Component: PMS/EAPIAssignee: Package Manager Specification <pms>
Status: RESOLVED FIXED    
Severity: normal CC: esigra, mgorny, pacho
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=595028
Whiteboard: in-eapi-8
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 174380    
Attachments: EAPI 8 has empty initial working directories in phase functions
[v2] EAPI 8 has an empty working directory in pkg_* phases

Description Mike Gilbert gentoo-dev 2016-09-24 14:57:13 UTC
PMS currently says this in section 9.1.1:

Some functions may assume that their initial working directory is set to a particular location; these are noted below. If no initial working directory is mandated, it may be set to anything and the ebuild must not rely upon a particular location for it.


I would like to request that we formally define the initial working directory for all phase functions to ensure consistent behavior across package managers. This will reduce the possibility of strange bugs that may be difficult to diagnose.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-09-24 15:15:14 UTC
I think it'd enough to define that they it must be an empty directory or something like that.
Comment 2 Mike Gilbert gentoo-dev 2016-09-24 22:25:43 UTC
(In reply to Michał Górny from comment #1)

Yeah, I think that would suffice.
Comment 3 Mike Gilbert gentoo-dev 2016-10-03 15:27:15 UTC
Portage has been updated to change to $HOME when available.
Comment 4 Ulrich Müller gentoo-dev 2021-05-23 09:49:08 UTC
Created attachment 710517 [details, diff]
EAPI 8 has empty initial working directories in phase functions

Patch for PMS, under the assumption that we would add this to EAPI 8.

Please review.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-05-23 09:59:25 UTC
Comment on attachment 710517 [details, diff]
EAPI 8 has empty initial working directories in phase functions

>diff --git a/eapi-differences.tex b/eapi-differences.tex
>index 6e0c880..6912688 100644
>--- a/eapi-differences.tex
>+++ b/eapi-differences.tex
>@@ -111,6 +111,9 @@ Use dependencies & \compactfeatureref{use-deps} &
> \t{!!}\ blockers & \compactfeatureref{bang-strength} &
>     * & Strong & Strong & Strong & Strong \\
> 
>+Working directory in functions & \compactfeatureref{phase-function-dir} &
>+    Any & Any & Any & Any & Empty \\
>+
> \t{S} to \t{WORKDIR} fallback & \compactfeatureref{s-workdir-fallback} &
>     * & Conditional & Conditional & Conditional & Conditional \\
> 
>@@ -528,6 +531,7 @@ EAPI 8 is EAPI 7 with the following changes:
> \item Bash version is 5.0, \featureref{bash-version}.
> \item Selective fetch/mirror restriction, \featureref{uri-restrict}.
> \item \t{IDEPEND}, \featureref{idepend}.
>+\item Empty default working directory in phase functions, \featureref{phase-function-dir}.
> \item Different \t{src_prepare} implementation, \featureref{src-prepare-8}.
> \item \t{PROPERTIES}, \t{RESTRICT} accumulated across eclasses, \featureref{accumulate-vars}.
> \item \t{useq} banned, \featureref{banned-commands}.

I think this could be misleading, suggesting that it applies to all phase functions.  Maybe explicitly say 'other than src_*'?
Comment 6 Ulrich Müller gentoo-dev 2021-05-24 16:01:34 UTC
Created attachment 711012 [details, diff]
[v2] EAPI 8 has an empty working directory in pkg_* phases

(In reply to Michał Górny from comment #5)
> I think this could be misleading, suggesting that it applies to all phase
> functions.  Maybe explicitly say 'other than src_*'?

Good point. Find v2 attached.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-05-24 17:33:37 UTC
(In reply to Ulrich Müller from comment #6)
> Created attachment 711012 [details, diff] [details, diff]
> [v2] EAPI 8 has an empty working directory in pkg_* phases
> 
> (In reply to Michał Górny from comment #5)
> > I think this could be misleading, suggesting that it applies to all phase
> > functions.  Maybe explicitly say 'other than src_*'?
> 
> Good point. Find v2 attached.

LGTM.