-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
building on windows fails due to symlinks in working tree #1310
Comments
Indeed, this is an issue I also suffer from whenever trying things in my Windows VM. To fix it, I remove the symlink in @EliahKagan shared that he was able to get it to work with after setting As of now, I don't have a fix except to give in and not use a symlink. This could be feasible in terms of maintenance burden, but I don't like that this implies these crates should be independent, even though they are not. The problem this is solving is that |
Yes, I have found that and some variations (one that I prefer is detailed below) to work for me. This variable is These days, though, I think it's increasingly common that people creating symlinks on Windows have his privilege, even if not running as an administrator, because Windows 10 and higher have a "developer mode" setting that Microsoft suggests using that includes this effect. (Even if running as an administrator, UAC can get in the way of symlink creation, since commands like
It can also be set as a local repository variable after cloning, if the clone is done without checking out a working tree. This is what I've used lately on Windows: gh repo clone gitoxide -- --no-checkout
cd gitoxide
git config --local core.symlinks true
git switch main
Would it be reasonable for the Edit: Added the missing |
Thanks so much for chiming in - your account has much more detail than I could ever have produced. The |
I've noticed that the problem also happens--as one would expect--when attempting to install A workaround, which can be modified according to the specific
I am curious if there are important differences in effect that I am unaware of and that should be noted. I am also curious if there is a single |
Cargo does download a compressed tar archive with the source of each crate, with all files within the crate being created by following symlinks, effectively resolving them. Thus I would assume the following works on windows:
But As Cargo uses I have thought about a solution to this a lot and thought maybe it would be best if there was a justfile target that calls a script or Rust program that copies all files from All that sounds pretty straightforward to do, what do you think, @EliahKagan? There even is space for little utilities that can easily be run with |
Yes, that is working for me Windows. That can't be made to install the version from the tip of the main branch in the GitHub repository, though, can it?
I would expect it to work if
This seems to me like a good idea, and it looks like all the files in there are
Ah, I see, the copy would actually be tracked in source control, as automatically generated files, and the justfile target would only have to be run after modifying the contents of Should this be a new CI check, or should the check go into the test suite in some way? Of course the tests should not modify tracked source code files, but the script/tool that generates the files could have a dry-run mode, which a test could use and check. If it goes into the test suite, it technically applies across crates, but I wonder if it could just go in the Also, for comparing the files--and I believe this applies whichever approach is taken--do you have an opinion as to whether line ending mismatches, where lines of one file end in Unix-style |
No, sorry for the confusion. I mentioned it before I fully understood you were referring to the
Ah, you mean that also doesn't work while the This reminds me that you can tell cargo to use
Yes,
Yes, the current symlink at
I would go with a CI-only test that can be a simple as executing the
I'd not worry about this as Git will do so for you. The idea is to execute the I don't know what the string literals would have to do with it though, my assumption was that the header of each file would be prefixed with something like: //! DO NOT EDIT - this is a copy of <worktree-relative/path/to/src/*.rs>. Run `just <the-target>` to update it. <NL>
|
It does work when A notable exception is that if previously attempted unsuccessfully, such as with
I would be pleased to do this. I'm a bit worried about the case where But if it is implemented as a subcommand in
(This happens before the If it is instead implemented as a shell script, then that is avoided. But a shell script may have rarer but weirder failure modes on Windows where the interpreter used to run it is unexpected. But then again maybe that would already be revealed by any use of
Yes, that's true. After posting my previous comment, I thought a bit about a dry-run mode and realized that it may either constrain the approach taken or complicate the implementation.
To clarify, I wasn't thinking about the material added to the top of the file, but to the issue of line endings changing (even perhaps due to local let s = r#"first line
second line" because in some languages such literals would be different depending on the line ending "physically" appearing inside the raw string. But that's not the case in Rust, so I'm not worried about it. I only mentioned that to say why I wasn't worried about it--sorry about the confusion there. |
That is interesting! From memory I can tell that indeed, git dependencies have no notion of cache-invalidation beyond the repository being updated on the remote.
Great! And it's true, there is a bootstrap issue that I didn't think of. Maybe the copy should be done by a script and in a clean way: assure destination isn't dirty, delete the destination, copy the files over to the destination, and then run the tool on the destination folder insert the docstrings. And even thought this involves a shell script, this approach seems to have none of the issues. Also, I'd feel particularly comfortable about the said shell script knowing that you are writing it. |
Current behavior 😯
Expected behavior 🤔
I can compile
Git behavior
No response
Steps to reproduce 🕹
byron/gitoxide
repository (using vscode)cargo
command anywhere in the repositoryI suspect this is because the repo uses symlinks to reduce copying.
The text was updated successfully, but these errors were encountered: