dexter submitted this change.

View Change


Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
filesystem: fix method build_select_path_to

The method build_select_path_to chops off the first element of the
current path. This is done to prevent re-selection of the first file in
the current path.

Unfortunately chopping off the first element in the current path does
not work properly in a situation when the current path points to the MF.
This would chop off the first and last element in the list and the for
loop below would run 0 times.

To fix this, let's keep the first element and chop it off from the
resulting path.

Related: OS#5418
Change-Id: Ia521a7ac4c25fd3a2bc8edffdc45ec89ba4b16eb
---
M pySim/filesystem.py
1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 5950ad1..800f2cc 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -143,7 +143,6 @@
cur_fqpath = self.fully_qualified_path_fobj()
target_fqpath = target.fully_qualified_path_fobj()
inter_path = []
- cur_fqpath.pop() # drop last element (currently selected file, doesn't need re-selection
cur_fqpath.reverse()
for ce in cur_fqpath:
inter_path.append(ce)
@@ -153,7 +152,7 @@
for te2 in target_fqpath[i+1:]:
inter_path.append(te2)
# we found our common ancestor
- return inter_path
+ return inter_path[1:]
return None

def get_mf(self) -> Optional['CardMF']:

To view, visit change 34931. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ia521a7ac4c25fd3a2bc8edffdc45ec89ba4b16eb
Gerrit-Change-Number: 34931
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged