Skip to content

token: sort paths for reproducible extract#656

Merged
ZoltanFridrich merged 1 commit intop11-glue:masterfrom
katexochen:sort-paths
Aug 30, 2024
Merged

token: sort paths for reproducible extract#656
ZoltanFridrich merged 1 commit intop11-glue:masterfrom
katexochen:sort-paths

Conversation

@katexochen
Copy link
Copy Markdown
Contributor

There is no defined order in which readdir will return the entries of a directory. In practice, order can depend on inode number or similar. If we run p11-kit on different files systems with similar directory structure but different inode order the output of extract can change.

To get a stable and reproducible output, sort the paths returned by readdir before extracting.

Comment thread trust/token.c
Comment thread trust/token.c Outdated
Comment thread trust/token.c Outdated
Comment thread trust/token.c Outdated
Comment thread trust/token.c Outdated
Copy link
Copy Markdown
Contributor

@ZoltanFridrich ZoltanFridrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!
The change looks good overall, but I would like to see some things fixed before I can merge it.

@coveralls
Copy link
Copy Markdown

coveralls commented Aug 28, 2024

Coverage Status

coverage: 69.539% (+0.001%) from 69.538%
when pulling a57afab on katexochen:sort-paths
into e6c6972 on p11-glue:master.

@katexochen
Copy link
Copy Markdown
Contributor Author

The change looks good overall, but I would like to see some things fixed before I can merge it.

Thanks for your feedback, I tried to incorporate the requested changes. Let me know if I overlooked something. :)

Copy link
Copy Markdown
Contributor

@ZoltanFridrich ZoltanFridrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ZoltanFridrich
Copy link
Copy Markdown
Contributor

@katexochen please rebase it to master so I can merge.

There is no defined order in which readdir will return the entries
of a directory. In practice, order can depend on inode number or
similar. If we run p11-kit on different files systems with similar
directory structure but different inode order the output of extract
can change.

To get a stable and reproducible output, sort the paths returned by
readdir before extracting.

Co-authored-by: Tom Dohrmann <erbse.13@gmx.de>
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
@ZoltanFridrich ZoltanFridrich merged commit aedf4d9 into p11-glue:master Aug 30, 2024
@katexochen katexochen deleted the sort-paths branch August 30, 2024 13:51
@ueno ueno added this to the 0.25.6 milestone Sep 9, 2025
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.

4 participants