-
Notifications
You must be signed in to change notification settings - Fork 190
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
Use shorter hashes with CPM_SOURCE_CACHE #624
Comments
I've encountered this issue multiple times and support implementing a better solution on Windows machines than simply "movíng the project to another location." If the proposed solution turns out to be too complex, I wouldn't mind a simpler, straightforward approach. For example, limiting the hash to a fixed shorter length ( e.g. 8 ) with a cache variable ( |
Thanks for raising the issue, I definitely see how including the full hash may easily break OS limitations. As collisions can create unexpected and hard to debug issues, I currently prefer something like the first solution presented, even though it adds a bunch of code. |
@TheLartians I can create a PR and add some tests for the change |
@codeinred of course, looking forward to the PR! |
Some systems have pathname limits (eg, windows). If a project has multiple levels of nested directories, it can be easy to hit those limits, and having a 40-character hash in the pathname contributes to this problem.
Shorter hashes do increase the chance of a collision, therefore I propose the following solution:
In most cases, we can use a much shorter hash (typically 4 characters). Occasionally, a longer hash (8 or 12 characters) may be used. Very rarely will anything longer be used.
In the event of multiple collisions, where the pathname becomes too long, the user can clear the cache directory and try again (this will ensure that the version they're building with is assigned the shortest hash)
Code
We can do this with the following cmake.
Then, we can update
CPMAddPackage
to use the shorter hash. This change is minimal:The text was updated successfully, but these errors were encountered: