4 ms·
The internals of bash's implementation are also notoriously awful. Its one of those legacy C code bases that are very hard to work on.
by ufo 10y ago
The internals of bash's implementation are also notoriously awful. Its one of those legacy C code bases that are very hard to work on.
- oblio 10y agoWasn't that sh (aka Bourne shell)? With the infamous "Pascal macros": http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/mac.h http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/... Or is bash just as bad?
- laumars 10y agoOh my, browsing around that repo and some of versions of sh[1] has possibly the worst C I've seen in production. Do you know the reasons for the "Pascal macros" as they don't even make the C code Pascal compliant? [1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=SysIII/usr/src/cmd/sh http://minnie.tuhs.org/cgi-bin/utree.pl?file=SysIII/usr/src/...
- TazeTSchnitzel 10y agoDo you mean the ALGOL macros, which transform C into the so-called “BourneGOL”? They're there because Mr. Bourne liked ALGOL a lot.
- laumars 10y agoALGOL would make sense too. Thank you for the explanation.
- deleted 10y ago[deleted]
- TazeTSchnitzel 10y agoBash is a clone of sh, but it has its own problems.
- david-given 10y agoThere's a more recent version: https://github.com/EtchedPixels/FUZIX/blob/master/Applications/V7/cmd/sh/service.c https://github.com/EtchedPixels/FUZIX/blob/master/Applicatio... I spent some time making it work on modern machines, and it's... I don't really want to use the word 'bad'; because I don't think it is. I kept finding issues which I would spend ages tracing through the code muttering about ancient C which didn't understand alignment and stuff, and then discover that the code was actually doing everything right and the problem was at my end. I couldn't find a single bug in it. But incomprehensible --- oh god yes. The way it handles memory is really bizarre. The parser is really bizarre (there's the famous Tom Duff quote: " Nobody really knows what the Bourne shell’s grammar is. Even examination of the source code is little help."). And then they interact!