dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/34931?usp=email )


Change subject: filesystem: fix method build_select_path_to
......................................................................

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(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/31/34931/1

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 https://gerrit.osmocom.org/c/pysim/+/34931?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ia521a7ac4c25fd3a2bc8edffdc45ec89ba4b16eb
Gerrit-Change-Number: 34931
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to