-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Support Windows as target OS #32
Comments
Thank you for your feedback.
Yes, ideally I'd like to support Windows, if there isn't too much OS-specific code that needs to be added.
Yes, we should make sure that links can be correctly before adding Windows support.
Yes. Adding things like |
Thanks for the feedback! Based on that, I am going to look closer into the |
Windows sure is strange. While there is the C:\Users\fabian\rust\diskus>mkdir foo
C:\Users\fabian\rust\diskus>mkdir foo\orig
C:\Users\fabian\rust\diskus>fsutil file createnew foo/orig/orig.txt 1000000
File C:\Users\fabian\rust\diskus\foo\orig\orig.txt is created
C:\Users\fabian\rust\diskus>mklink /h foo\orig\hl.txt foo\orig\orig.txt
Hardlink created for foo\orig\hl.txt <<===>> foo\orig\orig.txt
C:\Users\fabian\rust\diskus>mklink /J foo\JP foo\orig
Junction created for foo\JP <<===>> foo\orig
C:\Users\fabian\rust\diskus>mklink foo\softlink foo\orig
symbolic link created for foo\softlink <<===>> foo\orig
C:\Users\fabian\rust\diskus>dir /s /q foo
Volume in drive C is Windows
Volume Serial Number is 10F9-E64D
Directory of C:\Users\fabian\rust\diskus\foo
09/18/2019 08:43 PM <DIR> GORRAMBOX\fabian .
09/18/2019 08:43 PM <DIR> GORRAMBOX\fabian ..
09/18/2019 08:43 PM <JUNCTION> GORRAMBOX\fabian JP [C:\Users\fabian\rust\diskus\foo\orig]
09/18/2019 08:36 PM <DIR> GORRAMBOX\fabian orig
09/18/2019 08:43 PM <SYMLINK> GORRAMBOX\fabian softlink [foo\orig]
1 File(s) 0 bytes
Directory of C:\Users\fabian\rust\diskus\foo\JP
09/18/2019 08:36 PM <DIR> GORRAMBOX\fabian .
09/18/2019 08:36 PM <DIR> GORRAMBOX\fabian ..
09/18/2019 08:36 PM 1,000,000 GORRAMBOX\fabian hl.txt
09/18/2019 08:36 PM 1,000,000 GORRAMBOX\fabian orig.txt
2 File(s) 2,000,000 bytes
Directory of C:\Users\fabian\rust\diskus\foo\orig
09/18/2019 08:36 PM <DIR> GORRAMBOX\fabian .
09/18/2019 08:36 PM <DIR> GORRAMBOX\fabian ..
09/18/2019 08:36 PM 1,000,000 GORRAMBOX\fabian hl.txt
09/18/2019 08:36 PM 1,000,000 GORRAMBOX\fabian orig.txt
2 File(s) 2,000,000 bytes
Total Files Listed:
5 File(s) 4,000,000 bytes
8 Dir(s) 55,115,661,312 bytes free
And in Powershell PS C:\Users\fabian\rust\diskus\foo> $totalsize = [long]0
PS C:\Users\fabian\rust\diskus\foo> Get-ChildItem -File -Recurse -Force -ErrorAction SilentlyContinue | % {$totalsize += $_.Length}
PS C:\Users\fabian\rust\diskus\foo> $totalsize
4000000 |
It seems to me that links are not very common in Windows. Could we just choose the same route and ignore their existence (+ document it)? |
Yes, I agree, that's most likely the best route. At least then diskus will have parity with the official tools. In that case my patch from the first message already has everything on board and I can create a PR from that. Would you happen to have a chance to test a build on MacOS? I only have access to Win (7/10) and Linux. |
Sounds great!
I don't. But every supported OS should be part of the CI toolchain (see Unfortunately, I never had the time to write proper tests for |
(A proper way to write integration tests for command-line programs in Rust can be found here: https://github.com/sharkdp/pastel/blob/master/tests/integration_tests.rs) |
Released in v0.6.0. |
I was trying to build diskus with on Windows 7 (Rust 1.37.0, stable-x86_64-pc-windows-msvc toolchain). This failed, as the trait
st::os::unix::fs::MetadataExt
is used insrc/walk.rs
.Here is the full error message of the failing build from my machine.
I dug into the source and came up with a patch that allowed me a compile and run the tool. Basically, I refactored the generation of
UniqueID
into a function and made a explicit distinction betweenunix
andwindows
when implementing that function.Here is the diff of the patch.
While it serves my immediate usecase, the Windows implementation is incorrect/incomplete, as there is no handling of NTFS Hard Links and Junctions. A quick search with cargo revealed https://crates.io/crates/junction which would probably be a suitable candidate for coming up with a proper implementation.
The issue I'd like to raise is whether diskus should have Windows support. If so, is the approach via
[cfg(target_os = "...")]
acceptable for diskus. I found a discussion in the Rust forum that contains links to similar branching in thelibc
crate source.The text was updated successfully, but these errors were encountered: