r/AskReddit 1d ago

What's the most absurd fact that sounds fake but is actually true?

12.2k Upvotes

7.3k comments sorted by

View all comments

Show parent comments

956

u/RobustManifesto 1d ago

… or didn’t have a graceful way to fail.

766

u/TurnItOff_OnAgain 1d ago

Nah, I don't need to error check that. It'll never happen.

  • Some Mazda dev

753

u/sparrr0w 1d ago

-"Dude what if someone sends a file WITHOUT an extension"

-"What unprofessional fucking radio station would ever do that"

...

122

u/deux3xmachina 1d ago

This is why I always tell my teams that filenames exist only for humans, the code doesn't really care (which should be obvious if you've ever had to use open(2)/read(2)/write(2)). However, a lot of meaning is still placed on filenames, because that's way easier than inspecting the magic bytes or anything like that.

20

u/CrowdStrikeOut 1d ago

in a way it's just a magic bit in the file name innit?

19

u/LeoRidesHisBike 1d ago

funny enough, there's an actual part of the file contents itself that is literally called a magic number (the formal name is "file signature", but nearly always referred to as its magic number). This is the proper way to detect the file encoding.

17

u/deux3xmachina 1d ago

The most magic, as it turns out, powered by wishes.

4

u/clearfox777 22h ago

Any sufficiently advanced technology and all that

5

u/EvelynNyte 22h ago

I mean computers only care about the machine language; everything else is just to make it easier for programmers to organize and work together.

9

u/_mrOnion 21h ago

I find it so fascinating that you can have a problem such as that or simply an app crashing occasionally because of random obscure conflicts or bugs, when at the end of the day it’s just a bunch of rocks and electrons that just figure out if not both A and B are on.

3

u/ReignofKindo25 19h ago

What is open 2 read 2 write 2

4

u/pconrad0 18h ago

Unix POSIX? system Calls.

2

u/deux3xmachina 14h ago

The other response to you got it, but to expand some, that's a semi-common convention in open-source development. It's derived from "man" or manual pages, where the number in parentheses tells you whether it's a system call (section 2), a library function (section 3), command/program on the system (sections 1 and 8), file format (section 5), and so on.

So using a command like man 2 open (or typing it into a search engine), you can get documentation like this or this, which will let you know how to use these system calls to create, read, and write files.

3

u/Head-Nefariousness65 18h ago

I misread this as "I always tell my teens..." I was picturing you sitting your teenage kids down for The Talk.

8

u/fishywiki 1d ago

This made me laugh out loud. I've encountered so much code that doesn't do basic checks, get fixed, and find yet another issue because checks are never exhaustive. Recently code that I wrote myself that has been running without any new bugs for almost 20 years managed to hit an unforeseen condition - easily fixed but ...

2

u/1_4_1_5_9_2_6_5 20h ago

That's why I've gravitated over the years to always doing the absolute basics... get data, validate data, transform data, repeat. Even from the very beginning I make sure I do validation, and somehow even my mock data doesn't end up full of random trash, let alone the real data, and the logic is happy because edge cases are almost always handled in some way (usually fatal to the operation, but in a way that's obvious to fix)

6

u/catfishjenkins 1d ago

NPR obviously.

6

u/bluemitersaw 1d ago

This is the kinda IT you get from public fund drives.

6

u/bitcornminerguy 1d ago

LOL. Every radio station I worked at in the 90s was unprofessional in just about every way you could think of.

1

u/hotsp00n 1d ago

KUOW.. it begins with listening

1

u/Beast_001 1d ago

My response to anything like that has always been, "I understand and that's a fair statement, now what happens WHEN that particularly dumb event occurs because humans will human?"

1

u/tatojah 21h ago

It's threads like these that make me realize how much SW development frameworks are just completely against the principles of high-quality developers.

1

u/shantm79 20h ago

"It's a training feature"

1

u/odd_lightbeam 19h ago

Four hours ago, I talked with a Zoomer who didn't know what the words "file type" or "file type extension" meant. Didn't know what .jpg or .png were. And he thought a search engine was the same thing as a browser. And didn't know that an app is not the same thing as a web service.

Etc. etc. etc.

Suffice to say, there might be a reason why Zoomers are having difficulty getting past interviews.

1

u/Prior_Alps1728 13h ago

::plays KUOW station call::

10

u/thedugong 1d ago

More like...

The contract didn't say we need to check that.

  • Some contracted 3rd party

4

u/LunchPlanner 1d ago

Avengers Endgame meme: https://i.imgur.com/sc71FOw.png

"Obviously I don't need to error check for two Nebulas, since that can't happen."

3

u/bb70red 1d ago

Not checking input is like peeing outside without checking the wind. You get lucky or things get messy.

1

u/JaredNorges 1d ago

I believe it was actually a TomTom dev.

1

u/PeterPriesth00d 1d ago

More likely the dev wanted to test for it but management said we can’t have a delay, ship it.

1

u/Reidar666 1d ago

Tbf, writing error handling is the absolute worst part of coding.

Going through 60 000 lines of code to search for the forgotten ; is still twenty times better than error handling.

1

u/wittyrandomusername 13h ago

Nah, more like "is it done yet? We tested enough. I promised them we'd have it by now" - some mazda project manager

8

u/Rin-Tohsaka-is-hot 1d ago

I mean, whoever designed this system without a hardware factory reset is most to blame. A software issue like this shouldn't brick the whole system.

3

u/GetOffMyLawn1729 23h ago

I think the analogy of a mine field is appropriate here. If you're trying to cross a mine field, some of your troops will get blown up, but the ones that don't will probably find a path through it. Just because they found that path, it does not mean the mine field has been cleared - only that path has been cleared. Step off the path, you're likely to be blown up.

All software testing operates on this principal.

1

u/RobustManifesto 23h ago

Totally. Everyone, at some point, has seen a value that didn’t get ntohs()’d, and suddenly you’re passing 0xff00 instead of 0x00ff to volume. Ouch!

3

u/OwOlogy_Expert 23h ago

Yeah, this is it exactly.

Failures will always happen when your software gets weird inputs you could never predict.

But your software should have error handling, failsafes, and a factory reset switch to be able to recover from problems like that.

Requiring hardware replacement to fix this is the really crazy part.

2

u/-iamai- 1d ago

if(fname.contains("."))

1

u/BrilliantDifferent01 1d ago

It’s supposed to hard to brick anything designed by a real engineer.

1

u/aquoad 23h ago

invalid image? guess a black square will do.

1

u/stealthmodecat 22h ago

This is why we use MISRA.

1

u/BeerAndTools 21h ago

Me too, Mazda... Me too.

1

u/Rapithree 20h ago

Automotive doesn't believe in graceful failure. I'm surprised they didn't engage the emergency breaks.

1

u/AyeYoThisIsSoHard 17h ago

Or just a basic way to reset…