Live data from Hacker News

Cross-platform Rust rewrite of the GNU coreutils

github.com

221–230 of 498 posts

Re: Cross-platform Rust rewrite of the GNU coreutils

#221

Some people worry about the file size (which should be similar), but I worry about the speed. How much faster can we grep or sed with a Rust compiled grep vs a C compiled grep?

Likely not as fast as with a grep written in C, but FreeBSD's grep is (was?) pretty slow compared to the GNU version and nobody really cares (read: it's probably fast enough).

There shouldn't be any theoretical reason that a Rust grep should be slower than a C grep. In practice, a rust grep would be a new code base, and the existing grep has seen a lot of development over years.

Re: Cross-platform Rust rewrite of the GNU coreutils

#223
post #52

Earlier quoted context omitted.

This is a terrific project idea, but I agree that it should likely be under the GPL. Even if it is not legally derivative, it would be nice to preserve the GPL.

Sometimes the maximising the likelihood of a set of components being used is more important than potential licensing constraints. In this particular case, if they're not GPL, they're more likely to be used for various *BSD systems and in a variety of embedded contexts. Improving the general security and reliability of all systems seems like it might potentially be a more valuable goal.

> In this particular case, if they're not GPL, they're more likely to be used for various *BSD systems and in a variety of embedded contexts.

This is a bit of a bugbear. The most common way to use the coreutils is through standard Unix pipes, which does not create a derivative work. I don't know of anyone who has found the copyleft of the coreutils prevents them from doing anything they would like to do. The situation with busybox and Linux is different, as the coupling there was much tighter, and without it we would not have OpenWrt.

Re: Cross-platform Rust rewrite of the GNU coreutils

#224

(on Windows use MinGW/MSYS or Cygwin make and make sure you have rustc in PATH) This made me chuckle - if you have MSYS installed, which already comes with a windows port of coreutils, why would you want to use it to build a windows port of coreutils?

Because you don't trust the memory safety of programs written in C. Or because you think the coreutils would progress faster with a language with modern semantics like Rust.

Re: Cross-platform Rust rewrite of the GNU coreutils

#225
post #196

Earlier quoted context omitted.

Don't underestimate performance. I haven't seen the most recent benchmarks, but C/C++/Fortran are still unbeatable in raw speed. If you want maximum performance no matter what, these are the languages to choose, even if they sacrifice readability, maintainability or safety.

That is, in this general form, wrong. Most compiled languages can match or sometimes exceed C speeds, depending on the task at hand and the algorithm chosen. There are a lot of very inefficient C programs around - because they are badly written. More high-level languages allow the programmer to focus on speed where it matters. And in the current day and age, there should be no reason to favor raw speed vs. program co…

You see code size and linearity is very important for anything non-trivial and hot. New languages tend to have abstractions built upon themselves making understanding and optimizing a pain.

Re: Cross-platform Rust rewrite of the GNU coreutils

#226
post #55

Earlier quoted context omitted.

"Maybe glance" might well make it derivative.

This is very very weak grounds for any sort of lawsuit. But if having glanced at GPL source code prevents implementing similar functionalities in an entirely different language, that's a pretty darn strong argument for me to never look at GPL code again.

> This is very very weak grounds for any sort of lawsuit.

Not according to the lawyers who have advised us GNU Octave developers to never read Matlab source code.

Re: Cross-platform Rust rewrite of the GNU coreutils

#227

Earlier quoted context omitted.

The Rust standard library does assume that allocation succeeds. The language itself knows nothing about the heap, and so you can write allocators that do whatever you wish. Side note: on most Linux distros, overcommit is on, and so malloc will basically always succeed; the OOM killer will kill your program before you'd get a failure. I am less knowledgeable about OSX and Windows. I cannot speak to SQlite in this rega…

Holy crap, I'd never have imagined that... A design that assumes allocation always succeeds flies in the face of decades of safety/security-critical coding wisdom. I strongly recommend the team revisit and change that somehow to account for failures, NULL's, whatever. Actually, same anywhere a failure-prone, esp hardware, resource is acquired. C apps can handle this issue so Rust should as well if it's to replace the…

Another robustness and availability-oriented system that will eagerly abort your process on this kind of failure is Erlang.

Re: Cross-platform Rust rewrite of the GNU coreutils

#228

Earlier quoted context omitted.

Firstly I was talking about API support. Since that is the topic at hand. Secondly, Cmd is deprecated. Powershell supports both slashes and "type c:/home/foo.txt" works perfectly.

But Powershell redirects either don't work or can corrupt your files

You might find this useful:

https://technet.microsoft.com/en-us/library/hh847746.aspx

Re: Cross-platform Rust rewrite of the GNU coreutils

#229
post #76

Earlier quoted context omitted.

Prof. Regehr did not find problems with SQLite. He found constructs in the SQLite source code which under a strict reading of the C standards have “undefined behaviour”, which means that the compiler can generate whatever machine code it wants without it being called a compiler bug. That’s an important finding. But as it happens, no modern compilers that we know of actually interpret any of the SQLite source code in…

At some point some popular compiler is going to make a subtle but important change to some undefined behavior that's not going to be immediately obvious as to it's repercussions, and the fallout will be massive. Wait until you realize that the length of a byte in C is not clearly defined. Someday a processor will come along where a byte is 6 bits, and the fallout will be massive. (Really, it's happened before). No, a…

Did you see the short-lived attempt to create "friendly C" a few months ago? [1]

There's languages that have a few undefined corners, and then there's C. A sufficiently large difference in quantity becomes a difference in quality. C is qualitatively worse than most modern languages with its undefined behavior. (Granted, some modern languages escape by having the one implementation, which is then the definition. But still, that's less undefined than C.)

[1]: http://blog.regehr.org/archives/1287

Re: Cross-platform Rust rewrite of the GNU coreutils

#230
post #125

I'd really love to use rust, given the large growth of projects like this. I only need an IDE to get started, but it seems like there isn't one yet. Anyone have any pointers on where I can find a good IDE for Rust? Should I just start praying to lord-JetBrains for something that works?

It is interesting no one suggested Rust project internal ide support. They are developing something called Oracle.This is basically everything IDE needs (autocomplete, reference finding, error checking, etc). Oracle haven't finished yet.But after Oracle being ready, I think every editor/IDE out there can provide best experience for rust by simply calling a bunch of API which is very simple thing to do compare to writ…

Slightly off-topic, but isn't Oracle a bit of a dangerous name to use? I seem to remember it was something to do with some big company or other... ;)
Post reply on HN