frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Show HN: X11 desktop widget that shows location of your network peers on a map

https://github.com/h2337/connmap
27•h2337•1h ago•18 comments

Staying cool without refrigerants: Next-generation Peltier cooling

https://news.samsung.com/global/interview-staying-cool-without-refrigerants-how-samsung-is-pioneering-next-generation-peltier-cooling
163•simonebrunozzi•5h ago•120 comments

LLM Alloying Improves Performance over Single Model

https://xbow.com/blog/alloy-agents/
16•summarity•1h ago•3 comments

XMLUI

https://blog.jonudell.net/2025/07/18/introducing-xmlui/
444•mpweiher•11h ago•234 comments

New colors without shooting lasers into your eyes

https://dynomight.net/colors/
222•zdw•3d ago•66 comments

Stdio(3) change: FILE is now opaque (OpenBSD)

https://undeadly.org/cgi?action=article;sid=20250717103345
96•gslin•7h ago•45 comments

Simulating Hand-Drawn Motion with SVG Filters

https://camillovisini.com/coding/simulating-hand-drawn-motion-with-svg-filters
112•camillovisini•3d ago•13 comments

What birdsong and back ends can teach us about magic

https://digitalseams.com/blog/what-birdsong-and-backends-can-teach-us-about-magic
13•nkurz•1h ago•2 comments

Coding with LLMs in the summer of 2025 – an update

https://antirez.com/news/154
411•antirez•14h ago•285 comments

Peep Show – The Most Realistic Portrayal of Evil Ever Made (2020)

https://mattlakeman.org/2020/01/22/peep-show-the-most-realistic-portrayal-of-evil-ive-ever-seen/
46•Michelangelo11•4h ago•13 comments

Computational Complexity of Neural Networks

https://lunalux.io/introduction-to-neural-networks/computational-complexity-of-neural-networks/
9•mathattack•1h ago•1 comments

What My Mother Didn't Talk About (2020)

https://www.buzzfeednews.com/article/karolinawaclawiak/what-my-mother-didnt-talk-about-karolina-waclawiak
35•NaOH•3d ago•10 comments

FFmpeg devs boast of another 100x leap thanks to handwritten assembly code

https://www.tomshardware.com/software/the-biggest-speedup-ive-seen-so-far-ffmpeg-devs-boast-of-another-100x-leap-thanks-to-handwritten-assembly-code
158•harambae•4h ago•56 comments

Logical implication is a comparison operator

https://btdmaster.bearblog.dev/logical-implication-as-comparison/
11•btdmaster•3d ago•3 comments

Speeding up my ZSH shell

https://scottspence.com/posts/speeding-up-my-zsh-shell
134•saikatsg•9h ago•66 comments

Subreply – an open source text-only social network

https://github.com/lucianmarin/subreply
59•lcnmrn•6h ago•38 comments

IPv6 Based Canvas

https://canvas.openbased.org/
14•tylermarques•3h ago•0 comments

The Genius Device That Rocked F1

https://www.youtube.com/watch?v=FhmLb2DhNYM
13•brudgers•2h ago•1 comments

Discovering what we think we know is wrong

https://www.science.org/content/blog-post/tell-me-again-about-neurons-now
16•strangattractor•2d ago•6 comments

Show HN: Conductor, a Mac app that lets you run a bunch of Claude Codes at once

https://conductor.build/
124•Charlieholtz•3d ago•59 comments

Tough news for our UK users

https://blog.janitorai.com/posts/3/
234•airhangerf15•5h ago•206 comments

Insights on Teufel's First Open-Source Speaker

https://blog.teufelaudio.com/visionary-mynds-insights-on-teufels-first-open-source-speaker/
73•lis•8h ago•13 comments

SIOF (Scheme in One File) – A Minimal R7RS Scheme System

https://github.com/false-schemers/siof
5•gjvc•1d ago•0 comments

Digital vassals? French Government 'exposes citizens' data to US'

https://brusselssignal.eu/2025/07/digital-vassals-french-government-exposes-citizens-data-to-us/
183•ColinWright•14h ago•77 comments

