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

Bug 583754

Summary: scanelf path should respect EPREFIX
Product: Portage Development Reporter: Benda Xu <heroxbd>
Component: Core - External InteractionAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: prefix
Priority: Normal Keywords: InVCS, PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 315803    
Attachments: portage-scanelf-path.patch
portage-2.3.0-scanelf-path.patch
portage-2.3.0-scanelf-path.patch

Description Benda Xu gentoo-dev 2016-05-22 08:15:30 UTC
This patch prepends EPREFIX to the scanelf path.


Reproducible: Always
Comment 1 Benda Xu gentoo-dev 2016-05-22 08:16:42 UTC
Created attachment 434950 [details, diff]
portage-scanelf-path.patch
Comment 2 Benda Xu gentoo-dev 2016-06-02 09:42:17 UTC
Ping portage team.
Comment 3 Brian Dolbec (RETIRED) gentoo-dev 2016-06-02 10:17:58 UTC
It is normally better to use os.path.join() that simple string addtition.  That way it takes care of extra leading/trailing slashes.

Thank you for the patch.
Comment 4 Benda Xu gentoo-dev 2016-06-02 10:49:19 UTC
Created attachment 436168 [details, diff]
portage-2.3.0-scanelf-path.patch

Updated to os.path.join. Thanks!
Comment 5 Zac Medico gentoo-dev 2016-06-06 07:14:10 UTC
Note that os.path.join has "tricky" behavior for paths that begin with a slash. For example, os.path.join("/foo", "/bar") return "bar". Nice, eh? So what we really want is something like this:

   os.path.join(os.sep, EPREFIX, "usr/bin/scanelf")

or this:

   os.path.join(os.sep, EPREFIX, "usr", "bin", "scanelf")
Comment 6 Benda Xu gentoo-dev 2016-06-06 13:22:36 UTC
Created attachment 436630 [details, diff]
portage-2.3.0-scanelf-path.patch

Thanks for pointing this out, Zac. Updated.  Note that os.sep is used implicitly.
Comment 7 Zac Medico gentoo-dev 2016-06-06 16:09:03 UTC
Thanks, is in the master branch:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=54d3676d4dc90444895c99c0b6c29d6be6a25b77

(In reply to Benda Xu from comment #6)
> Note that os.sep is used implicitly.

You need to include a leading "/" in the case where EPREFIX is empty, so I fixed it up like this, which is how we do it in some other places:

   os.path.join(EPREFIX or "/", "usr/bin/scanelf")
Comment 8 Benda Xu gentoo-dev 2016-06-06 23:44:20 UTC
(In reply to Zac Medico from comment #7)
> Thanks, is in the master branch:
> 
> https://gitweb.gentoo.org/proj/portage.git/commit/
> ?id=54d3676d4dc90444895c99c0b6c29d6be6a25b77
> 
> (In reply to Benda Xu from comment #6)
> > Note that os.sep is used implicitly.
> 
> You need to include a leading "/" in the case where EPREFIX is empty, so I
> fixed it up like this, which is how we do it in some other places:
> 
>    os.path.join(EPREFIX or "/", "usr/bin/scanelf")

Thanks Zac!
Comment 9 Benda Xu gentoo-dev 2016-06-30 13:47:45 UTC
Included in 2.3.0 release.