News for hackers. Stuff that matters.
Re:Rewrite Everything in Rust by reality_czech on Monday February 22, 2016 @10:05PM (#11156191)
Have you even looked at the source code to glibc? It's stuffed full of macros and #ifdef hell. Not to mention symbol versioning, the use of gcc-specific compiler extensions, and ancient-UNIX-beard performance hacks. You'd have more success teaching a chimpanzee to play the violin, than automatically translating glibc into anything.
Re:Rewrite Everything in Rust by 0xcde4c3db on Monday February 22, 2016 @10:47PM (#11156366)
I've seen a lot of weird preprocessor (ab)use in GNU code. The coreutils true/false (of all programs to invoke clever preprocessor tricks...) has this gem:

in true.c (all told, an 80-line file):

  /* Act like "true" by default; false.c overrides this.  */
  #ifndef EXIT_STATUS
  # define EXIT_STATUS EXIT_SUCCESS
  #endif
false.c, of course, contains only:

  #define EXIT_STATUS EXIT_FAILURE
  #include "true.c"
On my current system, each of these represents a stately 27KB dynamically linked executable.

By way of comparison, the OpenBSD version of true comprises nine lines with zero preprocessor directives:

  /*	$OpenBSD: true.c,v 1.1 2015/11/11 19:05:28 deraadt Exp $	*/

  /* Public domain - Theo de Raadt */

  int
  main(int argc, char *argv[])
  {
  	return (0);
  }
Re:Rewrite Everything in Rust by masklinn on Tuesday February 23, 2016 @02:48AM (#11157255)
But BSD true doesn't support --version, how are you going to check your version of true without a locale-aware version string (and yes, gnu true is locale-aware, and contains 2k of strings including 48 encoding names and 36 format strings — 10 of which are duplicates, and for some reason refers to the SHA2 utilities)

(I dimly remember an essay about similar issue in a similar mainframe command (maybe in JCL?) taking a bunch of revisions to actually get right?)

Re:Rewrite Everything in Rust by CyberDildonics on Monday February 22, 2016 @10:58PM (#11156416)
If I write something and make it simple, how will people know what a jenius I am?
Re:Rewrite Everything in Rust by charlieflowers on Tuesday February 23, 2016 @01:55AM (#11157087)
So I guess we need more than just a "transliteration" to a safer language. We really need to shed that cruft and write something clear and understandable.

Could we also drop a lot of requirements that applied to older, more limited hardware? (Or, do certain constrained hardware situations still require most of those requirements to stick around?)

Re:Rewrite Everything in Rust by CyberDildonics on Monday February 22, 2016 @10:50PM (#11156377)
Then what chance do we have of cleaning it up?

It does seem to me though that if you pre-processed it for a common case and translated it to rust with anything going into unsafe if it has to and started from that you would be off to some sort of start.

The whole thing seems moot though because there are already alternate libc implementations like musl as well as alternate malloc implementations like jemalloc.

I actually still don't understand why libc is the undertaking it is made out to be, especially if you can plug in jemalloc which I would think would take care of the most difficult part.