Jove (Jonathan's Own Version of Emacs)

https://en.wikipedia.org/wiki/JOVE
37•nanna•3d ago•23 comments

AI is killing the web – can anything save it?

https://www.economist.com/business/2025/07/14/ai-is-killing-the-web-can-anything-save-it
133•edward•16h ago•161 comments

Hacking a Toniebox

https://www.schafe-sind-bessere-rasenmaeher.de/tech/hack-all-the-things-toniebox/
72•LorenDB•8h ago•35 comments

A Tour of Microsoft's Mac Lab (2006)

https://davidweiss.blogspot.com/2006/04/tour-of-microsofts-mac-lab.html
170•ingve•15h ago•29 comments

QuakeNotch: Quake Terminal on your MacBook's notch

https://quakenotch.com
68•rohanrhu•7h ago•74 comments

The old Caveman Chemistry website (1996-2000)

https://cavemanchemistry.com/oldcave/
79•marcodiego•11h ago•10 comments
Open in hackernews

Stdio(3) change: FILE is now opaque (OpenBSD)

https://undeadly.org/cgi?action=article;sid=20250717103345
96•gslin•7h ago

Comments

abnercoimbre•6h ago
Can someone elaborate? I always treated FILE as opaque, but never imagined people could poke into it?
pjmlp•6h ago
People use reflection for monkey patching and complain when using compiled languages less supportive of such approaches.

So it wouldn't surprise me, that a few folks would do some tricks with FILE internals.

recipe19•6h ago
The standard doesn't specify any serviceable parts, and I don't think there are any internals of the struct defined in musl libc on Linux (glibc may be a different story). However, on OpenBSD, it did seem to have some user-visible bits:

https://github.com/openbsd/src/commit/b7f6c2eb760a2da367dd51...

If you expose it, someone will probably sooner or later use it, but probably not in any sane / portable code. On the face of it, it doesn't seem like a consequential change, but maybe they're mopping up after some vulnerability in that one weird package that did touch this.

fweimer•6h ago
In gnulib, there is code that patches FILE internals for various platforms to modify behavior of <stdio.h> functions, or implement new functionality.

https://cgit.git.savannah.gnu.org/cgit/gnulib.git/tree/lib/s...

Yes, it's not a good idea to do this. There are more questionable pieces in gnulib, like closing stdin/stdout/stderr (because fflush and fsync is deemed too slow, and regular close reports some errors on NFS on some systems that would otherwise go unreported).

collinfunk•6h ago
Yes, that part of Gnulib has caused some problems previously. It is mostly used to implement <stdio_ext.h> functions on non-glibc systems. However, it is also needed for some buggy implementations of ftello, fseeko, and fflush.

P.S. Hi Florian :)

quotemstr•4h ago
> Yes, it's not a good idea to do this. There are more questionable pieces in gnulib, like closing stdin/stdout/stderr (because fflush and fsync is deemed too slow, and regular close reports some errors on NFS on some systems that would otherwise go unreported).

Hyrum's law strikes again. People cast dl_info and poke at internal bits all the time too.

glibc and others should be using kernel-style compiler-driven struct layout randomization to fight it.

jancsika•3h ago
> Hyrum's law strikes again.

Is there a name for APIs that are drawn directly from some subset of observed behaviors?

Like Crockford going, "Hey, there's a nice little data format buried in these JS objects. Schloink"

quotemstr•2h ago
> Is there a name for APIs that are drawn directly from some subset of observed behaviors?

Desire paths. https://en.wikipedia.org/wiki/Desire_path

ksherlock•6h ago
*BSD stdio.h used to include macro versions of some stdio functions (feof, ferror, clearerr, fileno, getc, putc) so they would be inlined.

    /*
     * This has been tuned to generate reasonable code on the vax using pcc.
     */*
pm215•6h ago
The MH and nmh mail clients used to directly look into FILE internals. If you look for LINUX_STDIO in this old version of the relevant file you can see the kind of ugliness that resulted:

https://cgit.git.savannah.gnu.org/cgit/nmh.git/tree/sbr/m_ge...

It's basically searching an email file to find the contents of either a given header or the mail body. These days there is no need to go under the hood of libc for this (and this code got ripped out over a decade ago), but back when the mail client was running on elderly VAXen this ate up significant time. Sneaking in and reading directly from the internal stdio buffer lets you avoid copying all the data the way an fread would. The same function also used to have a bit of inline vax assembly for string searching...

The only reason this "works" is that traditionally the FILE struct is declared in a public header so libc can have some of its own functions implemented as macros for speed, and that there was not (when this hack was originally put in in the 1980s) yet much divergence in libc implementations.

