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

Standardize algorithm for directory hashing #100

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Nov 20, 2024

Standardizes findings in conda/conda-build#5277.

🔎 Preview in Markdown

@jaimergp jaimergp marked this pull request as draft November 20, 2024 00:40
@jaimergp
Copy link
Contributor Author

cc @wolfv

@baszalmstra
Copy link
Contributor

In pixi we often compute these hashes in a similar way. We also normalize line endings in text files because on windows git often normalizes these as well.

@jaimergp
Copy link
Contributor Author

In pixi we often compute these hashes in a similar way. We also normalize line endings in text files because on windows git often normalizes these as well.

Nice that you mentioned this because I think I just run into that very issue: https://github.com/conda/conda-build/actions/runs/11924575237/job/33235172020?pr=5277#step:11:424

cep-00??.md Outdated

## Specification

Given a directory, recursively scan all its contents (without following symlinks) and sort them by their full path. For each entry in the contents table, compute the hash for the concatenation of:

Choose a reason for hiding this comment

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

We probably need to better specify what "sort" means, and in particular, what collation ordering we want to use. Because:

$ echo -e "aa\na-a\nab\na-b" | LC_ALL=en_US.UTF-8 sort
a-a
aa
a-b
ab

$ echo -e "aa\na-a\nab\na-b" | LC_ALL=C.UTF-8 sort
a-a
a-b
aa
ab

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like Python's sort([str, ...]), it's locale agnostic. See 378d1fd (#100)

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