this post was submitted on 21 Mar 2025
640 points (99.5% liked)

Programmer Humor

21772 readers
1752 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Original post: hachyderm.io (Mastodon)

top 50 comments
sorted by: hot top controversial new old
[–] 30p87@feddit.org 179 points 2 days ago* (last edited 2 days ago) (2 children)

So we need to be careful with upper- and lowercase. Meanwhile the docs: > settiings

[–] janonymous@lemmy.world 98 points 2 days ago (2 children)

Yes, the settiings are different than the settings. You also need to be careful with those.

[–] Bezier@suppo.fi 31 points 2 days ago

had to use a different spelliings at backend and frontend, otherwise it wouldn't work.

[–] LovableSidekick@lemmy.world 9 points 1 day ago* (last edited 1 day ago) (1 children)

no, settings = settings but settings != Settings, as we all know.

[–] Trainguyrom@reddthat.com 5 points 1 day ago (1 children)

There's a double-i in "settings" in the documentation screenshot

[–] LovableSidekick@lemmy.world 5 points 1 day ago (1 children)

That's what I get for having sucky vision.

load more comments (1 replies)
load more comments (1 replies)
[–] jjjalljs@ttrpg.network 86 points 2 days ago (5 children)

Is the backend Python and the frontend JavaScript? Because then that would happen and just be normal, because Boolean true is True in python.

[–] testfactor@lemmy.world 129 points 2 days ago (4 children)

Probably, but if you're interpreting user inputs as raw code, you've got much much worse problems going on, lol.

[–] LostXOR@fedia.io 32 points 2 days ago (1 children)

[...]&register=import os; os.system("sudo rm -rf /"); return True

[–] MajorHavoc@programming.dev 15 points 1 day ago

Hey, that's my username too. Or it was going to be, while the site was still up.

What a coincidence!

I guess I'll wait for the site to come back, and see if it's still available...

[–] mmddmm@lemm.ee 17 points 2 days ago (1 children)

It's the settiings file... It's probably supposed to only be written by the system admin.

[–] raldone01@lemmy.world 8 points 2 days ago* (last edited 1 day ago) (2 children)

A good place to put persistent malware. That's why when using docker images always mount as ro if at all possible.

[–] ashley@lemmy.ca 8 points 1 day ago

It’s you can modify the settings file you sure as hell can put the malware anywhere you want

load more comments (1 replies)
[–] 0x0@lemmy.dbzer0.com 7 points 1 day ago (1 children)

Given the warning about capitalization, the best possible case is that they're using ast.literal_eval() rather than throwing untrusted input into eval().

Err, I guess they might be comparing strings to 'True' and are choosing to be really strict about capitalization for some reason.

[–] MajorHavoc@programming.dev 11 points 1 day ago

Yeah. Maybe .to_lower() is really expensive in their environment, lol.

It's not User input, it's config file

[–] shortrounddev@lemmy.world 21 points 1 day ago (3 children)

I curse the sadist who decided True should be uppercase in Python

load more comments (3 replies)
[–] Aatube@kbin.melroy.org 16 points 2 days ago (3 children)

Can't they just convert a "true" input to backend to uppercase

[–] PotatoesFall@discuss.tchncs.de 26 points 2 days ago

Yep they should use a config file format like JSON or TOML or YAML or what have you, and then decode that into python objects. Using an actual programming language for config is dumb as hell IMO. (inb4 pissed off suckless fans)

[–] jjjalljs@ttrpg.network 5 points 2 days ago (2 children)

Depends on how it's set up. If the setting is going into the env it's a string, so I'd expect some sort of

if os.getenv("this_variable", "false").lower() == "true":   # or maybe "in true, yes, on, 1" if you want to be weird like yaml
  this_variable = True
else:
  this_variable = False

Except maybe a little more elegant and not typed on my phone.

But if the instructions are telling the user to edit the settings directly, like where I wrote this_variable=True, they'd need to case it correctly there.

load more comments (2 replies)
load more comments (1 replies)
[–] MHLoppy@fedia.io 9 points 2 days ago