loeg•6h ago
Historically some FILE designs exposed the structure somewhere so that some of the f* methods could be implemented as macros or inline functions (e.g., `fileno()`).
bitwize•5h ago
Hyrum's Law applies: the API of any software component is the entire exposed surface, not just what you've documented. Hence, if you have FILE well-defined somewhere in a programmer-accessible header, somebody somewhere can and will poke at the internal bits in order to achieve some hack or optimization.
krylon•5h ago
OTOH, yes.

OTOH, when coding, I consider FILE to be effectively opaque in the sense that it probably is not portable, and that the implementers might change it at any time.

I am reminded of this fine article by Raymond Chen, which covers a similar situation on Windows way back when: https://devblogs.microsoft.com/oldnewthing/20031015-00/?p=42...

brokencode•5h ago
Yes, it would not be sane to depend on implementation details of something like this.

But the sad reality is that many developers (myself included earlier in my career) will do insane things to fix a critical bug or performance problem when faced with a tight deadline.

ars•1h ago
> to achieve some hack or optimization.

Or functionality. Happens to me all the time I have some Java class that's marked Final, so instead of just extending the class and moving on, I have to copy/paste the entire class wholesale to accomplish my goal.

Personally I hate "nanny" languages that block you from accessing things. It's my computer, and my code, and my compiler. Please don't do things "for my own good", I can decide that for myself.

