Slashdot Mirror


Pet Bugs?

benreece asks: "During my few years as a programmer/developer I've come across some strange bugs. Recently I found that Microsoft's VB/VBScript(ASP) round function has problems (for example, 'round(82.845)' returns '82.84' instead of '82.85'). It took me an annoyingly long time to realize the problem wasn't mine. I'm wondering what other obscure, weird, and especially annoying bugs in languages/compilers/etc have frustrated other developers." Memorable bugs. Every developer has one. What were yours?

23 of 985 comments (clear)

  1. TI-8x and Negative Kelvin... by TibbonZero · · Score: 3, Interesting

    You can get a TI-8x to say that there is a negative Kelvin temperature, by converting a negative Celcius to Kelvin, but according to TI, it's where you put the negative symbol, however, none of the other Temp converters screw up with the negative numbers.

    --
    Tibbon
    tibbon.com
  2. My favorite browser "feature" by SuperMallen · · Score: 5, Interesting

    I worked a wicked long time ago on the HotJava browser, and we were forever running into strange behaviors in the ways IE and Netscape handled what looked like normal HTML tags.

    My favorite was a bug we saw with a three column table. The table's three cells were specified like this:

    <td width="31"></td><td width="42></td><td width="29"></td>

    Being a good little HTML-compliant browser, HotJava displayed them with those pixel widths. But lo and behold! When displayed in Netscape, the table filled the screen.

    We bashed our heads against the wall to figure this out until we realized that the numbers added up to almost, but not quite, 100. Netscape was treating them as percentages rather than pixel widths, even though they lacked percent signs. The cutoff turned out to be somewhere around 104 to 96. Anywhere in there and the browser would assume percentages.

    --
    -- What is this Earth thing you call "slow"?
    1. Re:My favorite browser "feature" by deebaine · · Score: 3, Interesting

      This is a popular, popular bug. A look at the NS rendering engine, I've heard, shows that NS always uses percentages, and in fact rounds pixel values to then nearest percentage. I have not personally browsed the code, but a quick test on a frustrating page I once did confirmed the performance. The difficulty, of course, is that your granularity goes down as resolution goes up. That is, on a 1024x768 monitor, you can have a minimum of 10 pixels in width; on a 1600x1200 monitor the minimum becomes 16.

      One of the most annoying bugs I have ever faced, as there really are only a few acceptable workarounds.

      -db

  3. Hidden Slashdot posts by kawika · · Score: 4, Interesting

    When I go to the front page I see one set of topics. If I go to "older stuff" I see a few topics there that seem like they should be on the front page, but aren't. I haven't checked any boxes under the preferences page's "Exclude stories from home page" so I would think they would all show up.

    I know this must be happening for most Slashdot readers because the topics I don't see have maybe a dozen posts after a day. So is it happening to you too?

  4. DEC Alpha Floating Point Bug? by march · · Score: 3, Interesting


    As I reported in RISKS in 1997:

    DEC Alpha Bug?!?

    Wed, 02 Jul 1997 15:14:24 -0400

    So there I am, looking at our trading system and noticing that the price of one particular bond was different on two separate machines. Damn, I think. Must be a bug in the latest release of our software. Quick, do a sum on all the libraries. Nope, they are the same. Executable? Nope, the same.

    Hmm... Step through the code, hey, look at that! The pow() function is returning different results!

    So, I wrote a stand alone program. Sure enough, the machine with the latest rev motherboard (one that was just replaced by DEC) is producing bad numbers. Time to try 'dxcalc', DEX's X calculator. Yup. different numbers. How about perl? Yup, different numbers. How about 'bc'? Duh, bc doesn't take floating point powers. Hmm... check libm. Nope, they are the same.

    Bottom line: DEC will be here shortly.

    Test your alpha. Try 'pow(1.234567, 7.654321)'. If you don't get 5.017something, you have the same problem.

    RISKS? In our case, could have been a large sum of money.


    The final resolution was that DEC claimed to have a bad motherboard. Yeah, right....

  5. Current bug in Windows I/O.... by Kris+Warkentin · · Score: 5, Interesting

    I just observed this bug a while ago while porting some software to windows. Do the following:

    fopen some file for writing.
    write some stuff.
    fseek to some offset near the beginning.
    write some more stuff.
    fclose.

    Simple right? Wrong. I observed that the second write didn't get performed unless you explicitly do a fflush before the close. Imagine, not writing dirty buffers out on a fclose....unbelievable.

    --

    In Soviet Russia, hot grits put YOU down THEIR pants.
    1. Re:Current bug in Windows I/O.... by NotoriousQ · · Score: 3, Interesting

      Actually, it seems that this bug is a bit deeper than just the libs. One of the post below mentions the same bug in java in windows, and I have noticed that the filestream object in .Net also fail to write out its 1k buffer.

      so many systems, so much the same bug
      (or is it a feature?)

      --
      badness 10000
  6. These are a few of my favorite (Microsoft) bugs by swm · · Score: 4, Interesting
    These are a few of my favorite bugs

    Just to show how cool I am.

  7. One of my favorites by tuxlove · · Score: 4, Interesting

    Way back when, I worked for a company that produced a special version of SysV Unix. One of our developers was going through all the source code and looking for places where global variables were initialized to zero, thusly:

    int x = 0;

    and changing them to be implicit:

    int x;

    This had the effect of reducing the size of the data section of the binary and moved the variable to the BSS section. A simple and safe optimization, albeit somewhat anal.

    Shortly thereafter things started acting funny. The OS would slowly go crazy in very subtle ways after booting. It was not clear what was wrong or if anything actually was wrong, and nobody connected the variable initialization change to the problems with the kernel. After something like 3 months, they finally figured out that when this change was applied to a single variable in the C library it invoked a compiler bug that caused the library to be compiled in such a way that caused the kernel to fail to reset the CPU's floating point registers during a context switch. (How a faulty C library could cause the kernel to do this is still a mystery to me.) This is one of the weirdest bugs I've experienced, though I'm not doing it justice here due to fading memory.

  8. You think YOU had a rounding bug???? by flatulus · · Score: 5, Interesting
    Get this: A few years ago I was doing real-time driver development for an embedded DSP subsystem using TI 54X processors. Months into the development, one of the processors started "losing" a serial port transmitter interrupt. This was an interrupt that (kinda like a machine gun) *MUST* fire every time, or it will never fire again.

    This was a major issue, because when the interrupt was lost the system froze up and had to be rebooted (this is an embedded app - not a desktop).

    I offered to assist the engineer responsible for this code. We spent two days tracing the problem in extreme detail, checking and cross-checking our results. We both concluded that the processor was simply "losing" the interrupt. There was no rational explanation. We adopted the countermeasure of using a fine grain watchdog timer to look for the lost interrupt. This isn't the best solution, since what was to keep the watchdog interrupt from being lost??? But it was the best we could do. And it worked.

    The project lead, however, was very unhappy with our solution. He was convinced that we had overlooked the cause of the problem, which had to be software-based. I countered that, though he could certainly be right, it would be better to leave the watchdog in and let the project move ahead until we stumbled across the real cause in due time. He reluctantly accepted this approach.

    My vindication took five months, but what sweet irony when it did. It turned out that some other company, which also used the 54X chip, had encountered the same problem, but they figured it out (and I'll never know how). The problem was that the 54X (at that time) had a silicon flaw that, when certain integer rounding instructions executed at the same instant that an interrupt were being asserted, the interrupt could be "lost". This was confirmed by TI to be a silicon fault, and no amount of software handstands or cartwheels could fix it. The only workaround was to not use those rounding instructions!

    OK- top that....

  9. 6502 microcode bugs... by schon · · Score: 5, Interesting

    My all-time favourite bug is in the microcode of the 6502/6510...

    An indirect jump where the source address was on a page boundary caused the high-byte to be pulled from the beginning of the current page, instead of the beginning of the next page..

    eg.
    $0100 holds $80
    $01FF holds $32
    $0200 holds $14

    then the command

    JMP ($01FF)

    would load the program counter with $8032, instead of $1432

    First time I saw it used was in some copy-protection code in the C64 version of Sim City.. It was some obfusication to screw up beginning crackers.. (it threw me for about 5 minutes..)

    Ahh, those were the days :o)

  10. AMI BIOS and beeping console by PD · · Score: 4, Interesting

    I once worked on a DOS app (about 10 years ago) that had a very strange bug. The system would lock up for no reason we could figure out. The offending statement was a printf that printed one single character (a control-G) to the screen to make it beep.

    After some testing on different computers, we discovered that it only crashed on machines with an AMI bios. Phoenix BIOS machines worked just fine, and so did real IBM machines. We never digged into the BIOS code to figure out what the problem was, but we mentioned it to the Phar Lap support people (those people were the smartest support people I ever ran across). They told us that they knew about the bug, and even explained what was happening inside the bios to make it crash the machine, but it's been 10 years so I don't remember the details anymore.

  11. I know, it's a feature. by Elwood+P+Dowd · · Score: 5, Interesting

    As far as I could tell when I was using Perl, running under strict mode would make it so that print() only worked with strings that ended in \n. I can't tell you how long that takes every beginning Perl programmer to figure out. Took me a good four hours.

    My favorite bug in slashcode is that clicking "Parent" in my default story view always returns the default story view, not the parent of the post I'm clicking on. So I have to click on the post ID number, then click parent on the resulting page.

    --

    There are no trails. There are no trees out here.
  12. My favorite compiler bug by west · · Score: 3, Interesting

    Was in the C compiler in the old Ontario ICON computer, which used a variant of QNX.

    If you had a variable that happened to be the same as the name of a function, then the compiler wouldn't complain, but it would use the address of the function as the value of the variable. Took me a **long** time to figure out where it was getting that value from.

  13. Bugs in DOS by Bistronaut · · Score: 4, Interesting

    It's turn-back-the-clock time, boys and girls. Remember all of those DOS calls? It was interrupt 20, wasn't it? Remember the findfirst and findnext functions that would get you a list of the files in a directory? You could give findfirst a list of attributes and a filespec, and it would give you a file that matched it (findnext just repeated the last findfirst). Valid attributes to pass were the archive flag, read-only, directory, etc. Except the directory one didn't work! It was simply ignored, so you had to sort out what files were directories or not yourself. What a pain in the ass! And did they ever fix it? I'll give you one guess.

    Oh, and I can't mention old MS bugs without mentioning MASM vs TASM (just because it illuistrates why Borland is so cool and MS is not). Back in the day, when applications were coded in assembler, MASM (Microsoft Macro Assembler) was popular as hell. Borland, though, came out with Turbo Assembler, which had a better syntax (optionally), could assemble MASM syntax faster than MASM could, and could emulate all the bugs in the different versions of MASM. Ah.

    Well, that's enough MS bashing for me today (or maybe just this hour...).

  14. Hidden slashdot discussions by mcc · · Score: 5, Interesting

    As others have noted, this isn't a bug, these are just the stories that the editors decided weren't important enough to warrant a full front-page thing. Funnily enough, these "section page only" articles tend to have much better and more insightful comments than the front page articles, because people only post there if they really care :)

    Beyond that, though, what i liked was that used to, on slashdot, you could post to sid's that didn't exist. Like, you could go to http://slashdot.org/article.pl?sid=haiku, or something, and while there wouldn't be a story at the top of the page, you could post comments there, and the next person to go to http://slashdot.org/article.pl?sid=haiku would see that comment and could reply to it, until the comment reached a certain age and was automatically deleted. There used to be a whole bunch of these little "hidden" discussion areas littered all over slashdot that people would form entire little communities around them. Unfortunately, this was mostly used for troll groups to coordinate attacks. (K-9-something-inches or something? I don't remember.)

    Unfortunately they seem to have removed this feature from slashdot :( Unless i'm just confused about how it's done, anyway. But it seems to be disabled, going to a non-existent sid now shows "Nothing for you to see here, move along".

    There were some other really bizarre but fun slashdot bugs, like how there was some wierd twilight zone area at sid 0, or sid null (or something.. "slashdot.org/?sid=", i think was the url.. i can't remember. i think it was called "test discussion". or something) that you'd sometimes get dumped at if you clicked on the "parent" link in the preview of a post you were writing. Not always, just sometimes. The thing was though, there was some other bug that for some unfathomable reason would sometimes cause posts to get moved out of their correct threads, and into the null discussion, at random. And people wouldn't notice this. And so if you went to the test discussion, you'd just see hundreds and hundreds of random posts, totally irrelivant to each other or anything else, on totally random subjects. It was fun to go through this and try to guess what subjects the posts were on.

    And then there was.. i barely even remember this one. There was a page i managed to get to a couple times-- i can't remember how, but there was a simple way to do it that would work every time-- that just said, "Here are some open discussions", and linked a bunch of articles. The Test Discussion was always near the top of this list. I'd expect that whatever this page is, it's gone now, but can anyone remember what this page was or how i would have gotten to it?

  15. Re:GCC 2.x and 3.x compiler by orangesquid · · Score: 3, Interesting

    Actually, I found quite a strange bug in gcc 2.95. Even with *all* optimisations disabled, this is the result I would get:

    int a = 4;
    complex_expression(dosomething(arg1, arg2, arg3, a));

    Every single time, it would evaluate incorrectly. `a' would be a random value. Seems gcc wasn't assigning it to be 4. So of course I tried:

    int a;
    a = 4;
    complex_expression(dosomething(arg1, arg2, arg3, a));

    I got the same problem. gcc was still not assigning it. The next logical step:

    complex_expression(dosomething(arg1, arg2, arg3, 4));

    It evaluated correctly---the problem had to do with the variable.

    Now here's the fun part.

    You'd think the following code would print ``4'', and evaluate incorrectly, given the trend:

    int a;
    a = 4;
    printf("%d\n", a);
    complex_expression(dosomething(arg1, arg2, arg3, a));

    It printed ``4'' and evaluated perfectly! I was stumped. I tried a dummy function:

    int a;
    a = 4;
    dummy(a);
    complex_expression(dosomething(arg1 , arg2, arg3, a));

    No good. The dummy function gets passed some bogus value and the expression evalutes incorrectly.

    I knew that the printf() method worked, and it seemed to work reliably, but I didn't want to always have to print the value. This, however, worked, and didn't clutter the screen:

    int a;
    a = 4;
    printf("", a);
    complex_expression(dosomething(arg1, arg2, arg3, a));

    With some more experimentation, I found dummy(&a) would make the code work too, but only sometimes.

    Strangest bug I've ever seen, and I'm still not sure what caused it.

    --
    --TheOrangeSquid Is it any wonder things seem so awry? We swim in a sea of confusion and don't have to think to survive
  16. How to BSOD Windows.. by molo · · Score: 3, Interesting

    This program will crash Windows NT with a BSOD. This works on NT 4, Win2K, and WinXP from an *unprivelidged* account. There is no known fix available from MS.

    main () {
    for (;;) {
    printf ("Hung up\t\b\b\b\b\b\b") ;
    }
    }

    More information is available at:

    http://homepages.tesco.net/~J.deBoynePollard/FGA /c srss-backspace-bug.html

    This is why I don't run windows.

    --
    Using your sig line to advertise for friends is lame.
  17. Re:Best Error Message Ever... by Fulcrum+of+Evil · · Score: 3, Interesting

    The buttons below were pretty cool too. One said "ok" and the other one said "lame!"

    The lame thing was a hack on the dialog code. BillG made a fairly big deal out of bad or confusing error messages, so the devs got the idea to do internal builds with the extra button on every dialog so that you could report a confusing message on the spot. Pretty cool, actually.

    --
    "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
  18. 1976 Cobol programmer's bug by vrmlguy · · Score: 3, Interesting

    I once had to debug someone else's code that looked vaguely like this:

    READ A,E,I,O,U
    [...]
    X=A+E+I+0+U

    See the problem? Note that in 1976, programmers would write their code on a form that was given to keypunch operators, who "typed" it onto 80-column punch cards that were then fed into the computer. When the author got back from vacation, I refrained from punching him in the face, and just yelled at him instead.

    --
    Nothing for 6-digit uids?
  19. Windows printf of death by tyler_larson · · Score: 4, Interesting
    Here's a simple program with some unexpected consequences. It works only on windows NT-based systems, including XP.

    #include <stdio.h>
    int main()
    {
    printf(" \b\b ");
    return 0;
    }
    To get the full effect you have to run it by double-clicking on the icon, rather than from a DOS prompt. If you want one you can run from a command prompt, replace the printf above with:
    while (1) printf(" \b\b");

    An infinte loop isn't quite as elegant as a single statement that wreaks havoc on your system, but it's still simple enough. In order to generate the "desired" result, you have to backspace beyond the first character of the terminal window, then output a printing character to the left of the beginning of the buffer. Apparently cmd.exe doesn't check for this condition, and triggers an error in a system-critical process.

    I remember Microsoft bragging about how DOS programs run in their own virtual machine, so a mis-behaved DOS app can't crash your computer. I think this example here is proof-positive to the contrary.

    If anybody has any more technical information about the cause (and possibly history) if this bug, I'd love to hear it.

    What's it do? Oh, yeah, it reboots your computer. No shutdown, no warning. Just like hitting the power switch.

    And aren't you glad you paid over $1000 for MS server software that can be rebooted by any user who executes a 4-character printf?

    --
    "With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea...."
    RFC 1925
  20. inc vs. add by coyote-san · · Score: 3, Interesting
    When I was in college, we had an introductory class to digital logic (for physics majors) with the emphasis on switches, latches, etc. We also had a single-board processor (8080) that we programmed with hand-assembled code punched into the hex keypad - one of our first projects was *always* to set up a binary->7 segment display encoder so we could read hex output instead of the binary.

    Anyway, our instructors were physics profs who focused on the hardware and never really put any effort into describing the instructions available on an 8080. We had been working at an extremely low level of logic design. At one point we had to write a program to add two numbers and display the results, and I actually wrote one looking something like

    l1: inc ax
    dec bx
    jnz l1

    I was truly dreading doing multiplication and division, but fortunately someone pointed out the basic math opcodes first.

    --
    For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
  21. Re:True story by dubl-u · · Score: 3, Interesting

    I'd wager that the majority of those who follow the herd and say, "VB is an idiot's language," have never even tried VB.

    I've tried VB; I used it by client mandate on a 4-month project. I started with only a slight bias, and ended up hating it with a burning passion. I wouldn't say it's an idiot's language, but I would agree that it makes weaker programmers.

    Why? Let's ignore VB for a bit and compare Pascal, Perl, and BASIC.

    Pascal is a language made for instruction. It's uptight, a bondage and discipline language, forcing you to program in a way that's pretty orderly. Developers who start with it tend to follow those habits later. Perl is neutral; it will allow you to program in a way that's as fussy as Pascal, but it will also let you write utterly perverse code. BASIC, has a weird set of limitations and freedoms that actively train people in bad habits that they will have to unlearn later.

    In my experience, VB isn't as bad as BASIC, but it was pretty close. My major complaint is the complaint I have about a lot of Microsoft stuff: on top of a skeleton of early, rushed design (kept for the sake of backwards compatibility) somebody glued multiple layers of marketing's features d'jour, doing so without any particular appreciation for elegance.

    A good programmer could spend some time working in VB and live; if they've had some broad exposure, then then won't learn the bad habits that VB allows and the tolerance for ugliness that VB requires. But somebody whose main experience is VB is another story entirely.

    I know of one group of former VB developers who are now Java developers. The whole way through they've worked on a large dynamic website for a major financial institution, which they redid in Java a while back. For the most part the site works, but the code brought me to tears.

    In trying to help these people (who were all smart, committed, and nice) the main problem was that 90% of them couldn't tell good design from bad, elegant architecture from tangled, or clear code from obtuse. I blame this directly on their years of working with a language whose designers didn't know the difference either.