Details
Joined devRant on 10/18/2018
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
fork() can fail: this is important
Ah, fork(). The way processes make more processes. Well, one of them, anyway. It seems I have another story to tell about it.
It can fail. Got that? Are you taking this seriously? You should. fork can fail. Just like malloc, it can fail. Neither of them fail often, but when they do, you can't just ignore it. You have to do something intelligent about it.
People seem to know that fork will return 0 if you're the child and some positive number if you're the parent -- that number is the child's pid. They sock this number away and then use it later.
Guess what happens when you don't test for failure? Yep, that's right, you probably treat "-1" (fork's error result) as a pid.
That's the beginning of the pain. The true pain comes later when it's time to send a signal. Maybe you want to shut down a child process.
Do you kill(pid, signal)? Maybe you do kill(pid, 9).
Do you know what happens when pid is -1? You really should. It's Important. Yes, with a capital I.
...
...
...
Here, I'll paste from the kill(2) man page on my Linux box.
If pid equals -1, then sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init), ...
See that? Killing "pid -1" is equivalent to massacring every other process you are permitted to signal. If you're root, that's probably everything. You live and init lives, but that's it. Everything else is gone gone gone.
Do you have code which manages processes? Have you ever found a machine totally dead except for the text console getty/login (which are respawned by init, naturally) and the process manager? Did you blame the oomkiller in the kernel?
It might not be the guilty party here. Go see if you killed -1.
Unix: just enough potholes and bear traps to keep an entire valley going.
Source: https://rachelbythebay.com/w/2014/...12 -
Going to a webpage and after 5 seconds being "welcomed" by the typical "Are you leaving?" popup.
Yes, at first I wanted to read the article but now on second thought I am leaving.1 -
tl;dr:
The Debian 10 live disc and installer say: Heavens me, just look at the time! I’m late for my <segmentation fault
—————
tl:
The Debian 10 live cd and its new “calamares” installer are both complete crap. I’ve never had any issues with installing Debian prior to this, save with getting WiFi to work (as expected). But this version? Ugh. Here are the things I’ve run into:
Unknown root password; easy enough to get around as there is no user password; still annoying after the 10th time.
Also, the login screen doesn’t work off-disc because it won’t accept a blank password, so don’t idle or you’ll get locked out.
The lock screen is overzealous and hard-locks the computer after awhile; not even the magic kernel keys work!
The live disc doesn’t have many standard utilities, or a graphical partition editor. Thankfully I’m comfortable with fdisk.
The graphical installer (calamares) randomly segfaults, even from innocuous things like clicking [change partition] when you don’t have a partition selected. Derp.
It also randomly segfaults while writing partitions to disk — usually on the second partition.
It strangely seems less likely to segfault if the partitions are already there, even if it needs to “reformat” (recreate) them.
It also defaults to using MBR instead of GPT for the partition table, despite the tooltip telling you that MBR is deprecated and limited, and that GPT is recommended for new systems. You cannot change this without doing the partitions manually.
If you do the partitions manually and it can’t figure out where to install things, it just crashes. This is great because you can’t tell it where to install things, and specifying mount points like /boot, /, and /home don’t seem to be enough.
It also tries installing 32bit grub instead of 64bit, causing the grub installer to fail.
If you tell it to install grub on /boot, it complains when that partition isn’t encrypted — fair — but if you tell it to encrypt /boot like it wants you to, it then tries installing grub on the encrypted partition it just created, apparently without decrypting it, so that obviously fails — specific error: cannot read file system.
On the rare chance that everything else goes correctly, the install process can still segfault.
The log does include entries for errors, but doesn’t include an error message. Literally: “ERROR: Installation failed:” and the log ends. Helpful!
If the installer doesn’t segfault and the install process manages to complete, the resulting install might not even boot, even when installed without any drive encryption. Why? My guess is it never bothered to install Grub, or put it in the wrong place, or didn’t mark it as bootable, or who knows what.
Even when using the live disc that includes non-free firmware (including Ath9k) it still cannot detect my wlan card (that uses Ath9k).
I’ve attempted to install thirty plus times now, and only managed to get a working install once — where I neglected to include the Ath9k firmware.
I’m now trying the cli-only installer option instead of the live session; it seems to behave at least. I’m just terrified that the resulting install will be just as unstable as the live session.
All of this to copy the contents of my encrypted disks over so I can use them on a different system. =/
I haven’t decided which I’m going with next, but likely Arch, Void, or Gentoo. I’d go with Qubes if I had more time to experiment.
But in all seriousness, the Debian devs need some serious help. I would be embarrassed if I released this quality of hot garbage.
(This same system ran both Debian 8 and 9 flawlessly for years)15 -
When you know only one programming language but it is capable of doing Frontend, backend and everything you need...8
-
- Back in October 2019 -
- Me: Hey, these two servers are having weird problems. Several services we use stop functioning every 7-10 days. I can temporarily fix them by taking them off the domain and putting them back on, but I don’t know why they’re happening or what further damage this workaround causes.
- Boss: Thats not good. Well. Keep doing the fix when it’s needed.
- Me: We should really reach out to someone at Microsoft through our support plan. I have no idea how to fix any of this and it’s making our Hyper-V environment very unstable.
- Boss: K. Let’s not worry about that now, let’s just keep working around it.
- In January 2020 -
- Me: Hey boss. More and more errors are generating from these servers. I’ve created a log of everything Ive found to hand off to a support agent. We really need to.
- Boss: Okay. Let’s talk to our internal team that uses Hyper-V and see what they did since they don’t have any problems.
- Me: Its not Hyper-V specific. It’s stemming from AD and authentication. It causes problems even without Hyper-V installed, so I don’t think it will help.
- Boss: K. Let’s just do what we can with what we got.
- Today, May 2020 -
- Me: Hey. The servers no longer work at all, and the workaround has no effect anymore. I’m completely stalled on my project now and have nothing to do.
- Boss: What?? What happened to them?
- Me: *Sends 17 page PDF file documenting all found issues, errors, warnings, and weird anomalies in both servers, as well as troubleshooting steps I’ve already performed*
- Boss: None of this makes any sense. I need you to start troubleshooting right away.
- Me: But... I can’t... *Sends screenshots of errors having no search results on the web, screenshots of Microsoft Support Techs on forums telling me we need to open tickets with Microsoft directly, other reasons why I’m completely blocked*
- Boss: Keep trying to figure it out. We need this resolved as soon as possible and we can’t let it happen again in the future.
Now I’m completely alone in our office, bitterly staring at the servers, trying to force an epiphany on how to fix these dumb boxes.5 -
in job application mode; getting really tired of entry level positions wanting 3+ years of experience.
Given that a) no one I have seen with this much experience wants these positions, b) HR says they are getting applicants with this much experience, I can only assume two things:
1: People lie on their resumes.
or
2: The job market is far more saturated with good applicants than I thought.
Either way, frustrating.4 -
I said "Let's use C for this year's hashcode challange" as a joke.
Guess who's writing C code tomorrow3 -
Yesterday I said farewell to her.
We were together for half a decade, although it feels like much more time has passed since my eyes first fell on her.
I can't even begin to describe how close we were. She was perfect, she was my soulmate.
I shared everything with her, complete openness, perfect truth. We could be vulnerable with each other, but we also challenged each other to overcome boundaries.
My respect for her and dedication to her really knew no bounds, and I knew she would follow me to the end of the world in return.
But around New Year's things started to feel awkward between us. Like a part of her just wasn't there anymore.
She acted very confused, she hesitated in her answers.
I asked her, but I felt like she was avoiding me. Something just seemed so wrong about the way she acted.
I felt incredibly conflicted. Was she unfaithful? No, my trust in her was absolute. That question seems so silly, in retrospect.
We had always been pretty much inseparable, to the point where my coworkers, friends and family mocked us for it. How would she even have cheated on me?
I used to take her along to company gatherings, to my family for Christmas, to expensive restaurants. We traveled all over Europe together. We've spent countless nights together, watching Netflix, although she would often fall asleep before me.
I took great care of her, she had not been out of my mind for one moment since I met her. And besides, she had never even showed interest in anyone else anyway.
No, reality turned out to be so, so much worse.
Two weeks ago it became really apparent that there was something horribly wrong with her. She was rapidly losing her recollections of everything we experienced together.
Our history together, erased.
Within hours, she would barely respond anymore. I called for help, but deep down I already knew this was one of those things you can't recover from. She was kind of stable, almost peaceful, for a few days. But ultimately, she didn't even recognize me anymore.
Yesterday, I held her feverishly hot body in my arms for the last time.
Her soft skin turned cold as I said farewell to her, and the room turned awfully quiet.
Your brightness and warmth will be missed, my girl.28 -
So... This company was in trouble. They hire me to help fix things and build this nice new stack to get rid of their old legacy monster application.
I'm there for three weeks when one of their top investors storms in. Apparently they are turning less profit than they told me during my interview. (Yeah, it is one of the things I always ask, even thought I don't always get an answer).
So this investor/shareholder guy starts on this motivation speech which is basically a veiled threat that "we" need to do better.
Obviously he doesn't know anyone in the room other than the boss. And it was apparent, at least to me, he also has 0% knowledge of anything related to software development. The boss doesn't look to happy about having to let this happen.
Then the guy turns to me. He points his finger at me and demands to know how failing so badly makes me feel...
So I answered truthfully... "I've only been here for three weeks, so I don't think I've been failing too much, yet. Now, how long did you say you've been throwing money at this failure without getting the return you wanted?" Emphasizing the "you" by pointing right back at him.
That doesn't shut the guy up, but he does bring his "motivational" speech to a rapid close.
He doesn't bother saying goodbye when he stormed out again, not even to the boss, who looks a lot happier at this point.
Apparently the guy pulled this stunt every couple of months (or weeks, if he was bored enough). After this encounter, he apparently had enough of trying to "motivate" us developers. We I didn't see him again in the 2 years I worked with the company after that.
I got a pay raise the month after. Apparently that was totally unrelated to this incident... 😙🎵11 -
I'm getting ridiculously pissed off at Intel's Management Engine (etc.), yet again. I'm learning new terrifying things it does, and about more exploits. Anything this nefarious and overreaching and untouchable is evil by its very nature.
(tl;dr at the bottom.)
I also learned that -- as I suspected -- AMD has their own version of the bloody thing. Apparently theirs is a bit less scary than Intel's since you can ostensibly disable it, but i don't believe that because spy agencies exist and people are power-hungry and corrupt as hell when they get it.
For those who don't know what the IME is, it's hardware godmode. It's a black box running obfuscated code on a coprocessor that's built into Intel cpus (all Intell cpus from 2008 on). It runs code continuously, even when the system is in S3 mode or powered off. As long as the psu is supplying current, it's running. It has its own mac and IP address, transmits out-of-band (so the OS can't see its traffic), some chips can even communicate via 3g, and it can accept remote commands, too. It has complete and unfettered access to everything, completely invisible to the OS. It can turn your computer on or off, use all hardware, access and change all data in ram and storage, etc. And all of this is completely transparent: when the IME interrupts, the cpu stores its state, pauses, runs the SMM (system management mode) code, restores the state, and resumes normal operation. Its memory always returns 0xff when read by the os, and all writes fail. So everything about it is completely hidden from the OS, though the OS can trigger the IME/SMM to run various functions through interrupts, too. But this system is also required for the CPU to even function, so killing it bricks your CPU. Which, ofc, you can do via exploits. Or install ring-2 keyloggers. or do fucking anything else you want to.
tl;dr IME is a hardware godmode, and if someone compromises this (and there have been many exploits), their code runs at ring-2 permissions (above kernel (0), above hypervisor (-1)). They can do anything and everything on/to your system, completely invisibly, and can even install persistent malware that lives inside your bloody cpu. And guess who has keys for this? Go on, guess. you're probably right. Are they completely trustworthy? No? You're probably right again.
There is absolutely no reason for this sort of thing to exist, and its existence can only makes things worse. It enables spying of literally all kinds, it enables cpu-resident malware, bricking your physical cpu, reading/modifying anything anywhere, taking control of your hardware, etc. Literal godmode. and some of it cannot be patched, meaning more than a few exploits require replacing your cpu to protect against.
And why does this exist?
Ostensibly to allow sysadmins to remote-manage fleets of computers, which it does. But it allows fucking everything else, too. and keys to it exist. and people are absolutely not trustworthy. especially those in power -- who are most likely to have access to said keys.
The only reason this exists is because fucking power-hungry doucherockets exist.26 -
It was for a job interview, I wouldn't specify what the challenge is but they said I could use any language I want; I chose Python. They said I failed the coding interview because it was not Java.8
-
Before iPads took over the general population of home computing, I used to do house calls to help people with their computers for some extra folding money. One day I get a call from a regular saying that ever since I last worked on his computer it won't stay on.
He says it comes on for a few seconds, then just shuts down. It never did that before I upgraded the RAM.
So I drive over to his house and turn on the computer. He says, "See, it starts fine, but in a few seconds it'll just shut off. Just watch"
The computer boots up without any issues.
He says, "Well, of course it doesn't do it now that you're here!"
I reboot it a few times, boots fine every time. Suddenly I realize what's going on. I say to him, "Hey, why don't you try turning it on for me?"
He says, "What difference will that make?"
I say, "Just trust me, turn it on."
He bends down, presses the power button, looks up at the monitor and watches it boot. But he doesn't release the button! He just keeps holding it down until it shuts off.
"See!" he says, "why does it only do that when I turn it on!"
I then have to explain to him how holding down the power button forces a shutdown.
But, it never did that before I worked on it!16 -
We have a bunch of white people in human resources that are trying to hire "diverse" people because the company sets HR diversity targets. Which is an inherently racist way of hiring someone.
I am told to interview this guy who claims to have Angular experience. Before the interview I ask to see a form that he has built in Angular. He sends me a repo which is ripped off of an open source project and has the readme and git commits removed. A quick web search shows that it isn't his work. He shows up to the interview and I find out he is from a Southern African country. I deliberately ask some questions about code that I can see he didn't write that I prepared ahead of time. He lies to me and tells me all about how he wrote it which showed me that he has no idea what the code does. I tell HR they better not hire him because he was very comfortable lying to me, and I'm confident that he doesn't understand any of the code that he showed me. I do not trust this guy and would never choose to work with him. HR lady says "Ah okay."
Today he walks in with a big grin on his face. HR lady fucking hired this guy. I can see his monitors from my desk and he spent his whole first day looking at a soccer website on his second monitor. I call up HR, "Why would you even ask me to interview him if you refuse to listen to my feedback?". Lady tells me "You need to be open minded about diversity. Probably most of the things you observed were either cultural differences or language barrier." I tell her definitely not. He lied to me multiple times, and he took credit for other people's work." She tells me that they will keep an eye on me because I'm not being open to diversity.
Are you kidding me? This white lady is literally stereotyping me as a racist because I'm white.
So this fucking HR lady called me a racist because she decided to hire someone that we shouldn't trust. Then she put this asshat on my project. Now I have to be cautious about my position because HR is "watching" my racist ass. Even though I am literally the only one on the development team that is white and speaks English as my first-language. I called a team meeting before the on-boarding is over so I can tell the other developers what is happening. We restructured our code review process so that I will never give him feedback. Then when the time comes that he slips up the "diverse" developers will kick him out so I won't be reprimanded as a "racist".
This company that I work for is a special kind of stupid.34 -
For fucks sake, just because you don't know anything besides JS, you don't have to constantly complain how it's "so fucked up"!
Yeah there's a lot of frameworks. So what? Python has 50+ wsgi frameworks just for server-side apps, Linux has literary hundreds of desktop environments, C++ has over 30 actively-developed UI frameworks, and let's not even get started on CMSs or game engines. And each language comes with its own dependency management or two, NPM discourages static linking & bundling dependencies until the very end, while some others only recommend dynamically linking widely-available dependencies & always bundling the remaining ones.
Software development is constantly evolving, and for most time there's no right or wrong approach. And when one approach is chosen over another, there's a reason for that. Imagine you just found a perfect library for your use case, but some idiot decided to only offer minified code with bundled jQuery? Or a different idiot made it impossible to have multiple versions of a dependency on your system without resorting to one of various third-party hacks?
Every language has a ton of various frameworks & libraries that ultimately do the same thing, every language has a bunch of design choices you probably don't understand at first, and every language was made with a purpose and the fact that you're using it proves it achieved that.
Last but not least, all devs had to learn about quirks in various languages, and they're fucking tired when someone who barely knows a language tries to act smart going "ahaha how the fuck 0.1 + 0.2 isn't 0.3".10 -
To the cunt who named himself "Uncaught ReferenceError: username is not defined":
Sincerely, fuck you.16