(And yes, I am aware of the argument that this lets the original programmer change the internals, in practice it's not such a big problem. Or the cure is worse than the problem - for example my copy/paste example.)

Another example is a private constant. Instead of allowing me to reference it, I have to copy it. How is that any better? If the programmer has to change how the constant works then they can do so, and at that point my code will break and I'll .... copy the constant. But until then I can just use the constant.

crest•26m ago
The OpenBSD answer to this is: fuck them they should've known better. The few pieces of software that do this and have an active port maintainer will get patched. The rest will stay broken until somebody cares to deal with the change.
zahlman•4h ago
I always assumed that people could poke into it, but shuddered at the thought.
asveikau•3h ago
I've seen old code do this over the years. When you consider for example that snprintf() didn't used to be standardized until the late 1990s. People would mock up a fake FILE* and use fprintf.
p0w3n3d•6h ago
However, who should really rely on internals of FILE? Isn't this a bad practice?
vitaut•6h ago
In general, it is a bad practice. However, it can be useful for some low-level libraries. For example, https://github.com/fmtlib/fmt provides a type-safe replacement for `printf` that can write directly to the FILE buffer providing comparable or better performance to native stdio.
Retr0id•6h ago
Doesn't fwrite more or less write directly to the FILE buffer, if buffering is enabled?

I'm curious to take a closer look at fmtlib/fmt, which APIs treat FILE as non-opaque?

Edit: ah, found some of the magic, I think: https://github.com/fmtlib/fmt/blob/35dcc58263d6b55419a5932bd...

I'm curious how much speedup is gained from this.

vitaut•6h ago
With fwrite that would be another level of buffering in addition to FILE's buffer. If you are interested in what {fmt} is doing, a good starting point is https://github.com/fmtlib/fmt/blob/35dcc58263d6b55419a5932bd.... It is also possible to bypass stdio completely and get even faster output (https://vitaut.net/posts/2020/optimal-file-buffer-size/) and while it is great for files, it may introduce interleaving problems with things like stdout.
cryptonector•6h ago
In SunOS 4.x `FILE` was not opaque, and `int fileno(FILE *)` was a macro, not a funciton, and the field of the struct that held the fd number was a `char`. Yeah, that sucked for ages, especially since it bled into the Solaris 2.x 32-bit ABI.
bodyfour•3h ago
Indeed, that was the way it originally worked in all UNIXes: https://github.com/dspinellis/unix-history-repo/blob/Researc...

It was a then-important optimization to do the most common operations with macros since calling a function for every getc()/putc() would have slowed I/O down too much.

That's why there is also fgetc()/fputc() -- they're the same as getc()/putc() but they're always defined as functions so calling them generated less code at the callsite at the expense of always requiring a function call. A classic speed-vs-space tradeoff.

But, yeah, it was a mistake that it originally used a "char" to store the file descriptor. Back then it was typical to limit processes to 20 open files ( https://github.com/dspinellis/unix-history-repo/blob/Researc... ) so a "char" I'm sure felt like plenty.

somat•6h ago
To misquote the street fighter movie: OpenBSD to Linux:

"For you the day you changed your ABI was the most important day in your life, but for me? It was Tuesday"

I enjoy the dichotomy between how bad the Linux project is at changing their ABI and how good OpenBSD is at the same task.

Where for the most part Linux just decides to live with the bad ABI forever. and if they do decide it actually needs to be changed it is a multi year drama with much crying and missteps.

I mean sure, linux has additional considerations that make breaking the ABI very scary for them. the big one is the corpus of closed source software, but being a orders of magnitude bigger project and their overall looser integration does not help any.

viraptor•6h ago
This has nothing to do with Linux-the-project. An equivalent change would be in glibc / musl / ...
ioasuncvinvaer•6h ago
I think the difference is just the amount of people using the technology.
loeg•6h ago
I think FreeBSD tried to opaque FILE[1], but it was reverted[2] and still non-opaque in main[3].

[1]: https://github.com/freebsd/freebsd-src/commit/c17bf9a9a5a3b5...

[2]: https://github.com/freebsd/freebsd-src/commit/19e03ca8038019...

[3]: https://github.com/freebsd/freebsd-src/blob/main/include/std...

asveikau•3h ago
OpenBSD tends to commit to breaking changes much more aggressively than others. Something tells me they're not reverting.
loeg•3h ago
I think FreeBSD is also more concerned with performance regression than OpenBSD is.
cjensen•2h ago
FreeBSD's implementation of FILE is a nice object-oriented structure which anyone could derive from. Super-easy to make FILE point to a memory buffer or some other user code. I used that a bunch a long time ago.

Obviously making FILE opaque completely breaks every program that used this feature, so no surprise it was reverted.

notepad0x90•5h ago
I don't know if I agree, but this is one shining example of what makes *bsd's great, not being afraid of change. Linux should take note. So much of Windows' headaches stem from not wanting to break things, and needing to support old client code.
justincormack•5h ago
There isn't really much of "Linux" here - this code is in libc, so glibc, but that was built from portability, it isn't very Linux specific. Linux doesn't have an all encpmpassing community for userspace.
notepad0x90•2h ago
I see. I thought OpenBSD maintained their own downstream fork of glibc or something since the title/link are for their site/lists.

It may not be all encompassing,but I was referring to GNU/Linux. you can swap out bits and pieces, but what mainstream distros include by default, that's what I meant.

JdeBP•2h ago
What you are looking at is not a GNU C library at all. It is a BSD C library.
wpollock•42m ago
I think you are looking for the Linux Standard Base. It started out with a great idea, but the LSB grew so large most popular distros publicly stated they would no longer pursue compliance, so the effort kinda fizzled out.
cperciva•5h ago
In addition to "some code frobs internals", non-opaque FILE also allows for compatibility with code which puts FILE into a structure, since an opaque FILE doesn't have a size.
quotemstr•4h ago
CHERI would defend against access to internal data structures without having to bounce between address spaces, FWIW.
mcculley•3h ago
Please elaborate.
quotemstr•2h ago
fopen would hand out a FILE* without capabilities to do anything with the resulting data structure, but libc itself could work with it. Libraries would get the same kind of memory protections processes do today.
purplesyringa•2h ago
How would libc get a FILE* pointer with capabilities back from a FILE* passed by the user?
quotemstr•2h ago
libc allocates the FILE* from an array of them or a heap of some sort. It has a private capability on the start of the array and so can recover a full-capability pointer by offsetting its private capability by the distance encoded in the user FILE*. No actual memory access required, I'd think.

See https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/202306...

dwattttt•1h ago
This sounds about right. Under CHERI when you're returning a pointer from a function, you can choose to limit its valid dereferencable range, I imagine all the way to 0 (i.e. it can't be dereferenced).

When the pointer is passed back into libc, libc can combine the pointer with an internal capability that has the actual size/range of the structure.

This isn't _too_ different to having libc just hand out arbitrary integers as FILE; libc has to have some way to map the 'FILE' back to the real structure.

JdeBP•3h ago
If you've ever done this to a C library, the first thing that you'll look at when someone else does it is not the FILE type, but how stdin, stdout, and stderr have changed.

The big breaking change is usually the historical implementation of the standard streams as addresses of elements of an array rather than as named pointers. (Plauger's example implementation had them as elements 0, 1, and 2 of a _Files[] array, for example.) It's possible to retain binary compatibility with unrecompiled code that uses the old getc/putc/feof/ferror/fclearerr/&c. macros by preserving structure layouts, but changing stdin, stdout, and stderr can make things not link.

And indeed that has happened here.

xpressvideoz•16m ago
So many words in the commit message and the announcement article but not a single mention of rationale? I have a bad feeling about their practice.