WTF Bites
-
@Tsaukpaetra said in WTF Bites:
to be uninitialized
Speaking of, en route to trying to make the game servers run on Linux I discovered apparently it's a Bad Idea to initialize variables out of order. Who knew?
I have this slight feeling that both you[r] and @remi’s cow-orkers are doing C++ (or is it C?) very wrong.
-
@aitap Hm, yeah,
vfork()
. That should work. Has its own downsides of course. And I'm not sure from the back of my head what the difference is between that clone call and a normal vfork.
-
@Tsaukpaetra said in WTF Bites:
to be uninitialized
Speaking of, en route to trying to make the game servers run on Linux I discovered apparently it's a Bad Idea to initialize variables out of order. Who knew?
I have this slight feeling that both you[r] and @remi’s cow-orkers are doing C++ (or is it C?) very wrong.
Mostly it's just auto constructor terms being out of order, nothing is being done in code otherwise to explicitly do it out of order (well, in the constructor section proper...)
-
@Tsaukpaetra gcc warns about that.
-
@PleegWat Ah, now I recall. In a normal
fork()
from a multithreaded process all threads have to be paused in order to perform the fork. Doing so takes time (though I never bothered finding out how much). This probably also applies to thisclone()
sinceCLONE_THREAD
is not passed (and cannot be passed because the new process is intended toexec()
out).vfork()
of course is tricky because it reuses the calling thread's stack, so there's quite a bunch of stuff you can't do to ensure all the assumptions the parent is making about its stack are still true. Most of that probably doesn't apply here becauseclone()
allocates a new stack.The other traditional disadvantage of
vfork()
is that it is impossible to handle a failedexec()
, but linux bypasses that by allowing_exec()
to be called as well.I ended up solving this problem with a helper process and a pipe.
-
@Tsaukpaetra gcc warns about that.
That's how I started discovering them.
-
This post is deleted!
-
@Zerosquare said in WTF Bites:
We need to bring back tarring and feathering.
TheDailyWTF?
Oh, literal TaF - I approve.tar | brotli
should be in every BOFH's toolbox."Brotli" is the Swiss variant of a traditional German punishment for bad boys:
-
Do you mean the cost of forking?
Yes.
I thought modern Unices had more or less cheap fork because of copy-on-write (and there is also posix_spawn) and Windows wasn't supposed to have this problem because of their spawning model.
It's supposed to be like that, but doesn't always work out in practice. No idea why. (Could be
atfork
handlers causing trouble, which would explain why it isn't universal.) It doesn't matter unless the system is a bit underpowered/overloaded for its task, as webservers aren't really all that heavy as processes go (IDEs and the like are far far worse).
-
I was writing a simple program using mosquitto (a mqtt library). The interface is very simple: you call a few initialization functions, then you call mosquitto_loop_start. This starts a background thread to process messages and call your callback functions. Except mosquitto_loop_start was returning MOSQ_ERR_NOT_SUPPORTED, which according to the documentation means "thread support is not available".
So, wtf could that be caused by? I'm pretty sure my OS supports threads. Eventually I checked the source code:
int mosquitto_loop_start(struct mosquitto *mosq) { #ifdef WITH_THREADING //irrelevant stuff #else return MOSQ_ERR_NOT_SUPPORTED; #endif }
And where is WITH_THREADING defined? At compile time. And I downloaded the official compiled version for Windows.
So... no threading because fuck you?
-
... and the bug was just a simple typo that caused the "file open mode" to be uninitialized. [...] Proper tests (what's that?) would probably have helped but... Could have been worse.
No, including
-Wall -Wextra
in your CFLAGS would have helped. And-Werror
, if you can't get a proper warning policy through to them.I have no idea how VS or gcc (the two compilers we use) work, except that in that specific case they never spouted a warning on that code, trivial or not
(with -Wall -Wextra)
-
I have this slight feeling that both you[r] and @remi’s cow-orkers are doing C++ (or is it C?) very wrong.
You can probably include me in the list as well, I don't claim to write perfect (or even good) code. I have the hubris to believe that I am, at least, aware of my own limitations, but I'm pretty sure someone else looking at my code would disagree... (and also to believe that I write better code than some of my cow-orkers, but on that I think this is justified)
@Tsaukpaetra said in WTF Bites:
Speaking of, en route to trying to make the game servers run on Linux I discovered apparently it's a Bad Idea to initialize variables out of order. Who knew?
It's been 'ed but yeah, class variables must be initialised in the declaration order. This actually makes sense in the very weird cases where one variable is initialised using the value of another, then the order is important, but I try to never do that, it triggers the ick-reflex of bad code...
-
The day all system and 3rd-party libraries compile with that flag, I would happily turn it on...
-isystem
instead of-I
for your third party headers. Not sure what the VS equivalent is.Oh, interesting! I will have to look at that more closely. If we can silence some warnings from e.g. Qt headers, we can turn those warning on in our code at least and it would help. Thanks, TIL!
-
@Zerosquare said in WTF Bites:
The company informed users that if they had used the “download your data” tool, their passwords were accidentally exposed because they were included in the URL. (...) a company spokesperson downplayed the issue, saying that the company only stores password hashes.
So, plaintext passwords and including passwords in URLs. And when they get caught with the hand in the cookie jar, they still deny it.
sigh
We need to bring back tarring and feathering.
Please also include the hypocrite who labeled that act of gross negligence as a "security glitch".
ď… : Oh noes, somehow all these passwords escaped their cage and put themselves in the url all by themselves hur dur.
-
-isystem instead of -I for your third party headers. Not sure what the VS equivalent is.
They are/were working on it, apparently. The switches in question are
/external:I <path>
(and a few others). I don't know if it's considered a non-experimental feature yet. If not, you apparently also have to enable it via/experimental:external
. I haven't used this myself yet, so YMMV.
-
armed with air-to-air nuclear weapons
'>(unguided)
-
@Tsaukpaetra said in WTF Bites:
Mostly it's just auto constructor terms being out of order
Is this the "order of member initialization follows order of member declaration rather than order in initialization list" gotcha? Yes that's one of the more hilarious subtleties of C++, better hope your compiler warns you of that. Sadly I don't think VS will.
-
-
The other traditional disadvantage of
vfork()
is that it is impossible to handle a failedexec()
, but linux bypasses that by allowing_exec()
to be called as well.Nobody pedanted me on this so I'll correct myself: The function linux also allows you to call after
vfork()
is_exit()
, not_exec()
.
-
Granted, I guess if the OS is free this isn't as bad but still…oh…
-
Granted, I guess if the OS is free this isn't as bad but still…oh…
It was free at the beginning, but not anymore.
Also, by 4 days
https://what.thedailywtf.com/topic/17088/in-other-news-today/12344
-
@anonymous234 said in WTF Bites:
I was writing a simple program using mosquitto (a mqtt library). The interface is very simple: you call a few initialization functions, then you call mosquitto_loop_start. This starts a background thread to process messages and call your callback functions. Except mosquitto_loop_start was returning MOSQ_ERR_NOT_SUPPORTED, which according to the documentation means "thread support is not available".
So, wtf could that be caused by? I'm pretty sure my OS supports threads. Eventually I checked the source code:
int mosquitto_loop_start(struct mosquitto *mosq) { #ifdef WITH_THREADING //irrelevant stuff #else return MOSQ_ERR_NOT_SUPPORTED; #endif }
And where is WITH_THREADING defined? At compile time. And I downloaded the official compiled version for Windows.
So... no threading because fuck you?
Does your version sleep at all? My copy seems to poll, and spins the core it's running on at 100 percent.
-
@ixvedeusi said in WTF Bites:
@Tsaukpaetra said in WTF Bites:
Mostly it's just auto constructor terms being out of order
Is this the "order of member initialization follows order of member declaration rather than order in initialization list" gotcha? Yes that's one of the more hilarious subtleties of C++, better hope your compiler warns you of that. Sadly I don't think VS will.
Yes, Visual Studio did not warn about that until I started using the cross-compile-to-Linux script. Still doesn't when building for windows.
So far hasn't bitten anything, but it's on my backlog.
-
Looking through some ancient code the Highly Paid Consultants wrote, trying to figure out where it made Coverity angry, I stumbled upon the following glorious gem in the middle of a 50-line method.
var queryForUser = GetQueryForGetCompleteCase(userCaseResultId, userId); var includes = new List<string> { "User", "Answers" }; includes.ForEach(i => queryForUser = queryForUser.Include(i));
-
Just a quick venting at Adobe for the recent Flash update, because their installers still delete themselves on completion. Including when they fail.
-
delete themselves on completion
I still have no idea why they do that. Ok I have an idea, just not a defensible reason...
-
@Tsaukpaetra: Your mission, should you choose to accept it, is to install Adobe Flash. Good luck. This installer will self-destruct in five seconds.
-
I'm trying to find a WTF article I remember about that, but Google does nothing. :(
-
their installers still delete themselves on completion. Including when they fail.
That's a nice feature, trying to save you from using Flash
-
WTF of my day: Still playing around with Clonezilla server edition. So, yesterday I shutdown the server while it was still in "automatically restore the image to all connected clients" mode (not that big of a problem because the port it does the imaging over is on a dedicated switch solely for imaging - so no accidental overwrites. At least from my side).
Today I wanted to write another new image so I first did a "Stop this mode" command and then a "Connected clients now write an image of their disk to the server" change mode command.
PXE-booted the Surface I wanted and ... wait, why does it say "Starting to clone/restore to /dev/sda"?
To make it short: The server obviously "forgot" due to the reboot that it was in the restore mode previously, thus not overwriting the boot images properly which yielded a Surface with a corrupted system image on its disk (because, while the restore mode was still set, it also forgot the image it should be restoring).
-
also forgot the image it should be restoring).
You'd think that's an "error out and do nothing at all" condition...
-
@Tsaukpaetra Considering that they deemed it a great idea to use a Debian-based kernel for their PXE-boot-image I'm not too terribly surprised.
-
Considering that they deemed it a great idea to use a Debian-based kernel for their PXE-boot-image I'm not too terribly surprised.
You can install it on any of the following Linux distro:
- Debian Stretch (9.x), Jessie (8.x).
- Ubuntu Bionic (18.04), Artful (17.10), Xenial (16.04).
- CentOS 7, 6.
- Scientific Linux 7.x, 6.x, RHEL 7.x, 6.x (Use drblsrv-offline)
- Fedora 23, 22.
- OpenSuSE 11.2, 11.3.
Source: https://drbl.org/installation/
Probably better than using the Live version
-
@TimeBandit You don't understand: The image they distribute for PXE booting to the clients is by default Debian based.
Which is a terrible idea because unless you have a run-of-the-mill bogstandard network card (and have, say, a USB-network adapter) then you may be shit out of luck with that one because it does not include the needed 3rd party firmware.
-
@Zerosquare
https://i.imgur.com/i6pjAnh.png
This is the part where my Downloads folder deletes itself, right?
-
because it does not include the needed 3rd party firmware.
Yeah, that's retarded
-
@TimeBandit Well, you can switch kernels but it's not exactly pointed towards with big friendly letters.
-
Bullshit, I specifically closed all my windows to make sure it would be free.
-
"Brotli" is the Swiss variant of a traditional German punishment for bad boys:
That might be a punishment to one of my brothers, but not really to me. I personally like broccoli. (Those
SwedishSwitzerlanders and their silly accents!)
-
@pie_flavor said in WTF Bites:
@Zerosquare
https://i.imgur.com/i6pjAnh.png
This is the part where my Downloads folder deletes itself, right?All your flies are exactly where you left them.
-
@Applied-Mediocrity said in WTF Bites:
@pie_flavor said in WTF Bites:
@Zerosquare
https://i.imgur.com/i6pjAnh.png
This is the part where my Downloads folder deletes itself, right?All your flies are exactly where you left them.
That's a fly? I thought it was a hand cursor. Or some @Tsaukpaetra style cat.
-
@Applied-Mediocrity said in WTF Bites:
@pie_flavor said in WTF Bites:
@Zerosquare
https://i.imgur.com/i6pjAnh.png
This is the part where my Downloads folder deletes itself, right?All your flies are exactly where you left them.
That's a fly? I thought it was a hand cursor. Or some @Tsaukpaetra style cat.
No, that's what's used to pull down the fly.
-
-
@Zecc
Stop making Windows Updates on the fly there!
-
Bullshit, I specifically closed all my windows to make sure it would be free.
I love the consistency of Windows Update.
Leave the computer alone with pretty much nothing running so it can update automatically: "Device was actively in use."
Sit at the computer activelygamingworking: "Now is a good time to forcefully reboot and install updates!"
-
@hungrier Probably Windows Defender locking the wrong files at the wrong time as usual.
-
Soo, I'm working at a government agency (Swedish Enforcement Agency), all of the IT infrastructure is handled by a different government agency (The Swedish Tax Agency).
I'm leading a team that's creating a new platform in java for SEC, and we're using IntelliJ as mandated by IT guidelines.A couple of minutes ago, STA notified the entire team that we must cease useage of IntelliJ (that was installed through their portal with OK tools) and uninstall it immediately. Because apparently, only people at STA are allowed to use it.
This comes hot on the heels of them pushing a broken 2FA app to us (and later everyone) that has taken a week and counting, to fix.Now, if I were of a tinfoil hat persuasion, I'd say that someone in their organization did not quite like that we had the nerve to point out that they did something incredibly dumb, and are exacting vengeance.
Anyway... It seems that STA is incompetent enough to not being capable of finding applications installed through other channels than their service, so I guess I'll just install it straight from jetbrains instead.
-
@Carnage For a moment I wondered if we're working in the same town, but I don't think the Swedish Enforcement Agency got their IT offices here. Even if there are shitloads of government IT jobs here, pretty much all using Java.
-
Swedish Enforcement Agency
Responsible for enforcing that all vegetables look like rutabagas.
-
Swedish Enforcement Agency
Responsible for enforcing that all vegetables look like rutabagas.
One might think so, but that is on the EU level.
No, this is what SEC does: https://www.kronofogden.se/download/18.33cd600b13abbc8411c800020855/1371144370347/kronofogden_in_english.pdf