WTF Bites



  • @cvi said in WTF Bites:

    @hungrier I'm triggered by the missing comma.

    You should do a bug report ; I've heard Jeff loves getting feedback, especially from WDTWTF members.


  • Considered Harmful

    @cvi said in WTF Bites:

    @HardwareGeek said in WTF Bites:

    Two of them, one of them being educated at an English university of outstanding reputation.

    And about nine if you learned English punctuation from a certain character in Star Trek TOS.

    Filed under: Shattner, comma.

    The, meaning you see, it changes, changes based on, the pauses.


  • Discourse touched me in a no-no place

    @izzion said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    Status: What the fuck is the point of having this be a stored proc?

    It does nothing special at all so.... :wtf-whistling:

    🧙 All business logic must be in stored procedures.

    Usually either because the person setting the rule is a DBA type who got sick of performance messes from developers writing shit queries, so he requires sprocs that he can gatekeep & modify more easily, or because the person setting the rule heard that sprocs are better for avoiding SQLi vulnerabilities.

    I believe there's the ability to run with different permissions as well. I don't (knowingly) use any database where that's a key feature so I make no use of it myself, but it could well be an issue for some.


  • Discourse touched me in a no-no place

    @PleegWat said in WTF Bites:

    I don't see that happening either though.

    It's already happened for some programming languages.


  • Considered Harmful

    @dkf said in WTF Bites:

    @izzion said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    Status: What the fuck is the point of having this be a stored proc?

    It does nothing special at all so.... :wtf-whistling:

    🧙 All business logic must be in stored procedures.

    Usually either because the person setting the rule is a DBA type who got sick of performance messes from developers writing shit queries, so he requires sprocs that he can gatekeep & modify more easily, or because the person setting the rule heard that sprocs are better for avoiding SQLi vulnerabilities.

    I believe there's the ability to run with different permissions as well. I don't (knowingly) use any database where that's a key feature so I make no use of it myself, but it could well be an issue for some.

    Oh, hell yeah, per-user aliases, overloading the same token, per user, to run different SPs. Context-sensitive!


  • Banned

    My sister had like 15 speeding tickets from speed traps in last 2 years and except for $50 penalty each time it had no consequences.

    I had only one speeding ticket in my 4 years in USA but because it was written by a police officer I'm now classified as high risk driver and pay $400/year more in insurance premiums for the next 3 years.

    If I knew it earlier, I'd run away.


  • 🚽 Regular

    @Gąska said in WTF Bites:

    If I knew it earlier, I'd run away.

    While obeying the speed limit?


  • Banned

    @Zecc when was the last time you saw someone obeying the speed limit on a highway?


  • 🚽 Regular

    @Gąska Ah, the times before self-quarantine... :trolley-garage:


  • Banned

    @Zecc quite the opposite. Before the quarantine, the traffic was so bad you couldn't speed even if you tried!



  • @Gąska said in WTF Bites:

    @Zecc quite the opposite. Before the quarantine, the traffic was so bad you couldn't speed even if you tried!

    And now... this past weekend I was doing around 75 (in a 65). And being passed like I was standing still. I think I was the slowest one out there (except for the usual 55ers sitting in the not-right lane).


  • Considered Harmful

    @dcon said in WTF Bites:

    @Gąska said in WTF Bites:

    @Zecc quite the opposite. Before the quarantine, the traffic was so bad you couldn't speed even if you tried!

    And now... this past weekend I was doing around 75 (in a 65). And being passed like I was standing still. I think I was the slowest one out there (except for the usual 55ers sitting in the not-right lane).

    Try driving the other direction, that'll teach 'em.


  • Notification Spam Recipient

    Status: Debugging.

    772a4b85-ea6c-4dab-aa8f-98868847f9cd-image.png

    So... you created the bucket, like I asked, and I own it, as I should.... and this is a fucking ERROR?!?!?!

    What the hell...



  • @Tsaukpaetra said in WTF Bites:

    a fucking ERROR

    ...is a properly functioning @error.



  • @Tsaukpaetra Race condition? Something else managed to create it inbetween?

    Edit: The naming is a WTF, though. "Ensure....Exists()" doesn't sound like it would fail if the thing already exists. After all, it should just ensure that it exists. Existing beforehand kinda seems to fulfill that condition.



  • @cvi said in WTF Bites:

    Race condition?

    I spend too much time in :trolley-garage:. My first reaction, for a brief moment, interpreted that as involving politics and skin color.



  • @HardwareGeek I wouldn't be surprised if that blew up at some point the way you describe. (Despite the "race" part being the kind of race you have in racing.)

    Is there another term for this kind of error that I should be aware of?


  • Notification Spam Recipient

    @cvi said in WTF Bites:

    @Tsaukpaetra Race condition? Something else managed to create it inbetween?

    Edit: The naming is a WTF, though. "Ensure....Exists()" doesn't sound like it would fail if the thing already exists. After all, it should just ensure that it exists. Existing beforehand kinda seems to fulfill that condition.

    Yeah, it's pants-on-head, as I found out when simply calling EnsureExists doesn't actually check I guess, which is why the line above to check if it exists. :headdesk:


  • Banned

    Somehow, I'm now getting spam calls on MS Teams.



  • @cvi said in WTF Bites:

    Is there another term for this kind of error that I should be aware of?

    Nope, that's the accepted term. At least, I've never heard anything else.


  • Banned

    @cvi said in WTF Bites:

    Is there another term for this kind of error that I should be aware of?

    It's @HardwareGeek, so he's probably more used to hazards.


  • Considered Harmful

    @Tsaukpaetra said in WTF Bites:

    Status: Debugging.

    772a4b85-ea6c-4dab-aa8f-98868847f9cd-image.png

    So... you created the bucket, like I asked, and I own it, as I should.... and this is a fucking ERROR?!?!?!

    What the hell...

    Your attempt to take ownership of the bucket encountered a conflict. You had already taken ownership of the bucket.


  • Considered Harmful

    @cvi said in WTF Bites:

    Is there another term for this kind of error that I should be aware of?

    Concurrency flaw. Not as descriptive.



  • @Gribnit "Threading hazard" is another one, but that's both less specific (other hazards exist) and too specific (might not be related to threading).



  • @Gąska said in WTF Bites:

    Somehow, I'm now getting spam calls on MS Teams.

    Is it your coworkers trying to reach you? In that case, I've had the same problem. (Coworkers keep insisting that they're not spamming. That's exactly what a spammer would say, though.)



  • @cvi said in WTF Bites:

    Is it your coworkers trying to reach you?

    LOL. If they try reaching me via Teams (I'd have to login there to figure out my "phonenumber"), they ain't gonna get me! I never start that. Unless I've booted my Windows partition for the once-a-month-don't-lock-my-account-please-IT session. (We live in Slack - the new overlords haven't forced us to migrate from that. Yet.)


  • Notification Spam Recipient

    @cvi said in WTF Bites:

    @Gribnit "Threading hazard" is another one, but that's both less specific (other hazard exist) and too specific (might not be related to threading).

    Non-deterministic simultaneous access inducing inconsistent behaviour.


  • Banned

    @cvi said in WTF Bites:

    @Gąska said in WTF Bites:

    Somehow, I'm now getting spam calls on MS Teams.

    Is it your coworkers trying to reach you?

    A coworker smart enough to find my virtual MS Teams phone number which isn't even listed in the company directory (I think), would also be smart enough to use Teams in-app call.


  • ♿ (Parody)

    @Gąska said in WTF Bites:

    @cvi said in WTF Bites:

    @Gąska said in WTF Bites:

    Somehow, I'm now getting spam calls on MS Teams.

    Is it your coworkers trying to reach you?

    A coworker smart enough to find my virtual MS Teams phone number which isn't even listed in the company directory (I think), would also be smart enough to use Teams in-app call.

    :doubt: Some dumbasses can be extremely diligent and persistent in doing stupid things.


  • Considered Harmful

    @boomzilla said in WTF Bites:

    @Gąska said in WTF Bites:

    @cvi said in WTF Bites:

    @Gąska said in WTF Bites:

    Somehow, I'm now getting spam calls on MS Teams.

    Is it your coworkers trying to reach you?

    A coworker smart enough to find my virtual MS Teams phone number which isn't even listed in the company directory (I think), would also be smart enough to use Teams in-app call.

    :doubt: Some dumbasses can be extremely diligent and persistent in doing stupid things.

    But enough about that, let's get on with refining our more fragile shared beliefs.


  • BINNED

    @Gąska said in WTF Bites:

    isn't even listed in the company directory

    wouldn't be to sure about that ... we have simular issues where people got calls on their private mobile or direct calls on their teams number because in teams you just have to type the name and hit "transfer" and it will do a blind transfer


  • Considered Harmful

    @cvi said in WTF Bites:

    @HardwareGeek I wouldn't be surprised if that blew up at some point the way you describe. (Despite the "race" part being the kind of race you have in racing.)

    Is there another term for this kind of error that I should be aware of?

    Apologies, this is also one of the -potence set, I think unnipotent? Vs the friendlier and more familiar idempotence that was expected. And the condition can occur with a working EnsureExists assuming claiming a bucket takes wall time and holds no effective lock.


  • Considered Harmful

    It's neat that the VM window can set the guest resolution based on the size of the window on the host. It's understandable that this adjustment takes a few moments. But given how slow it is, could you please fucking let me finish resizing the window before you start doing it, instead of "smoothly" (~2FPS) changing the resolution 20 times while I perform the resize? Which makes me overshoot the target size 3 times because of how jerky it is.


  • Notification Spam Recipient

    @error said in WTF Bites:

    It's neat that the VM window can set the guest resolution based on the size of the window on the host. It's understandable that this adjustment takes a few moments. But given how slow it is, could you please fucking let me finish resizing the window before you start doing it, instead of "smoothly" (~2FPS) changing the resolution 20 times while I perform the resize? Which makes me overshoot the target size 3 times because of how jerky it is.

    Ah, you need to uncheck the "resize window contents while dragging" (or whatever it is) in performance and visual control panel.

    Citrix client used to do this for you, not sure if it still does.


  • Considered Harmful


  • Java Dev

    At the bottom of a C function returning a null-terminated string:

    if( *out ) *out = 0
    


  • @PleegWat It's equivalent to just *out = 0. Now I'm wondering whether the compiler can optimize it to that.


  • Java Dev

    @Bulb said in WTF Bites:

    @PleegWat It's equivalent to just *out = 0. Now I'm wondering whether the compiler can optimize it to that.

    It is, and it doesn't. Valgrind complained.



  • @PleegWat … wait, Valgrind wouldn't complain about pointless comparison … oh, you are saying it's uninitialized, right?


  • Banned

    @PleegWat I presume the first asterisk is a typo. Still, an interesting way to make an empty string.



  • @Gąska No, I don't think it's a typo. I think the out pointer that moves with the characters written, the output iterator if you will, so at the end it needs the final nul written to it, but instead of just writing it the code first checks whether it has to … on the not yet initialized buffer.


  • Java Dev

    @Bulb said in WTF Bites:

    @PleegWat … wait, Valgrind wouldn't complain about pointless comparison … oh, you are saying it's uninitialized, right?

    Yup, uninitialized buffer. Pointless comparison would get the compiler and/or the static analyser complaining, but not valgrind.

    There might be cases where it's beneficial to optimise like this if it's the only write to that cache line/page, but that's unlikely here, and I wouldn't be surprised if the hardware checks for that.

    @Bulb said in WTF Bites:

    @Gąska No, I don't think it's a typo. I think the out pointer that moves with the characters written, the output iterator if you will, so at the end it needs the final nul written to it, but instead of just writing it the code first checks whether it has to … on the not yet initialized buffer.

    I do usually write *buf = 0 rather than buf[0] = 0 or strcpy(buf, "") or anything else if I'm writing an explicit empty string, but in this case it is indeed a moving out pointer.


  • BINNED

    @PleegWat said in WTF Bites:

    There might be cases where it's beneficial to optimise like this if it's the only write to that cache line/page, but that's unlikely here, and I wouldn't be surprised if the hardware checks for that.

    I had that thought too, i.e. it's almost certainly not happening here but there'd be a difference if it was a volatile pointer or the first byte on a CoW page.

    Does anyone know the answer to the question you just raised: does a write to a clean cache line or clean CoW page dirty it if the write is redundant? Probably depends on the hardware but is there common hardware that checks this?


  • Discourse touched me in a no-no place

    @PleegWat said in WTF Bites:

    It is

    Mostly. It's possible for the difference between the two to be seen from another thread. (If the CPU gods are willing.) It's also possible that the pointer could be to somewhere on a page with write permission but not read permission.

    These are screwy cases. Valgrind is wrong, but it's not out of line.


  • BINNED

    @dkf said in WTF Bites:

    Mostly. It's possible for the difference between the two to be seen from another thread.

    Not really. The pure write is not guaranteed to be thread safe, either, so the semantics should be the same from the point of the C abstract machine.
    Optimizations don't need to be bug compatible.

    E: scratch that, I forgot we're talking about a single byte char.


  • Discourse touched me in a no-no place

    @topspin said in WTF Bites:

    The pure write is not guaranteed to be thread safe, either,

    That depends on the type, alignment, and architecture. The rules get very complicated.


  • BINNED

    @dkf said in WTF Bites:

    @topspin said in WTF Bites:

    The pure write is not guaranteed to be thread safe, either,

    That depends on the type, alignment, and architecture. The rules get very complicated.

    What I meant is that if it happens to work for some implementation, that still doesn't count as guaranteed. I.e. on x64 int movs are atomic, but from the perspective of C this is not guaranteed, unless you're relying on your specific implementation explicitly providing that guarantee. And the optimizer can use that if the difference cannot be observed by the C abstract machine even if it could be observed by the target hardware.

    But see my retraction: I have no idea if this holds for single byte writes, but even if not I can't imagine a platform where it doesn't.


  • Considered Harmful

    @topspin said in WTF Bites:

    I have no idea if this holds for single byte writes, but even if not I can't imagine a platform where it doesn't.

    4004 ( vs 4044 )



  • @topspin said in WTF Bites:

    Does anyone know the answer to the question you just raised: does a write to a clean cache line or clean CoW page dirty it if the write is redundant? Probably depends on the hardware but is there common hardware that checks this?

    I kinda doubt it for cache lines. You'd have to compare the incoming value with the one in the cache. That would likely mean having some extra silicon to do those comparisons on the fly. Sounds kinda costly, and it's not clear that this would occur very often.

    AFAIK all of the paging logic is handled by the OS. I guess it could check whether the write actually changes the data in the corresponding page fault handler? Would be rather costly if you were writing a bunch of data (since you'd essentially leave the page in a CoW state after detecting such, so each subsequent write will also fault).



  • @cvi said in WTF Bites:

    AFAIK all of the paging logic is handled by the OS. I guess it could check whether the write actually changes the data in the corresponding page fault handler?

    The OS has no way of knowing except by looking at the dirty flag that is set by the CPU as a side-effect of the write. And I doubt it checks the old value. The thing is it's unlikely the occasional extra write would outweigh incurring the extra cost on all writes.


Log in to reply