Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 946279 - [Future EAPI] Revive DESTTREE
Summary: [Future EAPI] Revive DESTTREE
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Package Manager Specification
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: future-eapi
  Show dependency tree
 
Reported: 2024-12-11 17:27 UTC by konsolebox
Modified: 2025-01-20 15:51 UTC (History)
3 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 konsolebox 2024-12-11 17:27:49 UTC
Because this is ugly: dosym x-bin /usr/bin/x

It should be `dosym x-bin "${DESTTREE}/bin/x"`.

Another:

make_desktop_entry "${DESTTREE}/bin/some-binary" "Some Description" etc ...
Comment 1 Ulrich Müller gentoo-dev 2024-12-11 20:10:35 UTC
(In reply to konsolebox from comment #0)
> Because this is ugly: dosym x-bin /usr/bin/x
> 
> It should be `dosym x-bin "${DESTTREE}/bin/x"`.

dosym has always (since EAPI 0) taken a path relative to ED (or D) as its second parameter, i.e. it was never influenced by the DESTTREE variable or the "into" command.

> Another:
> 
> make_desktop_entry "${DESTTREE}/bin/some-binary" "Some Description" etc ...

Why would one specify an absolute file path there, in the first place? Standard use is to use just the program name, with lookup in PATH.

(Also, the path is incorrect, it should be "${EPREFIX}${DESTTREE}/bin/some-binary".)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-12 00:23:58 UTC
(In reply to Ulrich Müller from comment #1)
> (In reply to konsolebox from comment #0)
> > Because this is ugly: dosym x-bin /usr/bin/x
> > 
> > It should be `dosym x-bin "${DESTTREE}/bin/x"`.

This needs a bit more rationale.

> (Also, the path is incorrect, it should be
> "${EPREFIX}${DESTTREE}/bin/some-binary".)

I feel like this sort of sums up the problem(s) with desttree, even.
Comment 3 konsolebox 2024-12-12 03:10:22 UTC
(In reply to Ulrich Müller from comment #1)
> (In reply to konsolebox from comment #0)
> > Because this is ugly: dosym x-bin /usr/bin/x
> > 
> > It should be `dosym x-bin "${DESTTREE}/bin/x"`.
> 
> dosym has always (since EAPI 0) taken a path relative to ED (or D) as its
> second parameter, i.e. it was never influenced by the DESTTREE variable or
> the "into" command.

True but the target path in this instance is virtually referring to a value of DESTTREE.  It's not about dosym exactly.  Maybe dosym can accept an option that prepends DESTTREE to the "linkname" but that doesn't solve all cases that don't use dosym.

> > Another:
> > 
> > make_desktop_entry "${DESTTREE}/bin/some-binary" "Some Description" etc ...
> 
> Why would one specify an absolute file path there, in the first place?
> Standard use is to use just the program name, with lookup in PATH.

That's fair.

> (Also, the path is incorrect, it should be
> "${EPREFIX}${DESTTREE}/bin/some-binary".)

I agree.
Comment 4 konsolebox 2024-12-12 03:15:56 UTC
(In reply to Sam James from comment #2)
> (In reply to Ulrich Müller from comment #1)
> > (In reply to konsolebox from comment #0)
> > > Because this is ugly: dosym x-bin /usr/bin/x
> > > 
> > > It should be `dosym x-bin "${DESTTREE}/bin/x"`.
> 
> This needs a bit more rationale.

It's basically specifying a static value instead of a supposed dynamic one.  The "/usr" there is an assertion.  That type of coordination is a very basic bad programming practice.  At least it should be avoided when possible.

> > (Also, the path is incorrect, it should be
> > "${EPREFIX}${DESTTREE}/bin/some-binary".)
> 
> I feel like this sort of sums up the problem(s) with desttree, even.

Care to elaborate?  If it's about the length, add EDESTTREE maybe and declare it as supposedly non-mutable.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-12 03:28:32 UTC
When DESTTREE got removed, it applied inconsistently to commands and most of its friends had been removed long beforehand. While you may not like the current scheme, it is at least consistent. Introducing it would be a source of confusion both as to whether a command requires it and also where we have to try educate people about not forgetting EPREFIX.

We also strongly recommend relative symlinks these days too with EAPI 8.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-12-12 04:28:13 UTC
Do you really have a good use case for this, or does it only boil down to "I must use more variables, and sacrifice readability for laziness"?
Comment 7 konsolebox 2024-12-12 04:42:17 UTC
(In reply to Sam James from comment #5)
> When DESTTREE got removed, it applied inconsistently to commands and most of
> its friends had been removed long beforehand. While you may not like the
> current scheme, it is at least consistent.


This isn't consistent to me at all.  "/usr" may or may not be the current value used by dobin or anything that installed the binary that's being referenced.

> Introducing it would be a source
> of confusion both as to whether a command requires it and also where we have
> to try educate people about not forgetting EPREFIX.

Consistency comes first.  Whether it requires the need to educate people about the necessity to use EPREFIX should be lesser priority.

> We also strongly recommend relative symlinks these days too with EAPI 8.

Relative path resolutions can never be trusted.

Also mind giving an example that relies on this?
Comment 8 konsolebox 2024-12-12 04:45:49 UTC
(In reply to Michał Górny from comment #6)
> Do you really have a good use case for this, or does it only boil down to "I
> must use more variables, and sacrifice readability for laziness"?

This is about consistency not laziness.  "${DESTTREE}" plus quotes are literally 8 characters longer than a mere "/usr".  Relying on a three-way coordination of value's state is also not laziness but point blank bad programming practice.

Readability is also important but that too comes second to consistency.

Anything should be as simple as possible but not simpler!
Comment 9 konsolebox 2024-12-12 04:55:08 UTC
(I mean it's not about whether you're being lazy to coordinate the state of values or not.)
Comment 10 konsolebox 2024-12-12 05:29:37 UTC
(In reply to Ulrich Müller from comment #1)
> (Also, the path is incorrect, it should be
> "${EPREFIX}${DESTTREE}/bin/some-binary".)

I now consider simply specifying "some-binary" here as more proper, but come to think of it, I might have purposely left out EPREFIX there since the desktop file won't be usable unless the user chroots to the prefix directory anyway.  But I also can still be mistaken about it if make_desktop_entry doesn't create entries in "${ED}/...".

One thing for sure I examined anything related to DESTTREE like `into` first.  It's unlikely for me to have made a lazy assertion.
Comment 11 Ulrich Müller gentoo-dev 2024-12-12 07:37:44 UTC
So, we have 10 comments by now, no consensus, and Bugzilla is not a discussion forum. Please continue discussion on the gentoo-dev mailing list.

Policy reference:

https://projects.gentoo.org/pms/8/pms.html#x1-80001.3
When reporting issues, remember that this document is not the appropriate place for pushing through changes to the tree or the package manager, except where those changes are bugs.
Comment 12 Ulrich Müller gentoo-dev 2025-01-20 15:51:07 UTC
I don't see anything on the mailing lists. Closing.