News for hackers. Stuff that matters.
Re:Moreutils – Unix tools that nobody thought to write (2012) by beojan on Saturday August 22, 2020 @04:36AM (#24242700)
> rg

Never going to happen because it's written in rust. ag (https://github.com/ggreer/the_silver_searcher) on the other hand is written in C.

Re:Moreutils – Unix tools that nobody thought to write (2012) by nindalf on Saturday August 22, 2020 @04:46AM (#24242741)
Never say never :)

If Rust being added to the Linux kernel[1] isn't far-fetched, I don't think adding a utility in Rust is crazy either.

[1] - https://lore.kernel.org/lkml/CAKwvOdmuYc8rW_H4aQG4DsJzho=F+d...

Re:Moreutils – Unix tools that nobody thought to write (2012) by chalst on Saturday August 22, 2020 @12:37PM (#24245262)
Interesting.

Isn't it the case that LLVM doesn't support all architectures that Linux does?

Re:Moreutils – Unix tools that nobody thought to write (2012) by saagarjha on Saturday August 22, 2020 @01:58PM (#24245882)
I think this is just for kernel modules that you can choose to compile out.
Re:Moreutils – Unix tools that nobody thought to write (2012) by geofft on Saturday August 22, 2020 @02:58PM (#24246335)
That's what I expected too (as one of the people on the thread / one of the authors of the farthest-along set of bindings for modules), but Linus and Greg KH both seem fairly inclined for it to be on by default and used for core code (small bits of core code, in the beginning) and not simply modules. I'm not sure how that's going to play out with architecture support, and that's one of the things I want to get out of the Plumbers session this upcoming week.

https://github.com/fishinabarrel/linux-kernel-module-rust/is... is a chart of Linux architectures and whether Rust and LLVM support them.

Re:Moreutils – Unix tools that nobody thought to write (2012) by saagarjha on Saturday August 22, 2020 @03:43PM (#24246716)
Oh, wow, that would be huge. Not just architecture support, but even having a toolchain on some platforms might be problematic as I can imagine making rustc a requirement to build Linux to be fairly controversial in and of itself. And that architecture list is not looking very good…would be very interested to know what they decide on as well!
Re:Moreutils – Unix tools that nobody thought to write (2012) by feanaro on Saturday August 22, 2020 @04:38AM (#24242706)
What's never going to happen?
Re:Moreutils – Unix tools that nobody thought to write (2012) by saagarjha on Saturday August 22, 2020 @04:40AM (#24242716)
A Rust program being standard on all UNIX systems.
Re:Moreutils – Unix tools that nobody thought to write (2012) by genuinebyte on Saturday August 22, 2020 @04:44AM (#24242730)
I'll bite: Why?
Re:Moreutils – Unix tools that nobody thought to write (2012) by saagarjha on Saturday August 22, 2020 @04:50AM (#24242756)
Rust is designed for a fairly small number of relatively modern systems; there are many close-to-POSIX systems that can’t (and I would guess likely will never) be able to run Rust code in any formal capacity. To the hopeful: even C++ has been unable to win here, despite having many more years of a head start and much more accommodation for stranger platforms. It’s just not going to happen.
Re:Moreutils – Unix tools that nobody thought to write (2012) by MaxBarraclough on Saturday August 22, 2020 @05:28AM (#24242914)
What kind of platforms are you thinking of? People have got Rust running on the Raspberry Pi.

https://old.reddit.com/r/rust/comments/cdcads/

Re:Moreutils – Unix tools that nobody thought to write (2012) by saagarjha on Saturday August 22, 2020 @05:43AM (#24242976)
Linux on ARM is a very mainstream platform from the perspective I’m looking at this from, I’m afraid. I’m talking about strange Unices running on architectures that GCC may or may not maintain a backend for, or maybe a BusyBox available on some debug interface, maybe a school project to build a simple POSIX-compatible OS or a bootstrap for a platform that had been recently jailbroken. In these cases C is almost always the go-to language and I suspect it will remain so for the foreseeable future as this is precisely the long tail of distributions that standards were intended to provide a base set of tooling for.
Re:Moreutils – Unix tools that nobody thought to write (2012) by dividedbyzero on Saturday August 22, 2020 @05:55AM (#24243024)
Could you give some actual examples? This sounds interesting but I'm not sure I've ever seen something like that in the wild.
Re:Moreutils – Unix tools that nobody thought to write (2012) by hvdijk on Saturday August 22, 2020 @07:18AM (#24243365)
This is clearly not one of the examples saagarjha was thinking of, but an actual example where Rust is not an option is the x32 ABI for x86_64 platforms. This ABI works well with GCC, but LLVM suffers from multiple code generation bugs. As Rust is based on LLVM, Rust for the x32 ABI does not work well either. While it's possible to use a mixture of ABIs, so that you have a mostly-x32 system but with some x64 binaries, this requires a multilib setup with multiple copies of system libraries. A pure x32 system cannot currently have Rust utilities.

(I have some patches to improve things but I have not been able to submit them to LLVM yet, and with those patches I did manage to get a working x32 build of rg on my system. I hope to be able to do so in the future.)

Re:Moreutils – Unix tools that nobody thought to write (2012) by pafje on Saturday August 22, 2020 @05:54AM (#24243020)
Rust supports many platforms but only has "tier 1 support" on a handful of mainstream architectures.

https://doc.rust-lang.org/nightly/rustc/platform-support.htm...

Re:Moreutils – Unix tools that nobody thought to write (2012) by dig1 on Saturday August 22, 2020 @06:01AM (#24243049)
MIPS and SPARC to name a few. Almost all routers are on MIPS and most of them are running some form of Linux or BSD.

AFAIK, rust is still marked as "guaranteed to build" on these platforms, but assume only Linux. BSDs, not so much.

Re:Moreutils – Unix tools that nobody thought to write (2012) by fiddlerwoaroof on Saturday August 22, 2020 @06:58AM (#24243274)
In my experience, most consumer routers are ARM?
Re:Moreutils – Unix tools that nobody thought to write (2012) by happycube on Saturday August 22, 2020 @12:10PM (#24245048)
Maybe new ones, but there's a ton of MIPS ones too.
Re:Moreutils – Unix tools that nobody thought to write (2012) by sannee on Saturday August 22, 2020 @06:11AM (#24243087)
The Debian ripgrep binary is 5.1MB. That would consume over 15% of a 32MB flash, which is the common constraint you have to work with in many (actually, discounting Android, it might even be most) Linux deployments.
Re:Moreutils – Unix tools that nobody thought to write (2012) by rcxdude on Saturday August 22, 2020 @07:00PM (#24247972)
You're not likely to even find full-fat grep on such platforms (only busybox)
Re:Moreutils – Unix tools that nobody thought to write (2012) by saagarjha on Saturday August 22, 2020 @04:51AM (#24242761)
bat is Rust too.
Re:Moreutils – Unix tools that nobody thought to write (2012) by isatty on Saturday August 22, 2020 @06:20AM (#24243119)
+1 for ag (the_silver_searcher)