Change in osmo-gsm-tester[master]: util: adds the feature to force the rpath when patching files.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Alejandro Leal gerrit-no-reply at lists.osmocom.org
Wed May 19 14:38:54 UTC 2021


Alejandro Leal has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/24272 )


Change subject: util: adds the feature to force the rpath when patching files.
......................................................................

util: adds the feature to force the rpath when patching files.

Adds a function that allows to patch the rpath of a binary with the option '--force-rpath'.

Change-Id: I2d4a105d4843c0d31d6b5d8f8d4195247b290aec
---
M src/osmo_gsm_tester/core/remote.py
M src/osmo_gsm_tester/core/util.py
2 files changed, 24 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/72/24272/1

diff --git a/src/osmo_gsm_tester/core/remote.py b/src/osmo_gsm_tester/core/remote.py
index fb446a6..95750f5 100644
--- a/src/osmo_gsm_tester/core/remote.py
+++ b/src/osmo_gsm_tester/core/remote.py
@@ -203,3 +203,17 @@
             self.dbg('Using specific patchelf from %s', patchelf_bin)
 
         self.run_remote_sync('patchelf', (patchelf_bin, '--set-rpath', paths, binary_path))
+
+    def change_elf_force_rpath(self, binary_path, paths):
+        '''
+        Change RPATH field in ELF executable binary forcing the rpath.
+        This feature can be used to tell the loader to load the trial libraries, as
+        LD_LIBRARY_PATH is disabled for paths with modified capabilities.
+        '''
+        patchelf_bin = self.remote_env.get('PATCHELF_BIN', None)
+        if not patchelf_bin:
+            patchelf_bin = 'patchelf'
+        else:
+            self.dbg('Using specific patchelf from %s', patchelf_bin)
+
+        self.run_remote_sync('patchelf', (patchelf_bin, '--force-rpath --set-rpath', paths, binary_path))
diff --git a/src/osmo_gsm_tester/core/util.py b/src/osmo_gsm_tester/core/util.py
index 691b489..32baf33 100644
--- a/src/osmo_gsm_tester/core/util.py
+++ b/src/osmo_gsm_tester/core/util.py
@@ -56,6 +56,16 @@
     proc = Process('patchelf', run_dir, ['patchelf', '--set-rpath', paths, binary])
     proc.launch_sync()
 
+def change_elf_force_rpath(binary, paths, run_dir):
+    '''
+    Change RPATH field in ELF executable binary forcing the rpath.
+    This feature can be used to tell the loaded to load the trial libraries, as
+    LD_LIBRARY_PATH is disabled for paths with modified capabilities.
+    '''
+    from .process import Process
+    proc = Process('patchelf', run_dir, ['patchelf', '--force-rpath --set-rpath', paths, binary])
+    proc.launch_sync()
+
 def ip_to_iface(ip):
     try:
         for iface in os.listdir('/sys/class/net'):

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/24272
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I2d4a105d4843c0d31d6b5d8f8d4195247b290aec
Gerrit-Change-Number: 24272
Gerrit-PatchSet: 1
Gerrit-Owner: Alejandro Leal <alejandro.leal at srs.io>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210519/9d578860/attachment.htm>


More information about the gerrit-log mailing list