-
Notifications
You must be signed in to change notification settings - Fork 701
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
Shorten script-builds paths #8898
Conversation
Let me repeat from the bug ticket: Could a kind Windows user test if this suffices in any standard Windows install? Alternatively, could somebody tweak our CI not to shorten the path by setting CABAL_DIR to something unnaturally short? |
The other low hanging fruit for saving chars is removing the |
Another thing we probably want in this PR is detecting old-style script-build directories and relocating them. |
@bacchanalia thanks for the fix |
I didn't realize this happens inside cabal dir. In that case, I'd propose to go bold and use |
hmm maybe too much, not sure, I would want to try with different package+executable names if they are included in the path |
During this week's maintainers meeting we agreed that the prefix was a good idea and that we ought to be careful about trimming the hash in a way that can provoke collision. |
re: prefix - I think I have a good solution for this, which is to use a short fixed name for the executable, and then make a symlink to it with the (prefixed?) unmangled name of the script |
26 sounds like a good trade-off. |
iirc symlinking is not reliable in all windows systems with default configuration 😔 |
c5ec8ee
to
ab6b854
Compare
This should be ready for review now. |
actually, thought of one more thing I should fix |
79e804b
to
9adeffd
Compare
Has anyone confirmed that this actually fixes the long path problem on Windows? (Recall that CI is unable to check this because it sets |
@bacchanalia Would you mind writing down some manual QA instructions so that people may ensure that there is no regression before the next release? :) |
@Kleidukos I've been traveling, and my personal laptop died, but I should be able to get back to this by next week hopefully. |
Hello, I can be the manual QA for this if it's needed! |
@mazuschlag We'd be delighted! :) The PR hasn't been merged yet but feel free to try it once it has been merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
@bacchanalia: could you kindly set the merge_me or squash+merge_me label? |
@mergify backport 3.10 |
✅ Backports have been created
|
@mergify refresh |
✅ Pull request refreshed |
@mergify rebase |
Using a Base64 hash and truncating it to 26 characters, saves 38 chars, which helps avoid long paths issues on Windows, while still providing 130 bits of hash in order to avoid collisions. Bug haskell#8841
Putting script build products under dist-newstyle within the cache directory is unnecessary because we already control the cache directory and can ensure there are no conflicts.
Previously, the script name was sanitized in final executable name, because the executable name had to match the component name, which only allowed for a limited character set. Now we can use the actual script name in the executable name. This only lets us shorten the component name without losing clarity.
✅ Branch has been successfully rebased |
* Use shorter hash for script-builds directories Using a Base64 hash and truncating it to 26 characters, saves 38 chars, which helps avoid long paths issues on Windows, while still providing 130 bits of hash in order to avoid collisions. Bug #8841 * Use the script cache dir as the dist dir Putting script build products under dist-newstyle within the cache directory is unnecessary because we already control the cache directory and can ensure there are no conflicts. * Use the actual script name in the executable name Previously, the script name was sanitized in final executable name, because the executable name had to match the component name, which only allowed for a limited character set. Now we can use the actual script name in the executable name. This only lets us shorten the component name without losing clarity. * Add changelog entry * Reenable script tests for Windows/ghc-9.4.* (cherry picked from commit a482a63) # Conflicts: # cabal-install/src/Distribution/Client/CmdRun.hs # cabal-install/src/Distribution/Client/ProjectConfig.hs
Uhoh, the automatic backport to branch 3.10 failed. Any volunteer to push this through? Manual backport and merge conflict resolution is going to be required. |
Supposedly only two files have conflicts, from a refactoring missing on 3.10, from the looks of it. Probably rather easy to resolve (disclaimer: backports I described by these very words are still WIP after months of work by heroic developers). |
Hi, not sure if this is the place to add qa notes but i tried cabal-head with this pr and it seems it works and intended:
so we have alliviated the issue 😄 |
Co-authored-by: Mel Zuser <[email protected]> Co-authored-by: Artem Pelenitsyn <[email protected]>
you should manually remove your old caches once you no longer need them.
Bug #8841