5 ms·
Complete rubbish: Many GNU, Linux and other utils are pretty awesome, and obviously some effort has been spent in the past to port them to Windows. However, tho
by kazinator 11y ago
Complete rubbish: Many GNU, Linux and other utils are pretty awesome, and obviously some effort has been spent in the past to port them to Windows. However, those projects are either old, abandoned, hosted on CVS, written in platform-specific C, etc. Rust provides a good, platform-agnostic way of writing systems utils that are easy to compile anywhere, and this is as good a way as any to try and learn it.
Cygwin has a complete, up-to-date port of the Coreutils for Windows.
The POSIX + C language provides a a good, platform-agnostic way of writing systems utils that are easy to compile anywhere.
- dikaiosune 11y agoIs the cygwin port just some different build files, or is it genuinely different code? A Rust codebase probably wouldn't (in most cases) need to be modified to run on different supported platforms.
- frutiger 11y agoI'm not going to comment about cygwin (because its build process is not as transparent) but instead about msys2, the spiritual successor to cygwin. See for yourself: https://github.com/Alexpux/MSYS2-packages/blob/master/coreutils/PKGBUILD https://github.com/Alexpux/MSYS2-packages/blob/master/coreut... is the `pacman` style `PKGBUILD` used to build the `coreutils` package.
- dikaiosune 11y agoThat looks pretty clean, but they're still applying looks like 5 patches which would need to be maintained separately. It's certainly not as bad as a full port, but it's still not the same codebase. Rust's cross-platform efforts would (I think?) obviate that process.
- kazinator 11y agoBut, nevertheless, it's not exactly a port of Coreutils to Windows per se. For instance, let's take the "cp" utility. A Windows port "cp" should be able to copy Windows-specific file attributes. Does the Cygwin "cp" do that? How about NTFS forks? I don't believe that you can write some portable code in Rust, and have a "cp" utility which correctly handles every quirk of every OS's file structure.
- dikaiosune 11y agoNot familiar with Windows' filesystem APIs, but the description for the Rust function in the stdlib is here: https://doc.rust-lang.org/std/fs/fn.copy.html https://doc.rust-lang.org/std/fs/fn.copy.html Seems like it should handle platform specific attributes?
- kazinator 11y agoCan you show me a Rust program that calls CoCreateInstanceEx on Windows, ported to Solaris?
- dikaiosune 11y agoDisclaimer: I don't really speak developer Windows. Can you show me a Rust program that calls CoCreateInstanceEx at all? Also, what is that for? The MSDN page isn't particularly helpful.