Project

General

Profile

Actions

Bug #6120

open

select MF raise an exception after selecting ADF.ARA-M

Added by lynxis 7 months ago. Updated 2 months ago.

Status:
New
Priority:
Low
Assignee:
Category:
-
Target version:
-
Start date:
07/29/2023
Due date:
% Done:

0%

Spec Reference:

Description

Steps to reproduce:
Version: git/master 6c5c3f8b2b49a56b6204be83ded918bec0c5826f
Simcard: SysmocomSJA2

Welcome to pySim-shell!
pySIM-shell (MF)> select ADF.ARA-M
"" 
pySIM-shell (MF/ADF.ARA-M)> select MF
EXCEPTION of type 'RuntimeError' occurred with message: 6e00: ARA-M - Invalid class
To enable full traceback, run the following command: 'set debug true'
pySIM-shell (MF/ADF.ARA-M)> set debug true
debug - was: False
now: True
pySIM-shell (MF/ADF.ARA-M)> select MF
Traceback (most recent call last):
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/runtime.py", line 347, in select
    (data, sw) = self.rs.card._scc.select_file(f.fid)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/commands.py", line 144, in select_file
    return self._tp.send_apdu_checksw(self.cla_byte + "a4" + self.sel_ctrl + "02" + fid)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/transport/__init__.py", line 213, in send_apdu_checksw
    raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter)
pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6e00: ARA-M - Invalid class

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2399, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2852, in onecmd
    stop = func(statement)
           ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/./pySim-shell.py", line 814, in do_select
    fcp_dec = self._cmd.lchan.select(path, self._cmd)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/runtime.py", line 353, in select
    raise RuntimeError("%s: %s - %s" % (swm.sw_actual, k[0], k[1]))
RuntimeError: 6e00: ARA-M - Invalid class
EXCEPTION of type 'RuntimeError' occurred with message: 6e00: ARA-M - Invalid class


Related issues

Related to pySim - Bug #5418: one cannot run 'export' after an 'export'Resolveddexter01/25/2022

Actions
Actions #1

Updated by lynxis 7 months ago

  • Description updated (diff)
Actions #2

Updated by laforge 7 months ago

I thought we already had a redmine issue for this? The General problem seems to be that there is no universal way to leave an application after it has been selected. If there's no filesysyem in the App (like ara-m), then SELECT MF will no longer work. At least neither dexter nor I could find a way. And reseting the card means loosing state like adm pin...

Actions #3

Updated by laforge 5 months ago

  • Assignee set to lynxis
  • Priority changed from Normal to Low
Actions #4

Updated by laforge 4 months ago

  • Related to Bug #5418: one cannot run 'export' after an 'export' added
Actions #5

Updated by laforge 4 months ago

  • Assignee changed from lynxis to dexter
Actions #6

Updated by laforge 3 months ago

Hi dexter, hasn't this been adressed in some of your recent patches? Please update status of the ticket accordingly.

Actions #7

Updated by dexter 2 months ago

We have fixed the problem for the export/tree commands but not for a normal select to MF.

The fix for export/tree uses a trick. In case the currently selected application does not support a file system, it selects an application that does and from there it then selects the MF.
(see also: https://gitea.osmocom.org/sim-card/pysim/src/branch/master/pySim-shell.py#L525)

Technically we could extend this hack so that it also works with the select command. However I think it would make more sense to print an error message that informs about that fact that the selected application does not support selection of the MF, since it has no file system. We also might consider to print some message when we select an application without file system support, so that the user is aware of the fact that selecting of files is not expected to work. We shouldn't do too much automagic stuff in the background. In export/tree some magic tricks are acceptable, but I think select is a very basic command and it should be straight forward.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)