• Samah (unregistered) in reply to GoatCheez
    GoatCheez:
    Really unrelated, but king of related. There's a game I play that fails to run on my Athlon64 X2 4200. It gets disconnected/crashes when I try to log on. I went to the forum, and the workaround is: Switch to an Intel processor. Apparently, the bug has something to do with the fact I have two processors. I wonder if the bug is exposed on the recent Intel dual core processors as well? Either way, WHAT A CRAPPY WORKAROUND!

    This reminds me of a certain game <cough>Tiberian Sun</cough> which refuses to run on Cyrix processors.  My Mum's PC had a Cyrix CPU.  She couldn't play it.
    The beauty of this though is that you don't find out that it's not supported until you go to run the game and it says "Cyrix CPU not supported".  No documentation on it whatsoever.  Just bought the game?  Have fun returning it.

  • (cs) in reply to Samah

    Whoops sorry for the multiple posts, AJAX errors are fun.

  • (cs) in reply to Lee
    Anonymous:
    A classic case is the "CR/LF" sequence, which may have originated with the need for a teletype to have time to get from the right margin to the left . . . one character was not enough.


    Nope.  CR means return to the left margin.  LF means line feed.  You can print a CR without an LF.  This was commonly done for underlining or bolding.

    However, you are not that far off.

    At least one early micro BASIC had a NULL (or NULLS) statement.  This specified the number of NUL characters to be printed after a CR to give the Teletype time to return to the margin before continuing to print.

    Sincerely,

    Gene Wirchenko

  • petersod (unregistered) in reply to Lee
    Anonymous:

    A classic case is the "CR/LF" sequence, which may have originated with the need for a teletype to have time to get from the right margin to the left . . . one character was not enough.


    Nothing WTF-ish about CR/LF.  Carriage Return and Line Feed are two different operations.  The first one moves the print carriage back to the left margin (which may or may not be column 1); the second advances the paper by one line.  You haven't lived until you've seen a teletype being used as a (very) poor man's chart recorder by spacing and back-spacing to postion the head then printing a ".", line-feeding to move the paper up and then repeat.  Works quite well because the carriage doesn't move any more than neccesary.

    Also, a carriage return without a line feed was one way of doing bold and special characters on some systems - print the line and then overprint it as required.

    On the original topic:  I once had to put extra characters into a comment to make sure that the 4096'th character of a module fell inside the comment!  The parser/compiler (I refuse to name the product involved) had some sort of 4k internal buffer and would drop one character around the boundary!  It was (marginally) an improvment over the previous version - that would just drop ALL text past the 4k limit!  Ahhh, the happy memories :)

    D.

  • Fred (unregistered)
    1. Years ago, the Fortran compiler we were using had a bug in the optimizer that migrated code too far forward--before some of the variables were assigned the correct values. It became an art to know where to insert lines like "x = x" to say "don't move code involving x past here."

      2) At a later job, the company decided to get into consumer software and produced quite a decent spreadsheet and I purchased a copy. When I got a newer computer, it wouldn't work. I couldn't abandon the spreadsheet because I used a capability that wasn't available elsewhere at the time. Eventually I discovered that (apparently) the problem was that the disk was too large. More precisely, the amount of free space was too large. I'd guess that it asked the OS for the amount of space and stored it in a variable that was too small, so it looked negative. When it checked for enough space, it decided that it was insufficient. The workaround was to create a huge file to make the free disk space small enough.

      You may wonder why this wasn't fixed in a new release. Well, the company decided that consumer software wasn't something it could do, so it abandoned the spreadsheet.
  • Pieter (unregistered)

    How is this,

    We were using a third party component to do some processing and we were constantly getting exceptions thrown when calling a specific method for no apparent reason.  So we log a call with the vendor. 

    Their workaround?  Keep calling the method until there is no more exceptions thrown!

  • bit (unregistered) in reply to HitScan
    HitScan:
    Anonymous:
    Wow. Why 8192?


    Workarounds2 is most likely a DWORD in the registry, and almost certainly used as a bitflag in the program. 8192 is the 14th bit in a DWORD.

    Of course, if you've got other things turned on in Workaruonds2 and you replace the old number with 8192, you just broke something else!

    Edit: Drats! Beaten  by seconds.

    It should instruct you to add 8192 to the value of that variable.

    Not that the whole thing is not crazy enough, you know.

  • (cs) in reply to merreborn
    merreborn:

    Hey man.  They put the "Open this file" button there.  But that doesn't mean you should use it!


    One of my favorite workarounds was in a game (Eye of the Beholder series, maybe) back in the early 90's. There were a bunch of levers in one area, each with a hint message of some kind. The message for one lever was something like "Don't pull this lever, or Very Bad Things will happen."

    Being the curious sort, I saved my game, then pulled the lever - and the game crashed, hard.

    So, is it a bug if they tell you not to do it? Or is that just one of the more creative versions of feature?


  • Drahflow (unregistered) in reply to bit

    We were (at school) writing an kernel driver for an analog digital and backwards converter ISA-card. First step was to read the vendors documentation on how to address the card, where the ports lie and stuff...

    So it turns out, this card can be jumpered to any of 8 address ranges. But the card supports no way to detect it. All you can do is hope that the card is at the address you guessed and send and receive data, and change parameters like precision.

    We found a well-working workaround: Iterate over all possible addresses, assume the card is present there, set amplification and precision to max. Measure any analogous input for 10 seconds, if it changes values more then 10% of the time, it is noise and voila, card detected, if it does not, there is no card, try next address.

  • (cs) in reply to Samah
    Samah:
    GoatCheez:
    Really unrelated, but king of related. There's a game I play that fails to run on my Athlon64 X2 4200. It gets disconnected/crashes when I try to log on. I went to the forum, and the workaround is: Switch to an Intel processor. Apparently, the bug has something to do with the fact I have two processors. I wonder if the bug is exposed on the recent Intel dual core processors as well? Either way, WHAT A CRAPPY WORKAROUND!

    This reminds me of a certain game <cough>Tiberian Sun</cough> which refuses to run on Cyrix processors.  My Mum's PC had a Cyrix CPU.  She couldn't play it.
    The beauty of this though is that you don't find out that it's not supported until you go to run the game and it says "Cyrix CPU not supported".  No documentation on it whatsoever.  Just bought the game?  Have fun returning it.




    Fruity loops did the same thing.   I blame cyrix, personally.  Their processors are supposedly intel compatible, but they're obviously not.  Kinda hard to blame software guys for your shitty hardware.
  • Lee (unregistered) in reply to petersod
    Anonymous:
    Anonymous:

    A classic case is the "CR/LF" sequence, which may have originated with the need for a teletype to have time to get from the right margin to the left . . . one character was not enough.


    Nothing WTF-ish about CR/LF.  Carriage Return and Line Feed are two different operations.  The first one moves the print carriage back to the left margin (which may or may not be column 1); the second advances the paper by one line.  You haven't lived until you've seen a teletype being used as a (very) poor man's chart recorder by spacing and back-spacing to postion the head then printing a ".", line-feeding to move the paper up and then repeat.  Works quite well because the carriage doesn't move any more than neccesary.

    Also, a carriage return without a line feed was one way of doing bold and special characters on some systems - print the line and then overprint it as required.

    On the original topic:  I once had to put extra characters into a comment to make sure that the 4096'th character of a module fell inside the comment!  The parser/compiler (I refuse to name the product involved) had some sort of 4k internal buffer and would drop one character around the boundary!  It was (marginally) an improvment over the previous version - that would just drop ALL text past the 4k limit!  Ahhh, the happy memories :)

    D.

    I know what the acronyms CR and LF mean.  The point is, a single command combining the two operations was not sufficient.  And, as another posted pointed out, in some cases even more (null) characters had to be tacked on . . .

     

  • Marshall T. Vandegrift (unregistered) in reply to Lee
    Anonymous:

    I had something very similar happen recently.  Turns out the compiler (gcc) was bungling an optimization.  The fix was to compile with "-fno-strict-aliasing".

    No, gcc wasn't.  If you have code you can "fix" with -fno-strict-aliasing then you have broken code.  Read the gcc non-bugs and this NetBSD mailing list post.

  • (cs) in reply to Jefffurry

    Jefffurry:

    One of my favorite workarounds was in a game (Eye of the Beholder series, maybe) back in the early 90's. There were a bunch of levers in one area, each with a hint message of some kind. The message for one lever was something like "Don't pull this lever, or Very Bad Things will happen."

    Being the curious sort, I saved my game, then pulled the lever - and the game crashed, hard.

    So, is it a bug if they tell you not to do it? Or is that just one of the more creative versions of feature?

    Heh. That reminds me of the time my college friends and I were messing around in the original Wing Commander game, deliberately losing each mission to see how the game would end.

    Finally, after an especially horrific defeat, the camera pans out as the Kilrathi swarm in. The mother ship slowly succumbs to the attack, starts to explode.... then

    <FONT color=#ff0000 size=5>BAM</FONT>

    everything goes dark. The computer monitor, the dorm room lights, the office building across the street.

    We were like WOW, COOLEST GAME ENDING EVER!!!

    Citywide blackout lasted 30 minutes. Somehow, we were never able to reproduce this particular ending. :)

  • Steeldragon (unregistered) in reply to BradC
    BradC:

    Jefffurry:

    One of my favorite workarounds was in a game (Eye of the Beholder series, maybe) back in the early 90's. There were a bunch of levers in one area, each with a hint message of some kind. The message for one lever was something like "Don't pull this lever, or Very Bad Things will happen."

    Being the curious sort, I saved my game, then pulled the lever - and the game crashed, hard.

    So, is it a bug if they tell you not to do it? Or is that just one of the more creative versions of feature?

    Heh. That reminds me of the time my college friends and I were messing around in the original Wing Commander game, deliberately losing each mission to see how the game would end.

    Finally, after an especially horrific defeat, the camera pans out as the Kilrathi swarm in. The mother ship slowly succumbs to the attack, starts to explode.... then

    <FONT color=#ff0000 size=5>BAM</FONT>

    everything goes dark. The computer monitor, the dorm room lights, the office building across the street.

    We were like WOW, COOLEST GAME ENDING EVER!!!

    Citywide blackout lasted 30 minutes. Somehow, we were never able to reproduce this particular ending. :)

    WOW...I played that game once (I think)

    (PS.: I forgot to log in)

    -----------------------------------------------------------------------------------------------------

    Steeldragon

  • Jeremy Lakeman (unregistered)

    I develop with Powerbuilder (yeah lots of wtf's right there, not hard to think of one) and I'm the resident expert on all things PowerBuilder at the office, so one day a coworker at the office came to me once with this problem:

    Him: "Im calling LibraryImport, but it's failing sometimes and I don't know why"

    Me: "Open a window and try again"

    ...

    (walks away puzzled and very confused)

    ...

    Him: "OMG it worked"

    Flashback to how I discovered this. LibraryImport will import the syntax of a report object into your app so you can use it later. Anyway some times it would work and sometimes it wouldn't. Eventually I found a sequence of events I could use to reliably reproduce the problem, and I start some serious debugging. Turns out PB would sometimes keep file handles open on the library, and sometimes it wouldn't. So I start stepping through the code to find out when they were closed. step, step, step, hmmm file is still locked must be later on, continue, wtf it's gone... etc.

    Turns out PB will keep a file handle open and probably some other cached info in case it needs it later, but it will close these handles when a window has finished opening, since while a window is opening is when PB typically needs caching to improve performance. So...

    If LibraryImport returns an unexpected error, open a window and call it again...

     

  • (cs)

    Oh man. I don't have the code for my favorite workaround of all time, but I can describe it. Be warned, this may be a case of my submitting my own WTF.
    I remember when I was just getting to an intermediate knowledge of Perl, and I came across the eval() function. Most of you have probably seen one of these: it's a function, which takes a string, and what's in that string, gets evaluated as inline code.
    "Wow," I thought, "this seems like it could be really, really useful." But I couldn't think of a way a good way to use it.
    Then I became responsible for not only maintaining, but completely overhauling and significantly expanding, an internal version of Bugzilla, the open-source, Perl-based, database driven web bug-tracking system.
    I made a lot of enhancements to that system, solely for my company's local version and for their own specific workflow. One of the most daunting enhancements was that out-of-the-box Bugzilla only had a page which allowed you to submit one bug at a time. We wanted a page which could allow users to enter as many bugs as they wanted on the same page, without having to continually navigate back and forth among pages.
    I was pretty proud of my completion of the HTML front-end of this page, which used javascript to dynamically add more and more "new bug" forms to the page each time you clicked a button. But then I had to make some way for a perl cgi script to receive all those bug forms and process them.
    Should be simple, right? Nope. The process of adding a bug to the database featured dozens of special checks, possible exceptions, special-case processing rules, and possible errors thrown. And the only way to add a bug was to submit a bug form to that add_bug.cgi script, and that page had all of its code flat in the file. No, the process was not abstracted to a function that I could just call over and over, the only way it had ever worked was for these parameters to be sent to this page, and that was it.
    So I mulled over my options. I could get all of the page's code and put it into a function... but, I couldn't think of anything that would be more likely to cause more errors in the system. This was an intricate and messy page that used a lot of global variables and such - it would take forever to get it working again, and my instinct told me that I'd be finding obscure bugs from such a change for months afterward. Or...
    It was crazy. Would it work? I was sweating a little as I wrote the code. The algorithm looked like this:
    -Let's say batch_add_bug.cgi would receive "bug1", "bug2", and "bug3" parameters.
    -batch_add_bug.cgi manipulates the global parameters, making it appear that the parameter "bug" contains the "bug1" parameter. (I'm glossing over the fact that we had not one, but many parameters, of course.)
    -And now... yes, I'll do it. My script will open the script add_bug.cgi; load it into a string; and pass it into the eval() function. My palms were slick with sweat.
    -We clear the global "bug" parameter, then stick "bug2" into "bug", and repeat the above as a loop.


    I had to tweak things in a couple of places, and of course I had to have it provide its output differently when it was running in this mode, but... it worked. And I still had a couple of errors later crop up from my not clearing out the global variables correctly in each iteration of the loop, but I finally got that part watertight. And it worked.
    But... I had created a WTF. Granted, it was a necessary WTF - doing it correctly was just not worth the trouble in this situation, I simply had no "correct" architecture to work with, and turning a mess of global-variable-dependent spaghetti-code into something else would have been a mammoth task. And so I had instead hacked in a WTF.
    And, even now, part of me can't help but be proud of that WTF. Maybe it's not the hackiest workaround ever, but it has a certain perverted elegance to it which I always thought was cool.

  • Corona688 (unregistered)

    OK, this isn't exactly a business WTF, but it's a WTF nonetheless.  I was helping develop an open-source network game, the network part of it being pioneered by someone a smidgen too brilliant.

    The network part worked already, but was too slow.  When you're playing over a laggy modem connection, two seconds delay between hitting the controls and seeing your ship move was just too much!  So he decoupled everything, instead of waiting for new inputs from your opponent your computer would forward-predict from past actions.  If new info arrived contradicting that, it'd rewind to the last known good data then recalculate to the present.  Game time was carefully synchronized.  This worked brilliantly -- no wait!

    This also worked brillantly.  You could blow up your opponent, see it blow up once, twice, three times as newer data arrived, then finally see your opponent blow up and KILL YOU before you even knew he was still alive.

    The wtf, though, is that the data was still being sent as physical control inputs.  User hits left, eventually the program on your opponents computer gets told "He hit left at such-and-such time".  And positions were kept in floating point numbers.  Even assuming PERFECT time and data synchronization wouldn't there be floating point error?  Not so, says he.  The loss of accuracy is a moot point as long as every computer was inaccurate in precisely the same way.

    I had an athlon.  He had a PIII.

    Judicidous sprinkling of floating point reset instructions in raw assembly were required to get them to properly sync, and I still think there must have been differences large enough to desync the game, if played long enough.

  • Chris (unregistered) in reply to Barry R
    Anonymous:

    Both a Win client and a Linux box access
    a directory on a Win 2003 box.  The Win
    client writes a file.  The Linux box
    need to read the file. The Linux box
    sees the dir via mount.cifs. The file
    SHOULD be there.

    It is not.

    It can show up in 10 seconds or 2 hours.

    The Linux admin assures me there is nothing
    that can be done.

    The Windows admin is silent.

    I'm the Perl programmer.

    I discover that rereading the directory will
    force the file to appear.

    I think that this is a bug in Samba. Raymonda Chen of Microsoft discusses this problem in some detail at:

    • http://blogs.msdn.com/oldnewthing/archive/2006/03/30/564809.aspx
    • http://blogs.msdn.com/oldnewthing/archive/2006/03/31/565878.aspx
    • http://blogs.msdn.com/oldnewthing/archive/2006/04/10/572491.aspx
  • Mike5 (unregistered) in reply to timestamp
    Anonymous:
    Anonymous:

    loneprogrammer:
    Time Creep:
    Why does this occur?
    There is a need in the product to generate Unique Time Values for things such as Replica ID's and document UNID's. To implement this unique time/date, a function was created that would increment a time value if the current time returned is not unique. The granularity of time in the Notes products is 1/100th of a second. Therefore this unique time value would be increased by 1 tick when it is not unique.


    Wow.  Let's have a function that returns the current time, unless it already returned the currrent time, then we'll return some arbitrary time in the future.  What could possibly go wrong with that?

    You got a better idea?  I've done this lots of times.

    Who's gonna know - or care - whether the 2nd transaction occurred at 12:34:56.42 (as it claims) or when it really happened, which was sometime shortly after 12:34:56.41 (cause we know .41 already happened!).

    You can increase the resolution of the timer, but it'll never solve the problem - just put it off for another day when they get faster computers.

    If it helps, don't think of it as a timestamp - think of it as an arbitrary sequence number that (in virtually all cases) can be readily mapped back to a human-comprehensible date/time value by a human.

    As long as the transaction don't often come in at a rate of >100/sec, you're fine. And even if they do, you're still fine, but the "virtually all cases" claim above gets weaker and weaker...



    I have a better idea.... Don't use "Unique Time Values" to begin with.  If you need a timestamp, that is  fine but don't use that timestamp as a unique identifier.  A timestamp in conjunction with another attrubute may be ok though.



    It is, but all other attributes are static. :(
  • (cs) in reply to Mike5

    In a recent project we ran into a couple of strange .NET problems with some interesting workarounds:

    One was with a data bound combobox. When binding the combo to a datasource everything worked just fine but the first item in the list was always selected. We did not want to offer a default selection so we tried to clear the selection using combobox.ListIndex = -1; This did not work, the first item was still selected... Then we tried combobox.SelectedItem = null; Still not working. combobox.SelectedValue = null; didn't work either. Luckily we had Google! It turned out that this was a well known but is .NET and the workaround was easy. All we had to do was setting the list index twice! So combobox.ListIndex = -1; combobox.ListIndex = -1; worked properly...

    The second was a strange bug in the same project. The application was deployed to several users and it worked just fine. Except for one user that had some problems. We found out that there was a problem with his computer, for the problem went away when he logged in with the same profile on another computer and other users got the same problem when using his computer. The strange thing was that the computer was identical to all the other comptuers and used the excact same image as the others. The local administrator even reinstalled the image on the computer, but our program still didn't work. We were unable to find the source of the problem, all file versions were identical and our traces and logs showed nothing unusual. In a final attempt to solve the problem I converted the project from .NET 1.1 to .NET 2.0 and it worked! Problem fixed! From that day I have insisted we do all projects in .NET 2.0... :)

  • RM (unregistered) in reply to Sweets

    Sweets:
    9600 baud in 1979....Holy crap.... I didn't think that was available yet.

    My BBS was running 2400 until the 90's

    It was available, but not on dial-up; only on point-to-point links. the modems were the size of a suitcase.

  • TS (unregistered) in reply to Coughptcha

    I think, that this is because 8192 - 7748 is 444, which is so cute number, that it'll work:)

  • Snoopy (unregistered) in reply to OneFactor
    OneFactor:
    Reminds me of when I bought the PC release of Ultima I-VI on CD for $50. I would get a divide by zero error when I tried to run Ultima II. I had to download MoSlo to reduce chip-speed to play that game.


    The real WTF is why you didn't use the copy of MoSlo they thoughtfully included on the CD, like it said to in the troubleshooting manual they thoughtfully provided with the games that explained how to run them on modern PCs.

    The included MoSlo was better than the version I'd previously downloaded (it allowed finer speed tuning).
  • Morat (unregistered) in reply to HitScan
    HitScan:
    Workarounds2 is most likely a DWORD in the registry, and almost certainly used as a bitflag in the program. 8192 is the 14th bit in a DWORD.

    Of course, if you've got other things turned on in Workaruonds2 and you replace the old number with 8192, you just broke something else!


    I'll bet my bottom dollar that there are a whole bunch of those fields, like Workarounds1, Workarounds 3 etc. and that they're OR'd together to get the final set of workarounds to be used :)
  • Derek (unregistered) in reply to Dazed

    Anonymous:
    Alex Papadimoulis:
    Today's post is an "interactive" one, so go ahead and post your own workaround stories
    Well, anyone who's tried to get a standards-compliant website to work in Internet Explorer could fill a fortnight's worth of DailyWTF with horrible work-arounds. But those are perhaps a bit too well known. My most memorable work-around involved the driver I wrote for an electro-mechanical device which used electric motors and belts to move products, and light-emitting and light-sensitive diodes to detect their positions. It was working fine - then one day it suddenly developed intermittent faults which looked suspiciously as if they might have something to do with my driver. After puzzling over it for a while my colleague came up with a brilliantly simple and effective work-around - he put a cardboard box on the machine. Puzzled? Well, I was for a few seconds as well. What was happening was that when the sun came out, enough light was getting on the light-sensitive diodes to overwhelm them, and they could no longer "see".

    I had exactly the same problem with my hi-fi cutting out intermittently - except it was fine every time I went over to look at it. Eventually I traced it to strong sunlight being reflected off the wall and into the optical input of my digital-to-analogue converter, which overrides the coaxial input. Stuck a post-ot note over the back to solve it. Took me a lot of headscratching though!

  • some moron (unregistered) in reply to dhromed
    Anonymous:
    I once did a cross-frame Javascript that would sometimes give a null error, and sometimes not. Adding alert boxes as breakpoints would remove the error.

    Turns out that the a loaded frame may begin script execution while another is still loading and has no DOM tree yet.

    Solution:
    setTimeout("load()",1000);



    cheap.

    wouldn't it be better for the other frame to report back when it's ready?
  • Micha (unregistered) in reply to JoeBloggs

    try to put in some random command in there that does something a little bit more complex. Like calculating the squareroot of a number, do a printout - just big enough to have the L1 cache flushed.

    This could solve your problem. Reason: The CPU has an intern register of 70bit, not 64 (or 40, not 32) so the comparison of reals are done by those - this can give raise to funny problems.

    An alternative is to compile with the -mp or -mp1 switch (enable floating point precission)

    I've got an odd workaround of my own for what I suspect is a compiler bug.

    You wrote: A program I wrote one time had a habit of crashing while reading a data file. This only happened with one compiler, and only in the release compile, not the debug compile, so I couldn't simply attach a debugger and see where the crash was occurring. Instead, I would narrow it down by having the program display a series of dialog boxes, and see which ones got displayed before the crash.

    Well, I managed to narrow it down to one function, but when I put dialog-box calls in the function to try to find which line was causing the problem, the program worked perfectly. I found that simply setting up for displaying a dialog box without actually displaying it would solve the problem, so now the code has a line in it with the comment:

    /* Fixes a bug with the program segfaulting while reading from a file. It works. Trust me

  • JY (unregistered) in reply to Gabe
    Anonymous:

    At least Lotus didn't just put in a delay loop to wait until the time changes before yielding a new ID.



    Actually, pending a proper fix, taht probably would have been the best solution to the problem. It's far more efficient than the other workaround -- slowing down the entire machine all the time -- as it only throttles the program when necessary to do so.


  • Marmaliser (unregistered) in reply to PragmaticBoy

    There's only problem with that viewpoint: it's not shared by the system.

    It's clearly acting upon the value of the sequence number -ahem- timestamp to make decisions about what to show/replicate.

    The WTF here is using one concept to do two jobs, which with a little hind-sight, turn out to be incompatible with a smoothly running product.

    And *that* is something I've seen (and sometimes done) too. Sometimes even in functioning products.

    That doesn't make it defensible, because it falls in the general category of "stuff that works by accident". I've seen plenty of scenarios of that too:

    • hard-coded temporary file names
    • no consideration to concurrency (in multi-user systems)
    • "that would never happen" as the design excuse
    • code violating the recommendations of the vendor defended with "but it works when I tried it"

    The Notes people don't appear think it's defensible either, given they tried to architect it out in one release..

    I maintain this is a classic WTF, and it gets bonus points for lurking for so long that users are forced to locate obsolescent hardware to feed it.

     

  • Randyd (unregistered) in reply to Forgottenlord

    In the compiler bug vein:

    once a coworker came for advice:  his program worked fine whenever his debug style print statements were in there showing him how things were going, but when he removed them, the program would fail. - no other changes.

    We narrowed it down to one specific print statement, when present - all worked fine, when removed failure.  we ended up replacing that print statement with a single like

    k=k;

    (where k was a local variable) - then things were good.

  • The Anonymous Coward (unregistered) in reply to JoeBloggs

    Anonymous:
    I've got an odd workaround of my own for what I suspect is a compiler bug. A program I wrote one time had a habit of crashing while reading a data file. This only happened with one compiler, and only in the release compile, not the debug compile, so I couldn't simply attach a debugger and see where the crash was occurring. Instead, I would narrow it down by having the program display a series of dialog boxes, and see which ones got displayed before the crash. Well, I managed to narrow it down to one function, but when I put dialog-box calls in the function to try to find which line was causing the problem, the program worked perfectly. I found that simply setting up for displaying a dialog box without actually displaying it would solve the problem, so now the code has a line in it with the comment: /* Fixes a bug with the program segfaulting while reading from a file. It works. Trust me. */

    As a programmer, you should be profoundly unhappy with that solution.  If you don't nkow what caused the crash, then you don't truly know that you've resolved the problem.  It could manifest again -- in the same way or in a new way -- when you least expect it, or when you can least afford the time to deal with it.  (Or, replace "you" with "whoever inherits your program".  At that point, you become the "predecessor" in a WTF posting.)

    From your description, I seriously doubt that you're looking at a compiler bug.  The symptom is a much better fit for a memory usage error -- bad pointer, buffer overrun, something like that.  My money's on buffer overrun.  On many compilers, switching to DEBUG mode can suppress segmentation violations and other data corruptions on overrun, because your buffers tend to get padded and just generally memory can be laid out differently.  Similarly, two compilers may lay out buffers in memory differently, so that only one happens to yield a crash when your error occurs.  As for setting up (but not displaying) a dialog -- most likely data structures for the dialog box are being allocated, which render previously-invaild addresses in your process's memory space valid.

    The point is, in languages like C, C++, etc.; memory usage errors result in undefined and often highly volatile behavior.  Such things should never be left uncorrected (nor "corrected" with an inexplicable masking technique).  The solution is to run a memory debugger (I've had good luck with Rational Purify; there are less-expensive -- and I think even free -- alternatives available) over the process, and it will give you a great deal of information about the problem.

  • HatTrick1914 (unregistered) in reply to greywar

    Anonymous:
    Oh my.

    Borland C circa 1995.  I have a exception being thrown, but I can't figure out where, while messing around I simply changed the order of 2 lines, from:
    i++;
    nCounter=nCount2 + nCount3;

    to:
    nCounter=nCount2 + nCount3;
    i++

    no idea why this resolved it, but we were under time pressure to release so I could not investigate further.

    lots of other incidents, but that one stood out for just pure WTF.  My current code base starts out written by folks in the late 80's in pascal and assembly, then converted over to c++ on windows 3.1 machines, then upgraded for win95 while retaining 3.1 compatibility.  Theres some WTF's in here, and tons of "band aids".



     

    Over the years I have seen that problem more times then I care to remember, most recently on MS VC++6.0

    I had an interesting one on Borland C++ 3.0. My customer called asking for help. Seems one of their home grown programs was not behaving as expected and they wanted me to take a look at it, so I did. They had the following WHILE loop:

    while (True)   //which is a WTF by itself

    well apparently the compiler did not see True as being true so it would fall past the loop every time. I never took the time to figure out why because I just rewrote the code to elimenate the loop.

    VB 6.0 also has a bitwise ANDing issue (among other things) that left me scratching my head for a while. I think I had to split my mask into 8 bit segments and do a bunch of shifting and unshifting...not fun, real mess.

     

  • eddiedatabaseboston (unregistered) in reply to Hotta
    Anonymous:
    Alex Papadimoulis:
    so go ahead and post your own workaround stories in the comments

    I have a WTF workaround experience and I'm experiencing it right now. There is this forum that I'm posting comments to, and the CAPTCHA is broken...

    opps, I mean the CAPTCHA is "broken".



    The real WTF here is you don't actually have to type "broken", or anything at all, into that textbox, for it to work.

  • schwa-sticker (unregistered) in reply to Sweets
    Sweets:
    9600 baud in 1979....Holy crap.... I didn't think that was available yet.

    My BBS was running 2400 until the 90's

    I took my first two programming courses in high school on a 2400 baud LAN...in 1998! (the computers were apple 2GS - they were older than the students).

  • Lee (unregistered) in reply to Marshall T. Vandegrift
    Anonymous:
    Anonymous:

    I had something very similar happen recently.  Turns out the compiler (gcc) was bungling an optimization.  The fix was to compile with "-fno-strict-aliasing".

    No, gcc wasn't.  If you have code you can "fix" with -fno-strict-aliasing then you have broken code.  Read the gcc non-bugs and this NetBSD mailing list post.

    You are absolutely correct.  I had gone through this code carefully before and convinced myself that it was a gcc bug, not an aliasing violation, but I've just checked again and it is definitely bad code.

    Lee

  • tbf (unregistered) in reply to chris

    The real WTF is, that you do not use the force and patch the source (of PHP 5.0.4).

  • The Anonymous Coward (unregistered) in reply to Lee
    Anonymous:

    I had something very similar happen recently.  Turns out the compiler (gcc) was bungling an optimization.  The fix was to compile with "-fno-strict-aliasing".

    Well, many optimizations make assumptions about your program's behavior, and if your program breaks those assumptions, then you have to turn off the optimization.

    Now I don't know what your code does -- nor do I know much about the "strict aliasing" optimization -- but unless you've read up on the optimization options enough to know that you "shouldn't" have to turn this one off, I wouldn't rush to saying the compiler "bungled" it or was wrong in any way.

  • Lotus Notes fan (unregistered)

    Sorry, this isn't really a wtf.  The vendor posted this a little further down in the technote:

    What can I do to help minimize the impact of this problem?

    • Upgrade to the latest release of Notes/Domino that includes the latest fixes surrounding this issue. 5.0.2 is the release that has the major fix with 5.0.11 and 5.0.12 providing several more. 4.6.5 is the latest release of 4.x that has all the latest fixes possible in that code stream.

     

    Given that the current version of Lotus Notes is 7, and that a fix came with the 5.0.2 fix in short order after the release of 5.0, and they've announced an end of life date for Version 5, this isn't much of a wtf.

  • Loren Pechtel (unregistered) in reply to Anonymous
    Anonymous:

    I've had a very similar experience.  Mine was that a 300-line function in a utility library was throwing an exception.  When I began adding try/catch blocks all over the place to find it, however, the problem disappeared.  After a couple hours of exasperation, I discovered that adding this to the very top of the function would prevent the exception:

    try{
       ;
    }
    catch{
       throw;
    }

    To this day, I have no idea why this works.


    Prime suspect:  Uninitialized data, probably a local variable.
  • (cs) in reply to Lee
    Anonymous:
    I know what the acronyms CR and LF mean.  The point is, a single command combining the two operations was not sufficient.  And, as another posted pointed out, in some cases even more (null) characters had to be tacked on . . .

    Not really since you appear to think that they are commands.

    What *single* *command*?  CRLF means a CR character followed by an LF character.

    The need for NULs was because many of these early setups were just barely functional and had no flow control.  The NULs made sure that the printing was done before more characters were sent.  Given the choice between lousy printing and no printing, the former got picked.

    Sincerely,

    Gene Wirchenko

  • Zygo Blaxell (unregistered) in reply to schwa-sticker
    Anonymous:
    Sweets:
    9600 baud in 1979....Holy crap.... I didn't think that was available yet.

    My BBS was running 2400 until the 90's

    I took my first two programming courses in high school on a 2400 baud LAN...in 1998! (the computers were apple 2GS - they were older than the students).



    To be older than a high school student in 1998, the computer would have to have been built in 1984 or earlier.  The Apple IIGS was not released until September 1986.

    To be older than a middle school student in 1998, the computers would have to have been purchased as the first production run came off of the assembly line.

  • Zygo Blaxell (unregistered) in reply to Pieter
    Anonymous:

    How is this,

    We were using a third party component to do some processing and we were constantly getting exceptions thrown when calling a specific method for no apparent reason.  So we log a call with the vendor. 

    Their workaround?  Keep calling the method until there is no more exceptions thrown!



    That's standard practice in SQL with transactions.

    Two clients are attempting to modify the same data at the same time.  Only one can do this successfully, the other will hit a constraint violation, deadlock, concurrent update, or other error and must redo the whole transaction over again.

    One SQL client API has a method that looks like this (pseudo-code):

    template <class F>
    void doTransaction(F f)
    {
        while (1) {
             try {
                 beginTransaction();
                 f();
                 commitTransaction();
                 return;
            } catch (const somethingDerivedFromDbException &e) {
                 rollbackTransaction();
                 logTransactionFailureError(e);
                 // else back to top of while loop
           } catch (...) {
                rollbackTransaction();
                logOtherError(...);
                throw;
           }
       }
    }


  • Zygo Blaxell (unregistered) in reply to Rank Amateur


    There was a time when a rank amateur like myself could read one book by Peter Norton and know just about all there is to know about PCs. That era had clearly ended when I migrated from Windows 95 to XP.

    After installing my perfectly legal copy of Access 97, it wouldn’t execute, displaying an error message saying there was no license for it. Fortunately the workaround was documented in Knowledge Base Article #141373:

    Step 1: Go to your font folder.

    Font?

    Step 2: Find the file for the Haettenschweiler font.

    Haettenschweiler??

    Step 3: Change the extension of this file.

    How can this possibly be related to registering a license???

    Step 4: Reinstall Access. You can revert the extension after installation is complete.

    WTF????

    It worked perfectly. But it was then that I realized that I had no hope of really understanding computers anymore.

    --RA


    Ummm, fonts are software programs; they have licenses too.

  • schwa-sticker (unregistered) in reply to Zygo Blaxell
    Anonymous:
    Anonymous:
    Sweets:
    9600 baud in 1979....Holy crap.... I didn't think that was available yet.

    My BBS was running 2400 until the 90's

    I took my first two programming courses in high school on a 2400 baud LAN...in 1998! (the computers were apple 2GS - they were older than the students).



    To be older than a high school student in 1998, the computer would have to have been built in 1984 or earlier.  The Apple IIGS was not released until September 1986.

    To be older than a middle school student in 1998, the computers would have to have been purchased as the first production run came off of the assembly line.

    You are correct, the computers in question were not quite as old as I had thought. However, the real WTF is that it took took the 20 or so computers about the first third of the class to all load the operating system off of the network share at the same time...and then our instructor forced us to turn the machines off before the next class came in...

  • (cs)

    At my company I used to use a multi-platform compiler for mixed language (C/C++/Ada95) software.  One very large C file in our program was auto-coded by third party software, and suddenly one day the Intel PC build stopped compiling, with a build error... I can't remember the specific error but it was one of those general "there's something wrong with this file / structure / function definition" kind of errors.  After much pain I finally discovered that DELETING A BLANK LINE fixed the compile.

    So, was there an artificial line limit?  No, adding a blank line (or 100) also fixed the compile.

    Was there a special character that looked blank in the text editor that was killing the compiler?  Nope, not that either.

    From that day on, though, part of our build process included verifying that that file compiled, and deleting blank lines if it did not.  I no longer use that product so I don't know if the problem has been fixed, but at the time the vendor had no clue.

  • (cs) in reply to Loren Pechtel

    Reminds me of the time when working for a major Internation Telephone Co I had to take some source code for a CRC Check written in unix and port it to Windows.  This was to verify incoming data from our line sensing equipment which worked by EMF Induction on underground fiber optic cable.  Worked fine in debug but failed miserably in production.  Eventually through a few minutes work with a map file and a dissassembly of the production code I discovered that the optimizer was optimizing away the initialization of a counter at the beginning of a loop. (Oh those compiler bugs)  When recompiled without the optimization turned on the code worked fine.  BTW the idea of using EMF Induction to find buried cable turned into a major WTF for this company as they eventually dixcovered that the eddy currents set up in the fiber optic metallic sheathing increased corrosion rates by many magnitudes of ten.  

  • (cs)

    We have Lotus at my work and I have to do some development using the Lotus Notes api. It's a nasty thing to deal with.

  • EVOL (unregistered) in reply to MattJ

    I think the borg once catalogued a certain species 8192, but they failed the prelim tests to qualify for assimilation.  There was nothing in it for the collective.

  • Zygo Blaxell (unregistered) in reply to RM
    Anonymous:

    Sweets:
    9600 baud in 1979....Holy crap.... I didn't think that was available yet.

    My BBS was running 2400 until the 90's

    It was available, but not on dial-up; only on point-to-point links. the modems were the size of a suitcase.



    IIRC they also needed 2 wire pairs (4 wires total) instead of the usual one pair for plain old modems.
  • RsD (unregistered) in reply to whojoedaddy
    whojoedaddy:
    We have Lotus at my work and I have to do some development using the Lotus Notes api. It's a nasty thing to deal with.

    Not only nasty it behaves different than using the Notes itself, just create a new session and cancel the login screen, u can still have the main window while u can't do this if u opened the notes normally, I also found that I can add emails (documents) to notes without having to logon using APIs even I got to preview some emails without logging in but unfortuantly I wasn't able to the senario for doing that, I think the nasty COM apis just had a bad time at that moment.
    bottom line IBM sucks, esp for developers

Leave a comment on “Oh, the Workarounds”

Log In or post as a guest

Replying to comment #:

« Return to Article