[MERGED] osmo-gsm-tester[master]: bts_osmotrx: Fix mkdtemp use in python < 3.5

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Sep 13 22:21:11 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: bts_osmotrx: Fix mkdtemp use in python < 3.5
......................................................................


bts_osmotrx: Fix mkdtemp use in python < 3.5

We are currently seeing this issues in prod setup, which uses python
3.4:

  File "/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/bts_osmotrx.py", line 44, in __init__
    self.pcu_sk_tmp_dir = tempfile.mkdtemp(None, 'ogtpcusk', None)
  File "/usr/lib/python3.4/tempfile.py", line 432, in mkdtemp
    file = _os.path.join(dir, prefix + name + suffix)
TypeError: Can't convert 'NoneType' object to str implicitly

Acording to mkdtemp man in python3:
"Changed in version 3.5: suffix, prefix, and dir may now be supplied in
bytes in order to obtain a bytes return value. Prior to this, only str
was allowed. suffix and prefix now accept and default to None to cause
an appropriate default value to be used."

This issue went unnoticed because the RnD env is running debian 9, which
probably has python version >= 3.5.

Change-Id: If3226183fe21b4820149b1d03207193dc6f139e2
---
M src/osmo_gsm_tester/bts_osmotrx.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py
index 3077b0f..6130ca9 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -41,7 +41,7 @@
         self.suite_run = suite_run
         self.conf = conf
         self.env = {}
-        self.pcu_sk_tmp_dir = tempfile.mkdtemp(None, 'ogtpcusk', None)
+        self.pcu_sk_tmp_dir = tempfile.mkdtemp('', 'ogtpcusk')
         if len(self.pcu_socket_path().encode()) > 107:
             raise log.Error('Path for pcu socket is longer than max allowed len for unix socket path (107):', self.pcu_socket_path())
 

-- 
To view, visit https://gerrit.osmocom.org/3926
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If3226183fe21b4820149b1d03207193dc6f139e2
Gerrit-PatchSet: 3
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list