Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 586632 - what is the difference between dobin and doexe?
Summary: what is the difference between dobin and doexe?
Status: IN_PROGRESS
Alias: None
Product: Documentation
Classification: Unclassified
Component: Devmanual (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Devmanual Team
URL: https://devmanual.gentoo.org/function...
Whiteboard:
Keywords: NeedPatch
Depends on:
Blocks:
 
Reported: 2016-06-21 19:36 UTC by Jonas Stein
Modified: 2022-01-19 04:23 UTC (History)
3 users (show)

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


Attachments
function-reference/install-functions: be more specific about dobin location (0001-function-reference-install-functions-be-more-specifi.patch,1.42 KB, patch)
2021-12-22 16:00 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Stein gentoo-dev 2016-06-21 19:36:24 UTC
I could not find an answer in the devmanual.
A look at
$ meld /usr/lib/portage/python2.7/ebuild-helpers/do{bin,exe} &
did not help me either.


Reproducible: Always
Comment 1 Göktürk Yüksek archtester gentoo-dev 2016-06-21 19:49:42 UTC
Referencing PMS [0]:

"""
dobin
Installs the given files into DESTTREE/bin, where DESTTREE defaults to /usr. Gives the files mode 0755 and transfers file ownership to the superuser or its equivalent on the system or installation at hand.

doexe
Installs the given files into the directory specified by the most recent exeinto call. If exeinto has not yet been called, behaviour is undefined. Files are installed by default with file mode 0755, or with the install options set by the most recent exeopts call.
"""

I agree that the explanations in devmanual are ambiguous:

"""
dobin	Install a binary

doexe	Install an executable
"""

[0] https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-14000011.3.3.9
Comment 2 Göktürk Yüksek archtester gentoo-dev 2016-11-30 05:31:29 UTC
commit 7aaea52be77d25a4adad322627d79e1d699330b5
Author:     Wim Muskee <wimmuskee@gmail.com>
AuthorDate: Thu Nov 17 20:46:35 2016 +0100
Commit:     Göktürk Yüksek <gokturk@gentoo.org>
CommitDate: Wed Nov 30 00:25:12 2016 -0500

    function-reference/install-functions: differentiate doexe and dobin better
    
    Gentoo-Bug: 586632
Comment 3 Sebastian Pipping gentoo-dev 2016-11-30 14:19:48 UTC
Cool to see progress on this!

I still wonder when to use which: Both can have their target path changed (through into/exeinto).  If the file owner is the main difference: When do I not want the binary to be owned by root?
Comment 4 Göktürk Yüksek archtester gentoo-dev 2016-12-30 02:20:07 UTC
(In reply to Sebastian Pipping from comment #3)
> Cool to see progress on this!
> 
> I still wonder when to use which: Both can have their target path changed
> (through into/exeinto).  If the file owner is the main difference: When do I
> not want the binary to be owned by root?

I don't quite get the same impression. The following variables control the paths for the corresponding helpers (from portage's implementation):

DESTREE - into
INSDESTREE - insinto
_E_EXEDESTREE - exeinto

This is what dobin does:
  install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin"

This is what doexe does:
  install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_"

where

  export DESTTREE=/usr
  export INSDESTTREE=""
  export _E_EXEDESTTREE_=""
  export INSOPTIONS="-m0644"
  export EXEOPTIONS="-m0755"

are the defaults.

Even though it's possible to manipulate DESTREE path for dobin using into, the developer has no full control due to "${ED}${DESTTREE}/bin". dobin always installs into a "bin" folder. Moreover, '-m0755' is hardcoded and cannot be modified.

In terms of the user, dobin strictly specifies who the owner is. Conversely, doexe just inherits the owner of the phase. Usually people call doexe in src_install() which runs with root privileges, so it ends up being the same thing in practice.

I think the main drive here is that dobin isn't flexible in terms of install path whereas doexe is. I think the text should be updated to reflect that. Any ideas?
Comment 5 Sebastian Pipping gentoo-dev 2017-01-15 22:42:45 UTC
Thanks for your research!


(In reply to Göktürk Yüksek from comment #4)
> I think the main drive here is that dobin isn't flexible in terms of install
> path whereas doexe is. I think the text should be updated to reflect that.
> Any ideas?

How about changing the documentation on dobin to:

  dobin
    Install an executable into subfolder `bin` of the location provided
    by `into` (resulting in `/usr/bin` by default) with mode 0755 and
    with ownership set to superuser or its equivalent on the system or
    installation at hand.
Comment 6 Ulrich Müller gentoo-dev 2021-12-22 16:00:16 UTC
Created attachment 760068 [details, diff]
function-reference/install-functions: be more specific about dobin location

Sorry for the delay. How about attached patch?
Comment 7 Larry the Git Cow gentoo-dev 2022-01-17 16:52:57 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=59830bf240718914323abcd7e77260e7a2858080

commit 59830bf240718914323abcd7e77260e7a2858080
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-12-22 15:56:47 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-01-17 16:52:09 +0000

    function-reference/install-functions: be more specific about dobin location
    
    Bug: https://bugs.gentoo.org/586632
    Suggested-by: Sebastian Pipping <sping@gentoo.org>
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 function-reference/install-functions/text.xml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Comment 8 Ulrich Müller gentoo-dev 2022-01-17 16:57:03 UTC
Can this bug be closed now?
Comment 9 Sebastian Pipping gentoo-dev 2022-01-18 19:54:02 UTC
(In reply to Ulrich Müller from comment #8)
> Can this bug be closed now?

I just re-checked the new text and to be honest the page still doesn't really help about the decision when to use which, which this ticket seems to be about at the core.

Is doexe just the more flexible big brother of dobin then?  So I would use dobin by default and only use doexe if I need to later more than just the target location of the binary (because dobin can already do that)?  That's how I personally read it with the latest changes.