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

token: sort paths for reproducible extract #656

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

katexochen
Copy link
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.

trust/token.c Outdated Show resolved Hide resolved
trust/token.c Outdated Show resolved Hide resolved
trust/token.c Outdated Show resolved Hide resolved
trust/token.c Outdated Show resolved Hide resolved
Copy link
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

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
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
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
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 <[email protected]>
Signed-off-by: Paul Meyer <[email protected]>
@ZoltanFridrich ZoltanFridrich merged commit aedf4d9 into p11-glue:master Aug 30, 2024
14 checks passed
@katexochen katexochen deleted the sort-paths branch August 30, 2024 13:51
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.

3 participants