this post was submitted on 06 Mar 2024
58 points (92.6% liked)

Programmer Humor

32396 readers
1101 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
top 18 comments
sorted by: hot top controversial new old
[–] [email protected] 28 points 8 months ago (2 children)

I don't code, but is hardcoding sudo EVER a reasonable thing in C?

[–] [email protected] 21 points 8 months ago

It's not reasonable in any language

[–] [email protected] 12 points 8 months ago
[–] [email protected] 16 points 8 months ago (5 children)

Putting aside the "should/shouldn't do" argument, I was also wondering if the code is even viable. I imagine that 'ls' and 'sudo' are probably pretty ubiquitous, but I bet there exist some Linux installs out there with a different shell than 'bash', and some might not have 'grep' too. That would lead to some pretty cryptic bugs for the end user, eh?

[–] [email protected] 16 points 8 months ago (1 children)

I might be wrong, but I believe Debian ships without sudo, only su by default (or at least if you configure a root password in the setup).

[–] [email protected] 11 points 8 months ago* (last edited 8 months ago) (1 children)

You're right ! And I really should get used to how debian works with su.

But with docker it's very convenient to add an user in the docker groupe with sudo :/

[–] [email protected] 6 points 8 months ago

And I really should get used to how debian works with su.

I only know because installing sudo is usually the very first thing I do whenever I have to install it haha.

[–] [email protected] 13 points 8 months ago (2 children)

I bet there exist some Linux installs out there with a different shell than 'bash',

100%. Alpine is one such distro.

[–] [email protected] 7 points 8 months ago

Also, doas instead of sudo

[–] [email protected] 2 points 8 months ago

Iirc Void too.

[–] [email protected] 6 points 8 months ago

That code is a crime against nature and humanity.

[–] [email protected] 4 points 8 months ago

I believe POSIX mandates grep and a shell that should be able to handle everything this code uses, but sudo is a problem

[–] [email protected] 1 points 8 months ago

Debian doesn't come with sudo and it's always annoying running into stuff that has it hardcoded (or just added by default to a command)

[–] [email protected] 13 points 8 months ago

FYI, the Intel code used to be here (https://github.com/intel/thunderbolt-utils) but apparently was archived a week ago. So instead, the video creator posted the fork here: https://github.com/rxrbln/thunderbolt-utils

[–] [email protected] 5 points 8 months ago (1 children)

geez I tried my best not to be stereotypical, but...I am a flawed human being and I searched for their linkedin profile, it suddenly all checks out

[–] [email protected] 4 points 8 months ago (1 children)

I don't like cryptic message like this, especially if the repo seems to be gone

[–] [email protected] 1 points 8 months ago (1 children)

I don't like being cryptic at all, but "free speech" doesn't always include discriminatory ones. And being flawed, I can't stop my brain from generating those thoughts, so I just tried to be a slightly friendlier a*hole. Otherwise I could have said: PhD, yeah of course, so many of them are so used to writing shitty code without peer reviews for so long, that totally checks out. And Indian...again. well, no wonder.

[–] [email protected] 1 points 8 months ago* (last edited 8 months ago)

Yeah that's a stereotype. Some many brilliant people and somehow the fuck ups (not the people but their fuck ups) generate all the attention. I didn't think of that stereotype and was curious. But seriously blaming a (maybe even a fresh)PhD for being bad at coding is both fair and unfair but no peer review is not on them.