public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] xdg-utils.eclass: don't call binaries from ROOT
@ 2018-10-03  2:16 Mike Gilbert
  2018-10-03  7:33 ` Michał Górny
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Gilbert @ 2018-10-03  2:16 UTC (permalink / raw
  To: gentoo-dev; +Cc: freedesktop-bugs

Avoid calling binaries that may have been compiled against different
libraries or even cross-compiled for an incomatible arch.

Instead, always call the binaries installed in BROOT (/), if available.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/xdg-utils.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index fe1eef213ea4..b133de093082 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -67,7 +67,7 @@ xdg_environment_reset() {
 # Updates the .desktop files database.
 # Generates a list of mimetypes linked to applications that can handle them
 xdg_desktop_database_update() {
-	local updater="${EROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}"
+	local updater="${EPREFIX}${DESKTOP_DATABASE_UPDATE_BIN}"
 
 	if [[ ${EBUILD_PHASE} != post* ]] ; then
 		die "xdg_desktop_database_update must be used in pkg_post* phases."
@@ -88,7 +88,7 @@ xdg_desktop_database_update() {
 # Update the mime database.
 # Creates a general list of mime types from several sources
 xdg_mimeinfo_database_update() {
-	local updater="${EROOT%/}${MIMEINFO_DATABASE_UPDATE_BIN}"
+	local updater="${EPREFIX}${MIMEINFO_DATABASE_UPDATE_BIN}"
 
 	if [[ ${EBUILD_PHASE} != post* ]] ; then
 		die "xdg_mimeinfo_database_update must be used in pkg_post* phases."
-- 
2.19.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH] xdg-utils.eclass: don't call binaries from ROOT
  2018-10-03  2:16 [gentoo-dev] [PATCH] xdg-utils.eclass: don't call binaries from ROOT Mike Gilbert
@ 2018-10-03  7:33 ` Michał Górny
  2018-10-03  9:23   ` James Le Cuirot
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2018-10-03  7:33 UTC (permalink / raw
  To: gentoo-dev; +Cc: freedesktop-bugs

[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]

On Tue, 2018-10-02 at 22:16 -0400, Mike Gilbert wrote:
> Avoid calling binaries that may have been compiled against different
> libraries or even cross-compiled for an incomatible arch.
> 
> Instead, always call the binaries installed in BROOT (/), if available.

Except BROOT doesn't have to be / (that's why we made it into
a variable)!  Also, wouldn't it be sufficient to use PATH lookup here
and let the PM handle providing the correct root?

> 
> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
> ---
>  eclass/xdg-utils.eclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
> index fe1eef213ea4..b133de093082 100644
> --- a/eclass/xdg-utils.eclass
> +++ b/eclass/xdg-utils.eclass
> @@ -67,7 +67,7 @@ xdg_environment_reset() {
>  # Updates the .desktop files database.
>  # Generates a list of mimetypes linked to applications that can handle them
>  xdg_desktop_database_update() {
> -	local updater="${EROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}"
> +	local updater="${EPREFIX}${DESKTOP_DATABASE_UPDATE_BIN}"
>  
>  	if [[ ${EBUILD_PHASE} != post* ]] ; then
>  		die "xdg_desktop_database_update must be used in pkg_post* phases."
> @@ -88,7 +88,7 @@ xdg_desktop_database_update() {
>  # Update the mime database.
>  # Creates a general list of mime types from several sources
>  xdg_mimeinfo_database_update() {
> -	local updater="${EROOT%/}${MIMEINFO_DATABASE_UPDATE_BIN}"
> +	local updater="${EPREFIX}${MIMEINFO_DATABASE_UPDATE_BIN}"
>  
>  	if [[ ${EBUILD_PHASE} != post* ]] ; then
>  		die "xdg_mimeinfo_database_update must be used in pkg_post* phases."

-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH] xdg-utils.eclass: don't call binaries from ROOT
  2018-10-03  7:33 ` Michał Górny
@ 2018-10-03  9:23   ` James Le Cuirot
  2018-10-03 12:05     ` Mike Gilbert
  0 siblings, 1 reply; 4+ messages in thread
