Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selection by DF name #118

Merged
merged 5 commits into from
Jan 10, 2018
Merged

Fix selection by DF name #118

merged 5 commits into from
Jan 10, 2018

Conversation

suttod
Copy link
Contributor

@suttod suttod commented Jan 5, 2018

DF names shall be globally uniqe within a given card. Selecting by DF
name should be made on card level instead of current DF level.

A new list has been inroduced as a static attribute of MF in order to
track each named DF.

DF names shall be globally uniqe within a given card. Selecting by DF
name should be made on card level instead of current DF level.

A new list has been inroduced as a static attribute of MF in order to
track each named DF.
@frankmorgner
Copy link
Owner

Looks OK.

Additionally, _selectFile of the MF class needs to look into the global list if selection by DF name is requested.

@suttod
Copy link
Contributor Author

suttod commented Jan 8, 2018

In my opinion it is already handled. _selectFile function of MF class just calls self.select function when selecting by DF name. self.select is inherited from DF class, and has been updated with this patch.

@frankmorgner
Copy link
Owner

I think you're right, but I need to investigate the problem with the unit test (See Travis CI result)...

@suttod
Copy link
Contributor Author

suttod commented Jan 8, 2018

Well I've investigated Travis log. The test fails because named DFs are tracked in the named_dfs static attribute of MF class. Now as test_get_and_set_card test generates different cards, two different MF instances are created with the same data. Initialization of the second one fails because of DF name collision in the global namespace of MF.

Consequence: it is not a good approach to track named DFs as a global attribute of MF, it should be moved to an instance attribute.

Now I'm a little bit confused how to do it. append remove and select are implemented in class DF, but DF doesn't track which MF it belongs to.

Maybe I could look for the parent of the current DF until it finds MF. I'll give it a try...

Named DFs can't be tracked in the global namespace of MF, because if we
do so, it is impossible to generate two different cards with the same
content.
By adding a possible self-pointer to MF prettyprint_anything function
got into an infinite loop. Printing of named DFs has been cut off.
Change named_dfs attribute to be a class property
@frankmorgner
Copy link
Owner

looks good now, thanks for looking into this.

@frankmorgner frankmorgner merged commit b0783bd into frankmorgner:master Jan 10, 2018
@suttod suttod deleted the named_df branch March 26, 2020 20:02
suttod added a commit to suttod/vsmartcard that referenced this pull request Mar 26, 2020
DF names shall be globally uniqe within a given card. Selecting by DF
name should be made on card level instead of current DF level.

A new list has been inroduced as a static attribute of MF in order to
track each named DF.

* Prevent prettyprint from infinite recursion

By adding a possible self-pointer to MF prettyprint_anything function
got into an infinite loop. Printing of named DFs has been cut off.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants