-
Notifications
You must be signed in to change notification settings - Fork 493
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
Improve Windows support #23
Comments
#43 adds CI on Windows, but it is not yet passing due to path issues. |
I looked into it a little bit today and the issue lies in using From what I can find the best way to get an ID of a volume on windows would be using GetVolumeInformationW. Which can return a uint32 with the serial number the operating system generates when the volume is formatted. Another option would be to use the drive letter (or in the case of network shares, the ip address and the share name), but that would require a change of |
I've managed to get a reasonably usable Windows build going (code here: https://github.com/zb140/chezmoi/tree/windows). I didn't see @roelofvkr 's comment before I started down this path, so my fork isn't based on his, but we came up with very similar solutions using With these changes (plus a total hack in go-shell to return a value on Windows), all of the commands in the Quickstart guide work as expected, plus a few others. It will take quite a bit of cleanup to be in a mergeable state (apart from anything else, I think it breaks all of the rules in the Contributing doc except the one about commit message formatting 😉 ) but I wanted to go ahead and share what I have. There's also a couple of total hacks in there, plus this is the first or maybe second time I've ever worked on a project in Go, so I'm guessing my code will probably drive a legit Go programmer crazy 😄 But I'm super excited to have something working, and I'm sure everything else can be fixed. |
Thanks @zb140, your branch looks very promising - although, as you say, it does need a some cleanup. With a couple of fixes (some imports are missing in
For a Windows-specific Note the Windows branch uses Again, this is very promising :) |
Looks like I had an outdated version of My intent was always to submit a PR to the For Are there any instructions on how to run the tests? I'd love to give them a try on Windows; it'd be nice to have a clearer picture of exactly where it stands in terms of what isn't working. Also, I don't have a Mac, but I've got a couple of Linux boxes, so I should be able to fix up the build issues (and formatting) pretty easily too. I didn't have any time tonight to work on it any further, but thanks for all your comments. I expect to be able to spend some more time working through some of these issues this weekend. |
You can run the tests the usual go way:
There are a few dependencies that are also worth testing on Windows:
The XDG stuff helps chezmoi put config files and data in the right place in the user's home directory. This is something that will probably be different on Windows too. For For For the formatting, running
will reformat everything. You'll need to install some tools, best to look at the Writing this tells me that I should add more documentation to |
Contribution guidelines updated in #309. |
Thanks for all the pointers! I ran the The tests for chezmoi itself still don't all pass yet either, though many of them are working. I'll be working on that next. |
Come to think of it, does it make sense for the Windows-specific Chmod to be pushed up into Here's why I'm asking: some of chezmoi's tests are failing on Windows because they call |
Also, I'm having a little trouble understanding why |
I'd like |
Fair question :) The reason is that the user can run the chezmoi command from any directory, and we need to normalize filenames to check that they're in the target directory. Normalizing early (with |
Added in twpayne/go-vfs#30. Please help improve |
Awesome, thanks! I'd be happy to help. |
I've been slowly chipping away at the failing tests for the last couple of days now. I've managed to get quite a few of them working, but I'm nearing a point where I'm not really sure how to continue making progress. I still haven't come up with a good solution to the On top of that, file permissions have started to present some really big challenges. Changing permissions works well thanks to the new Windows-specific Having said all that, I'm not giving up yet. I really want a tool I can use to manage my config files across all the systems I use, and chezmoi is super, super close to exactly what I need. The only thing missing is being able to run on Windows. So I'll keep working on it, but I think progress is going to be slower while I try to work through these issues. I hope this doesn't sound like I'm complaining; I'm just feeling a little frustrated after trying to work through these issues for most of the day today 😄 [1] Windows uses "Security Identifiers" to map sets of permissions to users and groups in an ACL. There are a few well-known SIDs that represent "whoever created this file", "the primary group of whoever created this file", and "everyone" (among others). [2] For files whose ACLs were set with |
Thanks for your hard work on this! Here are some thoughts. For the For the ACLs, a couple of ideas:
|
I'm happy to help out when I can, and thankfully I don't get discouraged easily 😄 Thanks a lot for the suggestions. For For the permissions, I like your suggestion of side-stepping UNIX permissions entirely. I had a go at implementing this and the results are looking promising, but it's a relatively big undertaking, so I don't have it working just yet. I think I'm on the right track now though. The good news is, nearly all the tests are passing now. There are 4 individual failing test cases: 3 to do with private files, plus the |
3 down, 1 to go! I've updated my fork with some new fixes that address the permissions issues. At this point, all but one of the tests are passing, and the last one is just the Note that the new updates in my fork depend on pending upstream changes in go-acl, and some of the permissions tests won't pass without twpayne/go-vfs#32. I've just noticed that one of the build checks on that PR failed, so I'll look into that too. |
🎉 🎉 🎉 As of now, all the tests are passing on Windows using my |
This is great to hear! |
@zb140 Thank you so much for your work on this so far. I'm thinking of a v2.0.0 release soon. Should this include Windows support? |
Hey @twpayne, sorry, I've been busier than normal for the last week or two and somehow I missed this notification. I'd love to get Windows support into v2.0.0 if it's not too late. Work on this kind of stalled out because it depends on hectane/go-acl#14, which hasn't been merged (or I think even reviewed) yet. I'll post over there and ask for an update. Last time I worked on this, all the tests were passing and everything seemed to work as expected, with the exception of upgrade (which turns out to be difficult because Windows won't let you overwrite a running executable). I also did some general cleanup of the code to make it ready for review. This weekend I'll rebase onto the latest master and make sure things are still working, and hopefully there will be some movement on |
Thanks very much for the update. There's no real rush for a 2.0.0 release - I'm thinking maybe sometime this summer. If hectance/go-acl#14 doesn't advance, I'm happy to maintain a fork for chezmoi so we don't get blocked on this. Let's just disable the update command on Windows for now. |
I've updated my branch to the latest from |
I've rebased my branch onto your latest changes from yesterday, and I think it's just about ready for a PR. The one last problem is that after the This can be fixed one of two ways: either change I lean towards the second solution, but what do you think? If you agree, I'll submit a PR for that. Once that's wrapped up, anyone will be able to check out my branch and expect the all the tests to pass on Windows and Linux. I expect they'll work on Mac as well but I don't have one so I can't verify that. At that point, I can create a PR for the Windows branch to kick off the review process. |
I agree. Please do submit a PR. |
Woohoo! I'm glad I could help. The benefits of chezmoi over my old, ad-hoc git repo have already made it worth the work 😀 Thanks for building such a great tool (and one of the few, if not the only, that could even feasibly support Windows in the first place!) |
chezmoi
is currently targeted at macOS/Linux, but there is no reason why it shouldn't also run on Windows. Contributions improving Windows support are very welcome.The text was updated successfully, but these errors were encountered: