Like the author, I appreciate the Apple OSS Distributions, even though I don't use Mac OSX.
Four or five weeks ago, I was searching GitHub for every instance of my email for legal reasons. I came across it in an Apple OSS Distribution. And that is when I learned that my best project had been silently shipped with Ventura.
I was ecstatic! [1] It's always great to see more people adopt your work.
Wow, you authored bc? It’s incredibly useful. I have to admit that since Spotlight now supports quick calculations, it’s my second step. But it used to be my first. Thanks so much for your work.
Not to mention the screenshot tool (including Command-Shift-4, Spacebar) that works immediately upon keypress unlike the new Windows built-in screenshotter. Of which it doesn't hide its own UI properly and may leave a small 1-pixel bar at the top of your screenshot! It's insane how poorly crafted Windows is, and yet it flourishes.
An acquaintance had a theory, though. They presumed that Apple was doing two years of regression testing on Ventura, so maybe they grabbed the latest version at the time, tested stuff for two years and shipped the version they tested.
If so, I don't blame them. Most protects are not run like mine, so they need to test for the lowest common denominator and assume that later versions will have new bugs.
What’s bc? Is it Bit Counter? I just skimmed the website and gh readme looking for a definition of BC, and I’m still unsure. Only clue I found is that it has something to do with calculators….
GNU `bc` is a command-line arbitrary-precision calculator language [1]. It seems the parent comment's author implemented an alternative version that is now shipping in macOS, presumably because Apple doesn't like the GNU licenses.
If you look at the repos in https://github.com/apple-oss-distributions and their commit messages, that is pretty much the definition of the "Throwing it over the wall every so often" approach to open source.
At least the name-brand projects like Webkit and Swift (which have logos and everything) are on a different planet to that.
Yeah, which is a totally valid approach under the GPL, and essentially the closest one to how source distribution would’ve worked at the time the license was written (software disks either come with source code or instructions to acquire it).
FTA: If you were curious about the “banner” command, which was historically used to generate ASCII text suitable for printing huge messages at dot matrix printers (!)
Dot matrix printers typically allow for better output than grids of monospaced characters, and, AFAIK, weren’t commonly used with computers when banner was written, so I would think it was made for line printers (https://en.wikipedia.org/wiki/Line_printer), not dot matrix ones.
There was a pretty good time interval between dot matrix printers becoming a thing and any kind of dot addressable graphics. For many years you just sent them regular old ascii codes and got text.
I think communication interfaces had to come up in speed for it to make sense, and memory on the computer to hold an entire page of pixels. I mean, at 72dpi that's 50KB just for the data! You were mostly into the IBM PC era before that was a thing.
> and memory on the computer to hold an entire page of pixels. I mean, at 72dpi that's 50KB just for the data!
Fwiw it was common for text editors at the time to render/raster in chunks and then send that off to the printer. For complicated documents, the printer sometimes had to take pauses while the computer worked
On the dot matrix printers, the text mode was much faster than the graphics mode. So you could print pretty graphics, but you would have wait for your printout.
These can definitely be fun to go through. Recently there was a code dump to `ld64` that contained references to Apple's upcoming RealityOS. [1]
Kind of surprising that they haven't taken it down. It is pretty cool to see these easter eggs in addition to the massively improved ability to debug things by having an open source toolchain, especially in regards to bringing other toolchains to MacOS (eg mold/LLVM (especially LLD)).
ReactOS is used in a similar manner for a lot of Windows devs, offensive security, malware devs presumably. Since Windows isn't open source, React is a great resource for seeing how things could/might be done, relevant APIs, etc.
I doubt those serious about it wouldn't just put the actual Windows binaries through a decompiler (they're surprisingly good these days, particularly that free one from the NSA, and Microsoft even publishes the symbols for most of the binaries anyway.) Especially malware and exploits that rely on exact implementation details.
Yeah, this is a good resource! One time I needed to printf-sprinkle dyld in order to figure out why our app was dying on a security update... it turned out to be an installer setting a sticky bit and the security update silently ignoring libraries if any containing folder had a sticky bit set.
Anyway, since the source code has been up for a while, and since HN has GPT fever at the moment, the question naturally arises... can ChatGPT get this one?
The "lsof" tool on Mac OS X uses the "kernal control" API to obtain a list of
open ports. This API allows access to various kernel resources, including
network sockets, and provides information about the state of the system. The
"lsof" command uses this API to list all open files, including network sockets,
and displays information about the processes that are using them.
It looks confidently wrong in this case, unless "kernal control" is a real name for the part of the XNU API containing proc_pidinfo.
Ironically, the example they give (using lsof's source to learn how to list open ports), while open source, requires an apple-private entitlement to run with modern macOS security protections.
Like the author, I appreciate the Apple OSS Distributions, even though I don't use Mac OSX.
Four or five weeks ago, I was searching GitHub for every instance of my email for legal reasons. I came across it in an Apple OSS Distribution. And that is when I learned that my best project had been silently shipped with Ventura.
I was ecstatic! [1] It's always great to see more people adopt your work.
Don't worry; they followed the license.
[1]: https://gavinhoward.com/2023/02/my-code-conquered-another-os...
Wow, you authored bc? It’s incredibly useful. I have to admit that since Spotlight now supports quick calculations, it’s my second step. But it used to be my first. Thanks so much for your work.
My '08 MacBook has calculations via Spotlight.
Not to mention the screenshot tool (including Command-Shift-4, Spacebar) that works immediately upon keypress unlike the new Windows built-in screenshotter. Of which it doesn't hide its own UI properly and may leave a small 1-pixel bar at the top of your screenshot! It's insane how poorly crafted Windows is, and yet it flourishes.
Thank you! I don't blame you for using something more handy, by the way.
Any idea why they would ship such an old version?
Nope.
An acquaintance had a theory, though. They presumed that Apple was doing two years of regression testing on Ventura, so maybe they grabbed the latest version at the time, tested stuff for two years and shipped the version they tested.
If so, I don't blame them. Most protects are not run like mine, so they need to test for the lowest common denominator and assume that later versions will have new bugs.
2 replies →
I've noticed other projects stopped shipping when GPLv2 became GPLv3
Also, I noticed they've been technically in violation of the GPL for years with bash - they never shipped source for rootless.h/etc
1 reply →
This is really cool. I use 'bc' in a small script that I run almost daily.
Cool! If I may ask, what does the script do?
2 replies →
What’s bc? Is it Bit Counter? I just skimmed the website and gh readme looking for a definition of BC, and I’m still unsure. Only clue I found is that it has something to do with calculators….
GNU `bc` is a command-line arbitrary-precision calculator language [1]. It seems the parent comment's author implemented an alternative version that is now shipping in macOS, presumably because Apple doesn't like the GNU licenses.
[1] https://www.gnu.org/software/bc/manual/html_mono/bc.html
bc is a standard utility on POSIX systems. It's kind of expected that people know about it, like it's expected they know about awk or grep.
bc is a little less known, though.
2 replies →
I can't resist, because this is the perfect opportunity... RTFM
Hey, thanks for 'bc', I use it all the time!
I use bc all the time :)
Thank you! I'm always delighted to hear that people use it.
bc carries so many of my scripts, I was just using it yesterday! Thank you so much for the work you've done on it.
If you look at the repos in https://github.com/apple-oss-distributions and their commit messages, that is pretty much the definition of the "Throwing it over the wall every so often" approach to open source.
At least the name-brand projects like Webkit and Swift (which have logos and everything) are on a different planet to that.
Yeah, which is a totally valid approach under the GPL, and essentially the closest one to how source distribution would’ve worked at the time the license was written (software disks either come with source code or instructions to acquire it).
I don't think any of the code that Apple ships with macOS is GPL though? That's the reason why they stopped shipping bash, if I'm not wrong?
edit: ah it seems that they support GPLv2 but not GPLv3, that's what happened. And they still ship bash, just the old GPLv2 version.
What’s not valid is failing to produce source that matches the code that you ship.
It's only a totally valid approach if you're hostile to it. It's following the letter of the law but not the spirit of it.
3 replies →
FTA: If you were curious about the “banner” command, which was historically used to generate ASCII text suitable for printing huge messages at dot matrix printers (!)
Dot matrix printers typically allow for better output than grids of monospaced characters, and, AFAIK, weren’t commonly used with computers when banner was written, so I would think it was made for line printers (https://en.wikipedia.org/wiki/Line_printer), not dot matrix ones.
I don’t know when that was, but https://www.tuhs.org/cgi-bin/utree.pl?file=2.11BSD/src/games... has a man page dated October 1982. https://www.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/s1/... must be older since version 6 Unix is from 1975. Also, the man page supports that claim by saying
“you may want a printer or a fast hardcopy terminal, but if you are patient, a decwriter or other 300 baud terminal will do.”
There was a pretty good time interval between dot matrix printers becoming a thing and any kind of dot addressable graphics. For many years you just sent them regular old ascii codes and got text.
I think communication interfaces had to come up in speed for it to make sense, and memory on the computer to hold an entire page of pixels. I mean, at 72dpi that's 50KB just for the data! You were mostly into the IBM PC era before that was a thing.
> and memory on the computer to hold an entire page of pixels. I mean, at 72dpi that's 50KB just for the data!
Fwiw it was common for text editors at the time to render/raster in chunks and then send that off to the printer. For complicated documents, the printer sometimes had to take pauses while the computer worked
On the dot matrix printers, the text mode was much faster than the graphics mode. So you could print pretty graphics, but you would have wait for your printout.
I first used banner on a PDP mainframe in 1977.
These can definitely be fun to go through. Recently there was a code dump to `ld64` that contained references to Apple's upcoming RealityOS. [1]
Kind of surprising that they haven't taken it down. It is pretty cool to see these easter eggs in addition to the massively improved ability to debug things by having an open source toolchain, especially in regards to bringing other toolchains to MacOS (eg mold/LLVM (especially LLD)).
1. https://github.com/apple-oss-distributions/ld64/commit/59a99...
ReactOS is used in a similar manner for a lot of Windows devs, offensive security, malware devs presumably. Since Windows isn't open source, React is a great resource for seeing how things could/might be done, relevant APIs, etc.
I doubt those serious about it wouldn't just put the actual Windows binaries through a decompiler (they're surprisingly good these days, particularly that free one from the NSA, and Microsoft even publishes the symbols for most of the binaries anyway.) Especially malware and exploits that rely on exact implementation details.
Yeah, this is a good resource! One time I needed to printf-sprinkle dyld in order to figure out why our app was dying on a security update... it turned out to be an installer setting a sticky bit and the security update silently ignoring libraries if any containing folder had a sticky bit set.
Anyway, since the source code has been up for a while, and since HN has GPT fever at the moment, the question naturally arises... can ChatGPT get this one?
It looks confidently wrong in this case, unless "kernal control" is a real name for the part of the XNU API containing proc_pidinfo.
Ironically, the example they give (using lsof's source to learn how to list open ports), while open source, requires an apple-private entitlement to run with modern macOS security protections.
[flagged]