Original post: hachyderm.io (Mastodon)

188 points
*

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

permalink
report
reply
105 points

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

permalink
report
parent
reply
38 points

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

permalink
report
parent
reply
12 points
*

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

permalink
report
parent
reply
6 points

There’s a double-i in “settings” in the documentation screenshot

permalink
report
parent
reply
6 points

They specifically said “this is not a typo”!!!

permalink
report
parent
reply
91 points

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

permalink
report
reply
138 points

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

permalink
report
parent
reply
36 points

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

permalink
report
parent
reply
18 points

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…

permalink
report
parent
reply
19 points

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

permalink
report
parent
reply
9 points
*

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

permalink
report
parent
reply

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.

permalink
report
parent
reply
12 points

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

permalink
report
parent
reply
5 points

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

permalink
report
parent
reply
21 points

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

permalink
report
parent
reply
3 points

guido, why did you make python so weird?

permalink
report
parent
reply
8 points

In this instance, I think there was some suggestion to write code in mostly lower case, including all user variables, or at least inCamelCaseLikeThis with a leading lower case letter, and so to make True and False stand out, they’ve got to be capitalised.

I mean. They could have been TRUE and FALSE. Would that have been preferable? Or how about a slightly more Pythonic style: __true__ and __false__

permalink
report
parent
reply
16 points

Can’t they just convert a “true” input to backend to uppercase

permalink
report
parent
reply
28 points

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)

permalink
report
parent
reply
5 points

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.

permalink
report
parent
reply
2 points

Fyi, using a condition to assign a boolean is equivalent to assigning the condition itself. No need for the IF.

permalink
report
parent
reply
4 points

I refer you to #7 on Bruce Tognazzini’s evergreen top ten list of design bugs.

https://www.asktog.com/Bughouse/10MostWantedDesignBugs.html

permalink
report
parent
reply
9 points

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

permalink
report
parent
reply
1 point
Deleted by creator
permalink
report
parent
reply
85 points

Could be worse. At least it’s documented

permalink
report
reply
-12 points

To me the biggest problem, that AI might solve is documentation.

permalink
report
parent
reply
29 points

Have you tried to use AI for documentation? It’s pretty shit.

permalink
report
parent
reply
15 points
*

Have you tried to use AI for <thing>? It’s pretty shit.

permalink
report
parent
reply
8 points
*

I’ve used AI to give me a good enough guess that I know the right keywords to search for too find the real documentation.

permalink
report
parent
reply
2 points
*

How about this:
Humans (or humans assisted by AI) write documentation
Users (devs included) can either choose to read the manual the old fashioned way or utilize it like a sort of swagger api documentation to give

  1. Information to a question (How to do x)
  2. Provide a general example
  3. (Assuming it’s used with an IDE or has information about the project) Provide a personalized example on the implementation.
permalink
report
parent
reply
1 point

I’ve had pretty good experience with using AI to find what I’m looking for in documentation, especially if the docs are in context

permalink
report
parent
reply
33 points

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

permalink
report
reply
25 points

settiings is spelled differently on the backend

permalink
report
parent
reply
4 points

I swear, spelling mistakes are such an indicator for a codebase and the overall quality of the software team, and maybe the whole company. No attention paid to detail leaks out into other areas.

permalink
report
parent
reply
20 points

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!

permalink
report
reply
9 points

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.

permalink
report
parent
reply
2 points

A system I work with gives all keys a string value of “Not_set” when the key is intended to be unset. The team decided to put this in because of a connection with a different, legacy system, whose developers (somehow) could not distinguish between a key being missing or being present but with a null value. So now every team that integrates with this system has to deal with these unset values.

Of course, it’s up to individual developers to never forget to set a key to “Not_Set”. Also, they forgot to standardise capitalisation and such so there are all sorts of variations “NOT_SET”, “Not_set”, “NotSet”, etc. floating around the API responses. Also null is still a possible value you need to handle as well, though what it means is context dependent (usually it means someone fucked up).

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 8.6K

    Monthly active users

  • 1.2K

    Posts

  • 25K

    Comments