From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: fam@euphon.net, berrange@redhat.com,
Robert Foley <robert.foley@linaro.org>,
stefanb@linux.vnet.ibm.com, richard.henderson@linaro.org,
qemu-devel@nongnu.org, f4bug@amsat.org, cota@braap.org,
stefanha@redhat.com, marcandre.lureau@redhat.com,
pbonzini@redhat.com, aurelien@aurel32.net
Subject: Re: [PATCH v2 02/12] tests/docker: better handle symlinked libs
Date: Fri, 31 Jan 2020 16:48:28 +0000 [thread overview]
Message-ID: <8736bv8tcz.fsf@linaro.org> (raw)
In-Reply-To: <8a1eb0c0-9fe4-0b6b-c1ca-28f48ec89512@redhat.com>
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> On 1/30/20 12:32 PM, Alex Bennée wrote:
>> When we are copying we want to ensure we grab the first
>> resolution (the found in path section). However even that binary might
>> be a symlink so lets make sure we chase the symlinks to copy the right
>> binary to where it can be found.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>> tests/docker/docker.py | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
>> index 31d8adf836..7dfca63fe4 100755
>> --- a/tests/docker/docker.py
>> +++ b/tests/docker/docker.py
>> @@ -109,7 +109,7 @@ def _get_so_libs(executable):
>> ensure theright data is copied."""
>> libs = []
>> - ldd_re = re.compile(r"(/.*/)(\S*)")
>> + ldd_re = re.compile(r"(?:\S+ => )?(\S*) \(:?0x[0-9a-f]+\)")
>> try:
>> ldd_output = subprocess.check_output(["ldd", executable]).decode('utf-8')
>> for line in ldd_output.split("\n"):
>> @@ -145,7 +145,8 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir):
>> if libs:
>> for l in libs:
>> so_path = os.path.dirname(l)
>> - _copy_with_mkdir(l, dest_dir, so_path)
>> + real_l = os.path.realpath(l)
>> + _copy_with_mkdir(real_l, dest_dir, so_path)
>>
>> def _check_binfmt_misc(executable):
>>
>
> Rob raised an issue in this patch, it appears in a separated thread:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg675307.html
If fixed it up thusly:
def _get_so_libs(executable):
"""Return a list of libraries associated with an executable.
The paths may be symbolic links which would need to be resolved to
ensure the right data is copied."""
libs = []
ldd_re = re.compile(r"(?:\S+ => )?(\S*) \(:?0x[0-9a-f]+\)")
try:
ldd_output = subprocess.check_output(["ldd", executable]).decode('utf-8')
for line in ldd_output.split("\n"):
search = ldd_re.search(line)
if search:
try:
libs.append(s.group(1))
except IndexError:
pass
except subprocess.CalledProcessError:
print("%s had no associated libraries (static build?)" % (executable))
return libs
--
Alex Bennée
next prev parent reply other threads:[~2020-01-31 16:49 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 11:32 [PATCH v2 00/12] testing/next (with build fixes!) Alex Bennée
2020-01-30 11:32 ` [PATCH v2 01/12] tests/docker: move most cross compilers to buster base Alex Bennée
2020-01-31 15:22 ` Philippe Mathieu-Daudé
2020-01-30 11:32 ` [PATCH v2 02/12] tests/docker: better handle symlinked libs Alex Bennée
2020-01-31 15:58 ` Philippe Mathieu-Daudé
2020-01-31 16:48 ` Alex Bennée [this message]
2020-01-30 11:32 ` [PATCH v2 03/12] gitlab-ci: Refresh the list of iotests Alex Bennée
2020-01-30 11:32 ` [PATCH v2 04/12] travis.yml: Install genisoimage package Alex Bennée
2020-01-30 19:04 ` Thomas Huth
2020-01-31 15:56 ` Philippe Mathieu-Daudé
2020-01-30 11:32 ` [PATCH v2 05/12] .shippable: --disable-docs for cross-compile tests Alex Bennée
2020-01-31 15:23 ` Philippe Mathieu-Daudé
2020-01-30 11:32 ` [PATCH v2 06/12] hw/hppa/Kconfig: LASI chipset requires PARALLEL port Alex Bennée
2020-01-30 11:32 ` [PATCH v2 07/12] .travis.yml: Drop superfluous use of --python=python3 parameter Alex Bennée
2020-01-30 11:32 ` [PATCH v2 08/12] .travis.yml: Add description to each job Alex Bennée
2020-01-30 19:06 ` Thomas Huth
2020-01-31 15:24 ` Philippe Mathieu-Daudé
2020-01-31 15:37 ` Thomas Huth
2020-01-30 11:32 ` [PATCH v2 09/12] .travis.yml: build documents under bionic Alex Bennée
2020-01-31 15:27 ` Philippe Mathieu-Daudé
2020-01-30 11:32 ` [PATCH v2 10/12] .travis.yml: move cache flushing to early common phase Alex Bennée
2020-01-31 15:31 ` Philippe Mathieu-Daudé
2020-01-30 11:32 ` [PATCH v2 11/12] .travis.yml: probe for number of available processors Alex Bennée
2020-01-30 19:09 ` Thomas Huth
2020-01-31 15:51 ` Philippe Mathieu-Daudé
2020-02-01 22:13 ` Ed Vielmetti
2020-01-30 11:32 ` [PATCH v2 12/12] .travis.yml: limit the arm64 target list Alex Bennée
2020-01-30 19:43 ` Thomas Huth
2020-01-31 15:55 ` Philippe Mathieu-Daudé
2020-01-31 16:14 ` Philippe Mathieu-Daudé
-- strict thread matches above, loose matches on Subject: below --
2020-01-30 14:37 [PATCH v2 02/12] tests/docker: better handle symlinked libs Robert Foley
2020-01-30 14:59 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736bv8tcz.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=cota@braap.org \
--cc=f4bug@amsat.org \
--cc=fam@euphon.net \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=robert.foley@linaro.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).