From: James Le Cuirot @ 2018-10-03  9:23 UTC (permalink / raw
  To: gentoo-dev

On Wed, 03 Oct 2018 09:33:53 +0200
Michał Górny <mgorny@gentoo.org> wrote:

> On Tue, 2018-10-02 at 22:16 -0400, Mike Gilbert wrote:
> > Avoid calling binaries that may have been compiled against different
> > libraries or even cross-compiled for an incomatible arch.
> > 
> > Instead, always call the binaries installed in BROOT (/), if
> > available.  
> 
> Except BROOT doesn't have to be / (that's why we made it into
> a variable)!  Also, wouldn't it be sufficient to use PATH lookup here
> and let the PM handle providing the correct root?

To be clearer, EPREFIX refers to the target host, not the build host.
The build host may have a different prefix and that is the point of
BROOT. But as mgorny says, you should just rely on the PATH. We
primarily added BROOT for cases where using the PATH wasn't viable.

> > Signed-off-by: Mike Gilbert <floppym@gentoo.org>
> > ---
> >  eclass/xdg-utils.eclass | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
> > index fe1eef213ea4..b133de093082 100644
> > --- a/eclass/xdg-utils.eclass
> > +++ b/eclass/xdg-utils.eclass
> > @@ -67,7 +67,7 @@ xdg_environment_reset() {
> >  # Updates the .desktop files database.
> >  # Generates a list of mimetypes linked to applications that can
> > handle them xdg_desktop_database_update() {
> > -	local updater="${EROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}"
> > +	local updater="${EPREFIX}${DESKTOP_DATABASE_UPDATE_BIN}"
> >  
> >  	if [[ ${EBUILD_PHASE} != post* ]] ; then
> >  		die "xdg_desktop_database_update must be used in
> > pkg_post* phases." @@ -88,7 +88,7 @@ xdg_desktop_database_update() {
> >  # Update the mime database.
> >  # Creates a general list of mime types from several sources
> >  xdg_mimeinfo_database_update() {
> > -	local updater="${EROOT%/}${MIMEINFO_DATABASE_UPDATE_BIN}"
> > +	local updater="${EPREFIX}${MIMEINFO_DATABASE_UPDATE_BIN}"
> >  
> >  	if [[ ${EBUILD_PHASE} != post* ]] ; then
> >  		die "xdg_mimeinfo_database_update must be used in
> > pkg_post* phases."


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH] xdg-utils.eclass: don't call binaries from ROOT
  2018-10-03  9:23   ` James Le Cuirot
@ 2018-10-03 12:05     ` Mike Gilbert
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Gilbert @ 2018-10-03 12:05 UTC (permalink / raw
  To: Gentoo Dev

On Wed, Oct 3, 2018 at 5:23 AM James Le Cuirot <chewi@gentoo.org> wrote:
>
> On Wed, 03 Oct 2018 09:33:53 +0200
> Michał Górny <mgorny@gentoo.org> wrote:
>
> > On Tue, 2018-10-02 at 22:16 -0400, Mike Gilbert wrote:
> > > Avoid calling binaries that may have been compiled against different
> > > libraries or even cross-compiled for an incomatible arch.
> > >
> > > Instead, always call the binaries installed in BROOT (/), if
> > > available.
> >
> > Except BROOT doesn't have to be / (that's why we made it into
> > a variable)!  Also, wouldn't it be sufficient to use PATH lookup here
> > and let the PM handle providing the correct root?
>
> To be clearer, EPREFIX refers to the target host, not the build host.
> The build host may have a different prefix and that is the point of
> BROOT. But as mgorny says, you should just rely on the PATH. We
> primarily added BROOT for cases where using the PATH wasn't viable.
>

My mistake, I shouldn't have used the word "BROOT" to describe the
root directory.

Agreed, a PATH lookup should work here.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-03 12:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-03  2:16 [gentoo-dev] [PATCH] xdg-utils.eclass: don't call binaries from ROOT Mike Gilbert
2018-10-03  7:33 ` Michał Górny
2018-10-03  9:23   ` James Le Cuirot
2018-10-03 12:05     ` Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox