Summary: | scanelf path should respect EPREFIX | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Benda Xu <heroxbd> |
Component: | Core - External Interaction | Assignee: | 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
2016-05-22 08:15:30 UTC
Created attachment 434950 [details, diff]
portage-scanelf-path.patch
Ping portage team. 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. Created attachment 436168 [details, diff]
portage-2.3.0-scanelf-path.patch
Updated to os.path.join. Thanks!
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") 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.
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") (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! Included in 2.3.0 release. |