Searching for the phrase, documentation matches for Taiga so maybe you're right!

load more comments (1 replies)
[–] SatyrSack@feddit.org 77 points 1 day ago (9 children)

Could be worse. At least it's documented

load more comments (9 replies)
[–] Aurenkin@sh.itjust.works 33 points 2 days ago (2 children)

The cherry on top is that they didn't even spell settings correctly.

[–] SpaceNoodle@lemmy.world 25 points 1 day ago

settiings is spelled differently on the backend

load more comments (1 replies)
[–] fibojoly@sh.itjust.works 19 points 1 day ago (1 children)

Glorious. I remember some hilarious nonsense in an API where the devs I worked with hadn't known they could just use boolean in JSON and had badly implemented it through strings, but this... This is amazing!

[–] jimmux@programming.dev 7 points 1 day ago

At my last job we had a lot of old code, and our supposedly smartest framework people couldn't be bothered learning front end properly. So there was a mix of methods for passing values to the front end, but nobody seemed to think of just passing JSON and parsing it into a single source of truth. There was so much digging for data in hidden columns of nested HTML tables, and you never knew if booleans would be "true", "TRUE", "1", or "Y" strings.

Never mind having to unformat currency strings to check the value then format them back to strings after updating values.

I fixed this stuff when I could, but it was half baked into the custom framework.

[–] dpflug@kbin.earth 15 points 1 day ago (1 children)

Implying Hell is frontend.... yeah, actually, that tracks.

load more comments (1 replies)
[–] BeigeAgenda@lemmy.ca 14 points 2 days ago (2 children)

Hear me out, what about using JSON to store the configuration in the Python backend?

[–] UnfortunateShort@lemmy.world 9 points 2 days ago

You need to use as many different formats as possible, otherwise you look unprofessional

[–] MajorHavoc@programming.dev 6 points 1 day ago

I like your idea, but hear me out:

A Python file for configuration is the best way to guarantee that any friendly code I write to help the user with config usually won't execute. And I hate my users.

[–] Tja@programming.dev 13 points 1 day ago (1 children)

And you all complained when in C we used 1 and 0...

[–] npcknapsack@lemmy.ca 6 points 1 day ago (2 children)
load more comments (2 replies)
[–] oldfart@lemm.ee 13 points 1 day ago (2 children)

What happened to the good old 1

[–] LeFrog@discuss.tchncs.de 20 points 1 day ago

Backend: 1

Frontend: ¹

load more comments (1 replies)
[–] lily33@lemm.ee 10 points 2 days ago

That makes me think, perhaps, you might be able to set it to exec("stuff") or True...

[–] ramble81@lemm.ee 9 points 1 day ago (2 children)

I’ve always hated case sensitivity. I know that at an ASCII level “variable” != “Variable” but is there really a reason to have a distinction between them?

[–] vithigar@lemmy.ca 21 points 1 day ago (1 children)

You stated the reason yourself. Those are different values and matching in a case-insensitive manner is more work under the hood.

[–] ramble81@lemm.ee 5 points 1 day ago (3 children)

We do plenty of stuff for human consumption. Computers work for us, not the other way around. Insensitivity should be the default. It’s okay to give options. I’m not saying take that away.

[–] WordBox@lemmy.world 5 points 1 day ago

Humans have to make it do the work. And that's how Mr; DROP TABLE makes his money.

load more comments (2 replies)
[–] fibojoly@sh.itjust.works 17 points 1 day ago

You are thinking it's easy because you only think of e == E, but I'll let you look up collation and accents and, you know, Unicode and let you think about it.

There is nothing trivial about case sensitivity, except in trivial cases.

var true = false;

var false = true;

[–] LovableSidekick@lemmy.world 8 points 1 day ago* (last edited 1 day ago) (3 children)
load more comments (3 replies)
[–] Draegur@lemm.ee 7 points 1 day ago

Cap in the back, low-key up front. Got it.

[–] dave@feddit.uk 5 points 1 day ago
[–] owl@infosec.pub 5 points 1 day ago

't'+'r'+'u'+'e'

load more comments
view more: next ›