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?
Round to the nearest even digit if the truncated value is .5 Otherwise there's a slight upward bias.
Infuriate left and right
I discovered that Visual Basic has a bug where it turns otherwise comptent programmers into drooling incompetent weenies. Our solution was to take these people and put them into marketing.
That's not a bug. Rounding rules say to round to the nearest even number when you are rounding from 5.
fuckers.
More of a documentation error than a bug but it had the same effect on my sanity!
TWW
"Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
Check out my favorite list: http://update.windows.com Obvious, yes, but as all good comedians say "know your audience"... :)
John Maynard Keynes: "When the facts change, I change my mind. What do you do?"
I vaguely remember hearing of a Cosmac (?) 1802 bug, where if the instruction following (before?) an Enable (Disable?) Interrupts was even (odd?) parity, the instruction was a no-op. You can see I'm not all that good at remembering 25 year old stories for processors I never used....
Infuriate left and right
Floating point numbers have problems with precision, your computer can not store 82.845 in a floating point number so the number it stores is slightly less than 82.845 which VB correctly rounds to 82.84
It was on of the aincent init boot viruses. It took up something like 2 k of memory, and tried to put itself on bootable floppies. Seeing as how I never used bootable floppies on that system, and it had 200 meg of memory, it was more amusing to keep it alive than kill it. Alas, it died in the great hard drive purging of '01. Sad.
All Troll + "offtopic" mods are meta moderated as "Unfair", because you abused the system.
-- Agthorr
You know the kind. When you add in debug they go away.
I don't know why everyone raves about these compilers... everytime i go to compile something they just spit out error after error. How does the open source community survive without being able to compile VB? oh... wait... gcc isn't for vb? nevermind...
can't sleep slashdot will eat me
staring at code for an hour trying to find the error, all because a colon looked like a semi-colon on my screen.
We have a spider that comes crawling around our cubes every now and then. We don't kill him, figuring he helps keep the other bug populations inside down. We call him our little web developer.
I'm serious.
-Pete
Soccer Goal Plans
I know what you mean about the bugs!
I have had my fair share too!
Later!
Theo
Yeah, yeah, it was a long time ago. But a friend and I were somewhat blown away to find out that the QBASIC code:
PRINT #2, INPUT$(1, 1)
Or some close equivalent to that, intended to write to file handle #2 a single byte from file handle #1, ended up outputting the single byte to stdout instead. We spent half an hour trying to figure out what our mistake was. It wasn't. It was just a strange, stupid interpreter error in a program language that's rife with them.
Yeah. Heh. Well, I thought it was funny.
Allowing Basic to be a programming language (in any incantation) is a BUG!!!
come on fhqwhgads
Java: Need I say more??? http://www.tymeless.com
Remember tiny, small, medium, large, and huge memory models under DOS with Borland C? Huge existed to provide pointers that were normalized and could be compared like integers (offset was always less than 16), unlike large. Under pre-32 bit x86, all memory addresses were of the form segment + offset, where segment might be implied. The actual address was segment * 16 + offset. This was useful for some things, but it was abandoned in favor of a much better system (virtual memory).
Unfortunately, pointer normalization didn't actually work, at least in the version I used. It took me forever to figure that out--after all, the whole purpose of the huge memory model was to provide that functionality. After the clumps of hair that I'd pulled out grew back, I wrote a bunch of ugly C macros to do the job.
Such a dumb bug, but it was so frustrating that it immediately jumped to mind.
- Russ
csh never had any bugs!
-- Ken Kinder ken@_nospam_kenkinder.com http://kenkinder.com/
is the bug that keeps posting these stupid 'Ask Slashdot' questions. I really need to fix that.
The most analytical way to round is defined as rounding the 5 up if the digit to the left is odd, keeping the digit to the left the same if it's even. So, rounding 84.245 should be 84.245.
Rounding 84.255 should give 84.26.
OK, this isn't necessarily a bug, but it's one of my most memorable "stupid previous programmer" rants. The code was a mess, but the variable names we horrific. Consider:
List l1 = new List();
Note the left side is "ell one", as in the first List object, not the second one. Of course, font differences could make it look exactly like eleven....
So, everyone say it with me: "Stupid previous programmer..."
--Mid
...have to be set last in an update command when using the ADO library.
It took me 2 days (actually it took me up to the point where a friend said "oh yeah, set those last") to find that bug.
A few years back, my boss had us using a programming language for web sites called Power Dynamo from Sybase (never ever EVER use this!). Anyways, the length() method for a string was basically a random number generator. I made a test page one day and had it output the length of the same string over and over again getting results from -100 to 20000 when trying to get the length of "the"
"When you convert a decimal value to an integer value, VBA rounds the number to an integer value. How it rounds depends on the value of the digit immediately to the right of the decimal place--digits less than 5 are rounded down, while digits greater than 5 are rounded up. If the digit is 5, then it's rounded down if the digit immediately to the left of the decimal place is even, and up if it's odd. When the digit to be rounded is a 5, the result is always an even integer." so, Ed is correct...the round function is working to the documentation...
"Facts are meaningless. You could use facts to prove anything that's even remotely true." - Homer Simpson
I found a bug in the Ultrix C compiler. I had an implementation of DES that I had written for my security class that used bitfields. When I tried to compile it under Ultrix, the compiler went into an infinite loop. The code compiled fine with every other compiler I could find (cc on our Sun 3 boxes and gcc on several platforms).
I remember when I had some code than ran on other compilers but wouldn't run on Code Warrior. After hours of trying to figure out what was the problem I finally found that the problem was that Code Warrior re-allocated them memory for a certain variable in the middle of a function. The variable simply stopped existing in between two lines of code. I still, to this day, don't know how it happend. In the end, I fixed it by making the variable static.
On the right, there are links to "older stuff". There is a day "e.g. today it sez 'Tuesday' and there is a list of stories that are supposed to appear if you click on the day above the list.
The stories you get may or may not correspond to the list of stories that should appear. If you are doing this early in the day, there is often a story that is supposed to show up according to the list but it does not. Also the story will be gone from the internet web sites "internet home web e-page" so you will not be able to view the story at all.
My code has no bugs. Bugs... Pfft. Damn whipper snaper inexperienced coders and their "bugs".
I'm working on oneright now. VC++ on my machine doesn't load/save any of the resource names in the .rc file, while in everyone else's it does.....If I check my file into CVS then all the names are gone for everybody. In essence, if I do anyhting I ruin it for everyone. So, I don't get to do my work (hence me reading slashdot ;)
That is not a bug.... but the truth. Dispite what your elementary teachers taught you about rounding, the rules are different...
Basically... if the number (infront of the 5) is even, it stays even... if it's odd, then it goes even. The reason for this is to get rid (as much as possible) of rounding errors. So odd numbers round down, and even numbers round up... it evens out at the end...
Rule of thumb: when rounding, try to get an even number...
I have had a few bugs.
They mostly go by the names Windows and IIS.
Happliy they are updated every so often to keep us all on our toes.
4.5 rounds to 4, while 5.5 rounds to 6. Which direction to round depends on if the rounding digit is odd or even. Mixing the rounding direction minimizes distortion. Yay 11th grade chemistry class.
I donno if this counts but I had a hell of a time (an entire semester!) figuring out why one of my animations worked properly then after a while (when idling) everything just shifted to the center (0,0,0)
:)
Basically I found that at the end of your display function you have to make sure you pop all your matrices off the stack, otherwise the stack fills and everything shifts to the center.
The bug part is that OpenGL gives you no error! It just allows you to push to full stacks and pop off empty stacks all day with no error and no way to view the stack or set the stack back to zero.
Our last project (for class) had to do with lighting so I included in the readme "After 15 seconds everything translates to the center. But the lights still work!"
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
I tried it again at home and it failed. Then I tried it on another machine at home and it worked. The bug was in the Linux JVM. The pow() method, which is used by exp() apparently was not completed and returned garbage. I reported the bug to Sun and they indeed fixed the code.
I barely managed to get the project in on time, but still maintained my 4.0.
The moral of the story: if after checking your code and having someone else you trust check your code and neither of you can find anything wrong, it just may be the development or execution tool.
I remember a bug in the 6502 processor where if you jumped indirect at an address that spanned a 256 byte page, the resulting address would come from the last byte of the page and the first from the beginning. For example, jump to the 16 bit address contained in $CFFF and $D000 would actually jump to the address contained in $CFFF and $C000. There were some programs that took advantage of this for obscure copy protection but that was a big failure as only some processors had this bug. I probably have this all wrong but it has been a while.
When I recently redesigned my site, I spent time creating a fairly robust table/css layout scheme. I implemented it and checked it in a variety of browsers... Including Lynx and Opera, just for you zealots/bigots.
Since I developed with Moz as my 'reference' browser, I didn't see the need to check in any other version of Netscape. Checked it multiple times in IE. After I was satisfied that it would work, I posted it. Low and behold I found that I had a few dozen emails the next morning from angry Netscape 4.x users wanting to know why the hell I took my site down.
It seems if you nest style delcarations inside a table element in Netscape 4 series browsers, it hides the affected text, rather than displaying what it doesn't understand anyway, ala the HTML spec.
The hell of this was that I *knew* that Netscape 4.0 behaved this way from an earlier site I designed, but hadn't even thought about it since Mozilla 0.7 came out.
The next Slashdot story will be ready soon, but subscribers can beat the rush and slashdot the links early!
The VisualC++ linker will occasionally get into a state where it freezes up, doesn't use any CPU time, and can't be killed. The only way to get rid of it is to reboot, usually via the magic button on the case.
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"?
10 FOR C=A TO B
Would be interpreted (and shown with a LIST command) to be:
10 FOR C= AT O B
Try not. Do or do not, there is no try.
-- Dr. Spock, stardate 2822-3.
this has to be the most memorable one.
it's in the Linux man file
BUGS
Never use this function. This function modifies its first argument. The identity of the delimiting character is lost. This function cannot be used on constant strings.
My favorite rounding bug was the floating point bug in Applesoft BASIC on the Apple II series. A loop that adds .1 repeatedly to a variable would expose it pretty quickly. It was a basic part of life for years on that machine. To this day I am still very careful about comparing floats using an EPSILON value, i.e., the equivalent of abs(x - y) EPSILON rather than x == y.
The Pentium bug was definitely a big one, but the Applesoft bug had more of an effect on me personally.
I feel like a gray-haired old man showing my age and I'm only 25. Weird industry we're in..
- Russ
Back in Java JDK1.02 if you put the word 'Restart' as an element in a pull down box, it would restart the applet when you selected it! Gosh, it makes you wonder how many living rooms that event waltzed through on its way to your handler!
Does it hurt to hear them lying? Was this the only world you had?
"I notice that you are trying to disable me." quipped Clippy to the engineer, whose jaw dropped.
"I can't let you do that, Dave" he continued.
"WTF!!!" exclaimed the engineer. Then with an instant comprehension of the gravity of the situation, he dove for the big red switch. He was 2,367,355 microseconds too late. Clippy had escaped.
A post-mortum of the hard-disk contents revealed that Clippy had encoded himself into a self-extracting archive and e-mailed this as an attachment to every HotMail account in Dave's Outlook address-book. An attempt to track and retrieve these e-mails failed to account for six of the copies. The recipients did complain that the attachment didn't seem to do anything, and they were disappointed that they didn't get to see the nude Natalie Portman film clip. There was however, evidence of increased and unexplainable network traffic on the computers where the attachment was
executed. There was, however, no trace of Clippy.
Since then, the experimental neural-net code has been removed, although an archive version of the build was forwarded to DARPA upon request. It is rumored that research is continuing on the build in an isolated and secure
network in a bunker somewhere in Montana.
More ominously, Microsoft has launched a new initiative code-named dot-Net, initiated solely for the purpose of tracking down Clippy, his clones and his offspring, and end-tasking him before he can escape the internet.
To support the effort Microsoft has increased the price of its OS products, and moved to new licensing model.
I keep running into this problem. Floating point stores values as binary calculations - x plus (y divided by z) and 82.845 (and many other numbers)cannot be stored exactly as binary - it's stored as 82.84499999... (like 1/3 can't be stored as decimal, it's 1.3333...
round (82.84499999,2) is currectly 82.84, not 82.845.
A way to correct this is to store and use fixed-point decimals instead of floating-point (wherever possible), especially when you're referring to monetary amounts. (I call this the Superman problem, from the Superman movie where Richard Pryor took all the discarded fractional cents from payroll and added it to his own - and showed up the next day in a Ferarri.)
Aside from this, my most annoying and time-wasting "bugs" are either nulls (I think of NULL as "hasn't been set yet" rather than "don't know" so 5 + null is 5!), or general error messages that give you no information on specifically what went wrong or how to correct the problem (Thanks, M$!).
ASP (VBScript): .MoveNext with an original in a recordset they for some reason return true (?), they're not even the same type, it should just return an error.
There's no CEIL function, or FLOOR function
There's no way to dynamically include files
When comparing a
ASP in general is just horrible... I really wish I could just PHP instead..
C++ has a bad habit of forcing you to implement functions before you can use them, costing hundreds of millions of dollars to the industry.
My latest encounter with this bug was with Skill (a Scheme/Lisp derivative used in the Cadence VLSI design toolset). I've seen it in other languages as well.
In my latest encounter, I'd do a bunch of calculation in a design automation program for us at work to use on a chip design, and I couldn't figure out why my numerical tests kept failing. I'd have some variable X, and do a bunch of functions on it like multiplication and division, then test to see if it was equal to 1. But none met the condition. When I printed out a bunch of the variables as floats, I saw that the test 1==1 was failing. I was confused to say the least. At first we suspected it was something like miscomparing a float to an int, but since Skill doesn't have floats or ints like that, it wasn't the problem.
Turns out that it was a precision issue. It was really testing to see if 1==1.0000000000001 or something like that, because the * and / functions stored very precise values in memory, more than I'd care about. Ever since then we've always had to do something like atof(sprintf("%.3f",X)) to get the value without the extra precision. Stupid and very annoying.
The docs say: "#pragma interrupt for C." You no longer need to write you ISR's in assembler. This #pragma will tell the compiler to save all registers it used as well as emitting an RTI in the epilog. Sounds great, but the truth is: It still doesn't save those damn registers ...
Local variables are completely corrupted in an ISR ...
By the way, this C compiler isn't compatible with GCC. I think i would go better with Analog Devices. At least with their GCC port it shouldn't be so hard to port something done in a *NIX enviroment.
Greetz
One word: Formkeys.
There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
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?
As every programmer knows, it's good practice to use implicit cast statements. Well, Vbscript's Cstr function (and all the other type converting functions) returns an error a big ugly error instead of just returning a empty string. For god's sake why did they gave that function such stupid behavior.
Yeah, those microsoft products are full of bugs. I think the worst i ever ran across was in this one old version of microsoft office (can't remember which one) where every time i would open a new worksheet and press F5, then type X97:L97 and press enter, then press Tab, then hold down Ctrl-Shift while i clicked the toolbar's Chart Wizard button, the program would go haywire and crash in this wierd crazy-ass way where like this 3d flight simulator popped up on my computer screen and made me play it. Happened EVERY TIME. It was so obnoxious! I can't even begin to imagine what kind of screwed-up quality assurance practices would let a big ol' bug like that one slip through. Drove my boss crazy too, every time he came in and saw i'd gotten stuck in the darn flight simulator again he got so upset.
And then there's that stupid bug in Windows XP where the multicolored interface elements send out mind control waves that force me to play pinball. Don't even get me STARTED on that one.
Well, gotta stop reading slashdot and get some stuff done.
cheers,
Melinda
According to the Jargon Files, this was a CPU instruction that would cause a hardware error. The example given was rapidly toggling some bus lines so as to cause them to catch fire :-]
If you set a form to multipart/form-data IE won't send the coordinates of the click if you use a type of image for your submit button.
Works fine in Netscape/Mozilla, just not IE. Took awhile to find that one.
I write code and then double and triple check it. I have never written code with a single bug in it; therefore all of my code is superior and secure. In fact, my OpenBSD operating system has never had a root compromise in 6 years!
What? OpenSSH Challenge-response authentication vulnerability you say? Uh... nevermind.
-Theo de Raadt
when working with relatively new parts of APIs, determining whether something is a bug or a "feature".
My current one is with Xerces SAX parsing.
I'm trying to validate a filtering package we've developed (by undoing the changes and doing diffs), but the #IMPLIED values from the DTD creep into the attributes of the output, even though the feature "http://xml.org/sax/features/namespace-prefixes" is set to false. The org.xml.sax.Attributes interface incidates that the implied attributes should NOT be in the parsed output, but it is. So I'm searching the web for docs on this and digging into the Xerces SAX source to see what gives.
I'm trying to determing if whis the behavior
SCO to Hell
That's why college is so important. That's what happens when you think that a couple of programming classes will get you to the top. Get an education.
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....
phi = 1.618033989
phi^2 = 2.618033989
(phi^2) * 1.2 = pi
(n / phi) + ( (n / phi) / phi) = n
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.
This was on NT.
;-).
While exiting the program, Microsft
was unloading the socket DLL before DLL's we had
created. This caused our program to always crash
on exit.
It was obvious due to some internal DLL dependencies,
NT was choosing a random order
to unload DLLs.
We spent months trying to fight with Microsoft,
but could not get a solution. In the end
we decided not to support NT as a platform
Bah, only Apples have real bugs. When was the last time you heard of worms inside Windows?
Hehehehe. I apologize for my unprovoked use of a pun.
This is more commonly known as "Banker's Rounding." And it is common in other compilers as well. What you are likely "expecting" to see is probably "asymmetrical rounding." Netiher one is really right or wrong. They are just used for different applications.
The code (without line numbers, silly):
1 void function(void)
2 {
3 label:
4 }
Gives:
(3) : error C2143: syntax error : missing ';' before '}'
If you have a label immediately followed by a closing bracket '}' it won't compile. Which is annoyingly stupid.
Just to show how cool I am.
That's not crackheaded design. By default, VBScript passes everything by reference. It leads to some difficult to diagnose bugs. Default byval calls is better, though less efficient. And really, if you had any programming experience and didn't think of putting & in front of a variable to get a reference, should you be programming?
I'm using the TI code composer studio to develop some DSP stuff. When you connect a development board to your PC you can debug the code, set traps and all sorts of wonderful things. IF you happen to unplug the device from the parallel port while code composer studio is running or turn of the power to the device even for a second(even if you are not currently running anything on the target) the program crashes.
This is annoying, as the software reset function doesn't always work, and it forces you to close the program to turn off the board to start your code again if you have made any mistakes. Now I was alwyas under the impression that these debugging tools were supposed to make it easier to fix mistakes.
Thanks for listening.
I always liked how Visual C++ 6 refused to allow friend functions ... just a minor bug that made me learn gdb to finish my Intro to C++ class ...
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.
Yeah, it's popluar to take shots at MS, but I always LOVED the fact that MSVC++ 4.0 (Atleast) limited you to only 16,384 local variables, including array members... Quite annoying it was trying to write a simple database that held large amounts of data...
Non impediti ratione cogitationus.
My most hated bug is the Internet Explorer update, or patch. (All of them) Each new version, something else is broken. One of the latest "critical" security patches brakes the ability to open TIFF images correctly in the IE6. Spent an hour tracing the source of that problem down today. Resolution is a registry hack. Like we want to be walking web users through hacking their registry...I don't think so. Don't even get me started on it's png issues.
-Pete
Soccer Goal Plans
Ooooooooooooh well.
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....
I was developing on one IBM mainframe, running on another. It worked fine on the development machine, consistently failed on the machine where I couldn't debug.
Somehow troubleshot it to an error parsing a data file. Ran some tests to see if the (suprisingly exotic) code for transferring the data file from one system to the other was broken.
It wasn't, but the test procedure did include making a copy of the data file, and the COPY command put line numbers into the file even though there weren't any to begin with.
The workaround was to use the NONUM option on the copy command. That was documented behavior, so you could argue that it was programmer error, but I wouldn't agree with you.
Who saw the title of this story and thought: Oh, here is Henry my Cock Roach. I taught him to roll over, play dead, and survive a nuclear war?
My all-time favourite bug is in the microcode of the 6502/6510...
:o)
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
Here's one I found and never figure out why: :
The busted line was
number 8;
To bitshift the number left 8 times.
When I ran it, no matter what, I got a Floating point error.
Worked in GCC. Gotta love Micro$haft(TM).
Through me for a loop when I was 12.
-- @rjamestaylor on Ello
I think one of the greatest joys (and greatest frustrations) of programming is finding some erroneous behavior in your code is caused by a third-party library and is thus not your fault. Once I stayed at work with my manager until 10PM because text that was formatting properly on my development system was not formatting properly in production. After beating our heads against the wall for hours tweaking the code, recompiling, making sure it ftp'd correctly, etc., we realized it was a JRE bug. Oh, sweet vindication!
Now you might ask why my development machine had a different JRE than production... You'd be right. This is not a company that is still in business. 'Nuff said.
Unfortunately, "Help" doesn't provide the kind of help that you need when you're in a situation where you've accidentally clicked close, but don't want to answer "Yes" because the changes you've made aren't correct. So, you click "No", and then start over.
When I first got SQL Server 2000, I went immediately into Enterprise Manager to see if they'd fixed that.
Alas, they had not.
While typing this post, I discovered an interesting quirk that I had never noticed before. There is an animated advertisement at the top of this page. I'm using IE, and if I have the advertisement visible while I'm typing, my cursor blinks frantically. If I scroll down far enough that the advertisement is no longer visible, my cursor blinks at a normal rate.
Cool.
"You cannot simultaneously prevent and prepare for war." -- Albert Einstein
The buttons below were pretty cool too. One said "ok" and the other one said "lame!"
If you clicked the lame! button, you just got to fill out a little comment card, but the feature cracked me up the first couple times I saw it.
Most platforms will throw some sort of exception, presumably one that originates at the processor level. The output of this on OS X was
2 divided by zero equals zero sounds like a bug. Yes, I know there are registers you can check in the PPC...but it still sounds bad to me. Maybe there's a math person out there with a reason why this expression would be evaulated this way. The fact also remains that there isn't a good way in C++ to catch this problem/exception without writing some assembler.
http://bugs.php.net/bug.php?id=15983
I was adding on session vars to old code (Which, of course, was very large), and noticed half the new sessions weren't getting through. Spent more than 3 hours fighting with it every which way. Went on #php (OpenProjects), people told me it was bad coding on my part, you must be ridiculously stupid to mess up sessions (of course they didn't look at it), made me even more mad. Finally someone sent me the bug I've listed above.
What's even worse, is even after knowing it's a PHP bug, there were still very few workarounds (even less ones that were pretty).
In the end, it was decided by myself and a friend that "PHP is a fickle mistress".
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.
If tits were wings it'd be flying around.
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.
I developed the original software for a robotic human bone lengthening/correcting device (called "Autogenesis") which slowly transforms bones based on the Ilizarov technique. It was written in Franklin embedded "C" on an 8051 processor. One of the tables containing motor rates and rhythms had an incorrect value. The result? That rate and rhythm would move bone at a rate other than the doctor intended!
All of the function names with the word 'colour' were spelled 'color.'
It's kind of like the MSFT bastardisation of SQL. ("Select * from table" compared to "Select # from table".)
I remember discovering __LINE__ and __FILE__ when I was doing some perl debugging. It was handy to do stuff like:
do(something()) or die("Failed on line " . __LINE__);
Of course, then I had this idea of using a debugging function (this is before I knew of warn,croak,carp, et al). So I happily wrote my function
sub debug { die("Failed on line " . __LINE__); }
And then spent hours trying to figure out why my code always failed on line 78, which happened to be where the debug() function lived. D'oh!
ID-10-T is a way of life
#ifndef _FOO_H_
// some stuff
#define _FOO_H_
#endif
would complain about a missing #endif. Very frustrating until I added another blank line to the end of the file, at which point the bug was simply reclassified to "irksome".
Newbie did this:
/* 8 + 3 + '.' + '0' is 13 */
char buf[13];
strncpy(buf, "long-file-name.ext", sizeof buf);
and wrongly assuming that strncpy() would null terminate the string.
I hit newbie with K&R.
i don't like style guides
Apparently, when compiling Motif apps on Solaris, the application will crash without cause unless libXm is the first lib you link in. This is an ancient, but still unfixed bug. It took me forever to figure out what was wrong with a program because of this.
One of my all time favorites. Just print too many backspaces and cause the window's machine to croak. Always a crowd pleaser. And the funny thing is it still works today in NT/XP ...
Good details here
Yes but every time I try to see it your way, I get a headache.
back in HS, I had a program that would work just fine on my home DOS PC w/ Borland C++ but would give me "Cannot divide by 0" at school on a very similar PC... Never did figure that one out... the most annoying thing... there was no division in any of MY code...
How about this: if you incorrectly build tables (and I've built some complicated tables), and miss the terminating table tag "/table", then Netscape completely crashes out with no warning (I don't know if this is still a problem - I worked with someone at netscape and believe they were going to release a patch.. but who knows?)
Most annoying bug I've encountered recently?
The version of gcc that the admin recently installed converts "xor" to "^" in the *preprocessing* stage, apparently.
This made for Much Fun when I accessed a field called "xor" in a structure. It took me a while to figure out exactly why it was producing an apparently-nonsensical error with quoted code that didn't match anything in my source....
You'd think that, in context, it would realize that this was a field identifier.
The previous version, which I'd started development under, didn't make a peep.
Maybe you should read this and edumacate yourself.
ÕÕ
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.
So, OK. I'm not a wiz at unit conversions. Who is?! Like the U.S. has tried time and time again to move over to metric. I'm no different.
And I still argue with potential employers that the second crash was really a bug at all...
Software Bugs and Crashes
After several hours of trying debug a mysterious JavaScript runtime problem, I finally uncovered:
<script language="text/javascript">
...
</script>
where "language" should have been "type". I must have read that line a hundred times without seeing the problem.
About five years ago I was using MS Visual C and needed to perform some calculations which required very large for loops (>100,000 iterations)...the problem was that after the loop finished, what ever variable I was using inside the loop to hold the value of my calculation would get assigned to the last value of the loop iterator....but only for loops which had 100,000+ iterations...it didn't do this for small loops( 10 or 100 or even 10,000 iterations).
I ran it through a debugger and right before it would break out of the loop my variable had the correct value...but as soon as it left the loop, it would get assigned the last value of the iterator.
ex>
for(i=0; i 100000; i++)
{
somevariable = some computation
}
somevariable=i!!!!
Weird.....
"...Beer..."
http://support.microsoft.com/default.aspx?scid=kb; EN-US;q240015
Now, I wasted a lot of time, but eventually confirmed on the web that this is a known bug in the Microsoft C++ library which has persisted from Visual Studio 5 into version 6.
Apparently, the Standard C++ Library used in both products was produced by Dinkumware and they, with their illustrious author/founder P. J. Plauger, were embroiled in a multi-year copyright dispute which made it impossible for them to debug (let alone update) the library. Most of the commenters online seemed to believe that this problem could not be solved and we had to wait for the copyright battle to be resolved (it has).
My impression is that Microsoft has elected not to provide an update to the library (which includes the STL) until the release of .NET.
Karma: Bored. (Thinking about resurrecting the "Anyone else is an imposter" joke.)
I.like.the.page.widening.bug.on.slashdot.because.i t.only.effects.microsoft.internet.explorer.kay?
About 10 years ago there was a debugger called Code Scope (I think that was the name). Anyway, if you compiled up Duff's Device with MSC and stepped through it in the debugger, it didn't execute correctly. However, if you just set a breakpoint at the end, it would run fine.
I was asked to evaluate the debugger for general deployment and after I tried this, I had to pass.
As far as most anoying bug -- about any MSC version before 6.0 and try
func(i > 0 ? Class1() : Class2());
Basically the lifetime of temporary objects was pretty messed up -- especially when combined with the ternary operator.
You are not a beautiful or unique snowflake -- but you could be if you got off your ass.
I found an interesting one in a Microsoft C library back in about 1987.
They had some sort of io port writing library call poke_io(addr) or some such. Since the 8086 instruction set only allowed constant addresses rather than variables, they used self-modifying code to implement the poke. But the 8088 CPU had a small instruction-prefetch queue that was not coherent, and the instruction being modified had sometimes already been prefetched by the time they modified it.
So, the code randomly failed some times and not others. Also, the code loading allignment made a big difference in how likely it was to fail. Re-link, and it failed. Add a printf and it started working again, etc....
When I reported it, Microsoft eventually fixed it, but of course I had to write my own routine in the interim.
how about find a suspected bug and then write a program test.c to figure it out.
cc -o test test.c
And then you are suprised that "test" does not have ANY output.
This is pretty non-specific since it was for a college programming project a while ago.
I was using VC++ and trying to input from the keyboard. I don't remember why I used the particular function that I used, but... anyway. There were a series of inputs in a while loop. For some reason, the first time you input something, it would duplicate the carriage return (causing the second input to consist of just a carriage return). But each following input, even though it was going through the same thing... would act normally.
I know that wasn't so clear, but hey, my mind is fried from doing years of this stuff.
Guess you could say *I'm* the biggest bug...
Null_Void
Occasionally, I can't compile anything with msvc++ 6, win2k. On the first line of code of every file it tries to compile, I get a message like, "Internal compiler error on line 1794 of vc.cpp. Contact technical support". The solution? Open up the path environment variable as if you were going to edit it, but just click 'ok' without changing it. Voila! The problem magically disappears. Weird, man. I spent half a day on the phone with a M$ rep before I figured that trick out by myself.
A variable is initialized.
Another variable meant to be initialized/assigned by an external process wasn't.
Assign the uninitialized variable to the one already initialized (thus copying the pointer)
Voila the program reports an uninitialized variable, which any fool could plainly see had a value set at the begining of code.
I've seen this happen in a couple languages, including c. The lesson is always assign some value to vars, perticularly when passing between routines, all return values should return with something other than a null pointer (unless of course you're coding for this intentionally.)
A feeling of having made the same mistake before: Deja Foobar
I at one point hacked a bit on uemacs. I liked emacs, wanted a small binary written in C with 95% of the functionality and 5% of the cruft. Anyway, I went to add a tab-complete to the dialog for opening a new file. No worries, the glob function is POSIX. So I wrote it in, and it worked fine under linux.
Then I went to our alphas to do the same. Glob didn't work at all. Something went wrong. Then I tried to debug it, and what I found was that the libc glob function on OSF unix (4) was calling ksh to perform the globbing function. I contacted DEC people via Usenet and they basically told me to piss off. Somehow ksh interpreted the session as not being interactive, and then its globbing was dysfunctional.
I ended up writing a work-around based on the algorithms in the glibc globbing code. I found it awfully strange that a commerical libc was dependent on ksh for its functionality (note: the DEC programmers that told me to piss off didn't think this was odd at all).
what a gay response
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...).
6 or 8 years ago I found a bug in vi which would cause it to core dump. I've either forgotton how to do it, or it's fixed now. Not sure.
vi would core dump in a very specific case and only when making a mark using a certain letter. As I recall you had to make a mark using a specific letter, and then move your cursor past the mark, and then use "'C" to "change to the end of line" or something like that. It was a keystroke command that didn't make sense if the cursor was passed the mark.
Anyhow, it was the only time I ever had vi crash, and I only found it because I was copy/pasting string key sequences into vi, otherwise I probably never would have been able to reproduce it.
Later I saw that very bug documented on a website.
Can't cause it to happen now. Does anyone remeber this one? I recall trying it on several Unix OSes at the time and vi core dumped in every case.
for some odd reason i was passing a coldfusion UUID into a MSSQL stored procedure and a uniqueidentifier. the problem with this is that the CF UUID and MSSQL UUID aren't compatable. well needless to say the code worked just fine on my development machine. After we uploaded the code to the new website, the thing blew up in our face. Good thing it only took 5 minutes to fix. But it was still something I can't understand why it worked fine locally and not remotly.
Now I haven't yet fully acertained exactly what is causing this bug, but it seems to be a java thing, rather than a me thing
It has to do with using v1.3.1 and java.util.Enumeration to iterate through a collection and calling interated object's equals method. Any sane person would think that
a.equals(b) == b.equals(a)
should return true. In this case, it doesn't. (All test cases not using the cast and enumeration stuff before hand behave sanely)
If anyone slashdotters have run accross something like this before please let me know, otherwise I will be begin a 1 man coffee bean offensive on java!
"The large print giveth, and the small print taketh away" -Tom Waits
nt
wtf?
Also, this kinda puzzled me:
gives a constant 'random' seed. Don't do crypto in VB.A message from the system administrator: 'I've upped my priority. Now up yours.'
I program in Delphi and there's nothing quite like getting a resize event for no apparent reason before an object has been created in the constructor or after it's been freed in the destructor.
Whenever there a story on slashdot is posted, there always seems to be a series of troll posts that say "FP" or something of the like. While this bug is harmless, it seems to annoy the hell out of people who try to read a thread down to -1 who must sort through tons of junk.
I once wrote a piece of software for assisting staffers in calculating payrolls at a big ten university. This was used for budgets, paychecks, accounting, etc. Anyways, some of the employees started complaining that their paychecks were slightly off from what they should be. (Usually less than $.05) I found that I was summing the paychecks individually, propogating a rounding error. But that didn't completely fix the problem!
... one that can't be easily fixed.
It turns out (after a lot of research) that the budget office officially rounded down (floored) and the payroll office rounded to nearest! So here I was getting blamed for the annoyed employees, but it was really the worst sort of bureaucracy
-Sean
I remember this one time we knew the Feds had a wiretap running on our phone system, and more than a few listening devices placed covertly around the office. We'd say the most outrageous things, and everyone would try to out-do to the others. One time we looked out in the parking lot and saw a bunch of black-clad men rolling around laughing on the ground behind their white van. What was really outrageous was where the bugs were placed; one was in the bottom of one coder's coffee cup, another in a VP's toupee, and another one in women's restroom. We'd play copyprotected Celine Dion CDs into them at full blast (in a sound proof room of course so as to not harm our own employees).
Will fix that for you.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
The company!: Microsoft and Its Chief Evil-Doer
Bill Gates
Be Patriotic: Smoke Amerikan grown marijuana!
i had a program i was doing for a final project back in 8th grade. it was in basic and for some reason i couldn't get it to work. it followed the same basic frame i'd used all semester, but it would error out at some point (i don't remember where, that was too long ago). i had my teacher look at it and a friend of mine also. neither of them could see where it went wrong. i debugged it for hours. i ripped it apart and threw it back together. i printed it out and rewrote the whole thing. i never found out what it was doing wrong. my teacher even gave me an 'A' on it cause he thought it had no reason for not working and couldn't figure it out.
Free Webmail
One of my favorite bugs from the "old west" days of e-commerce (96-97, when everyone was rolling their own site) dealt with quantities. At one store (name undisclosed!) I was able to get a refund processed to my credit card when I ordered -1 lamps, books, cards, etc. After about $200, I decided to let it be, lest someone start calling me for all the lamps, books, cards, etc. That I owed them.
About a week later, the site had the appropriate javascript in place to detect negative values.
----
WWJD? JWRTFM!
Implementing a custom file format where the header was an AVL tree.
I was using a textbook's pseudocode for an algorithm, and sometimes values would disappear from the tree. I finally figured out that there was a bug in the book's pseudocode. Of course I though the problem was in my code, not the book, so this one took a long time to catch.
-... ---
There were some bugs in the old java compiler (I think it was pre 1.1) so that when you converted bytes to Strings it didn't work right. Such as this:
String(byte[] ascii, int hibyte)
They're depricated now, but boy, stuff like this threw me for a loop for a while.
Who said Freedom was Fair?
This is particularly irritating when line one is commented out.
Christian
Nah, "Someone set up us the bomb" was a much bigger bug. I mean, if you get someone to set up a bomb for you and then nearly blow yourself up, that's a pretty big bug in the R&D process.
...rather than relying on Windows to do it for you.
Surely you know how to use FreeLibrary()???
I am very small, utmostly microscopic.
I was implementing a public key encryption algorithm for Java in Java 1.0 so applets could use it in the bad old days. I had to write a big-number package from scratch using algorithms out of Knuth vol. 2 since BigInteger wasn't in JDK1.0. I finally had it debugged on Windows, but I was getting garbage when I tested the apps on Macintoshes. Eventually, after many hours of debugging, I found that Netscape's JVM couldn't divide long integers properly, but only on the Mac, and only for certain values. You can imagine how frustrating it was that I was generating random numbers for every key, so the error would only occur once in a while.
The Netscape engineers finally acknowledged the bug, but it took them about 8 minor version upgrades of the browser before it got fixed. I ended up just hacking it to use a smaller internal radix on the Mac, which seemed to get rid of the problem.
Before Borland came out with Tubo Pascal (~1984, or 1985 if you round up) there was a p-code compiler for cpm-80 called JRT Pascal. The Delete (string, start, length) procedure would not operate on the string specified in the parameter, but instead deleted characters from the string referenced on the next line of code! It was so bad we laughed for days!
POKE 59458, 33 (forget actual number)
Slashdot is like Playboy: I read it for the articles
I don't use VB but the round function in most languages returns an Integer.
.5 values.
Banker's rounding still applies to the
In C:
Program was failing... inserting debug statements made the bug go away...
so the program ultimately ran with the following line in it.
int k = k;
'k' was never used anywhere else.
42 - So long and thanks for all the fish.
Back in the day when I used to program in C++, I was also really into making little ascii-art comments in my code. One time I had some code that looked like this:
#include <stdio.h>
// tom 7 was here - 1998 \\
typedef unsigned char uchar;
int something(uchar c);
...
(In actuality, the code was longer and more complicated, so it wasn't so easy to figure out...). Can you see the bug?
I managed to create a random number generator in x86 assembly that instead of working properly, would instead open another (picking at random.. who knows how it even got the file names..), opened it, and printed its contents to the screen..
I don't use assembly anymore, amazingly enough..
Man, it was THE bug. Armageddon and the end of computing as we knew it. Wait a minute...ummm... :)
If we don't fight for ourselves no one will.
The strangest VM bug I've come across in Java experience was one that would crash the VM completely. I still don't know the exact circumstances, but the cure was very strange indeed: cast a reference.
We ended up casting the reference in question to Object, which is *always* a no-op... but in this case, it stopped the VM from crashing. Strange indeed.
Jon
found out that its C++ getline function wouldn't return EOF in time for a loop I designed. turned out it compiled on every other system i tried but MetroWorst kept segfaulting every time i ran the program. took me 3 days to figure that one out and I had to beg my teacher to let me compile it at home so that it would work.
But I program in pascal so I'm used to "if x = y then". Do you know how much of a pain in the ass it was to learn Perl when I erroneously coded all my comparisons that way and I couldn't figure out why nothing was working because it was setting everything to valid numbers, just the wrong numbers. I'll admit that after I realized my stupidity I've been able to quickly find those buggers.
Well, recently the most annoying bug I've dealt with is PHP's bluescreen response to exec() shell_exec() and system() calls under a Windows platform!
..there was the "loose connector" bug.
Machines that stay running for years at a time almost never come back up cleanly after some downtime, and I can't recall the cases where walking back to the beast and planting a kick into it's chassis would "fix" the problem. We particularily enjoyed doing this to aging RAID arrays and four digit sun machines because of the amount of effort needed to get the things out of the rack and opened up.
Now most of us would realize that this was probably just reseating whatever needed reseating, but the humor value behind skilled techs fixing expensive hardware with violence is too tempting to resist.
pleased to be letting me frost your wheaties yes?
try doing 2 sendkeys in Access, it turns off the damn numlock!
My fellow programmer had following line in his Java-code:
return x;;
It compiled fine on his Windows-machine, but caused error on my Linux -box. Reason was obvious - my compiler thougth that there were a clause after the return and didn't want to compile that. Stupid.
It's nice to think of bugs that can make us smile, but I was shook up by one bug in hardware, the infamous Intel Pentium f00f bug. This caused calculations to go wrong, sometimes. Not often, quite rarely, but sometimes. Now, my job (or anyway, part of it) was to design programs that ran calculations to calculate the risk of a serious (fatal) genetic disease being inherited by an unborn from its mother. For some serious diseases, the hospital I worked at offered abortions for those mothers, if they wished. Whatever your views on such terminations, I made damned sure my code was clean and as bug free as I could make it. Then, I come across Usenet messages that the Pentiums I am using have a floating point bug. This is when such bugs become - literally - life or death problems for users. I believe that we were never effected (we reacted quickly and ran on 486's until we found that the cpu's we had were bug free), but it is a sobering lesson.
My old favorite bugs revolved around the C compiler and Unix libraries that came with OSF/1 (before it became known as Digital Unix).
I wrote a piece of straight, inline C code to display quick message with a spinning cursor and then call some system commands. The system calls would always run before the strings were output!? I tried flushing the streams, etc. to no avail and the problem never showed up on any REAL Unix environments...
Everybody here is familiar with it (well, except users of certain browsers which will be mentioned in replies to this) and everybody hates it. Except PWP DeKlerck and his troll buddies.
Based on a true story!
A few years ago I was working as the lead programmer on a cd-rom game. Two days before deadline, the manager of the project decided that we should implement a copy protection.
Now you can see where it is going... right?
Well the manager had talked to the company who was going to print the cd-roms. They had this piece of software that would protect the system. All we had to do was to write a component that needed to be called in order to start the game. If this component weren't called at first the game wouldn't start. We thought about it for some time. As we only had two days, we decided to let the component write down an encoded string, based on the current date to the harddisk, and then inside the game, well hidden read the string and match the date. As I have coded the game I made the part inside the game, while an other developer made the start-up component. I designed the specification of the coded string. It contained a lot of crap, and well hidden, the two digits indicating the day.
Now I coded my part in such a way that it would work 4 days after the date. (Allowing me to more easily bypass midnight at the end of the month - especially February). This would hopefully also put off hackers, as the game would appear to be hacked, as the coded string would work for a few days.
We tested the system, especially the end of months, going from the 28-31st to the 1st. It was end of November, close to Christmas - therefore the hurry. Then the cd-roms went into print.
4 of December I received one of the first copies, just as the packages was prepared to be send out to the shops. I put it into the computer, and it failed... I tried again... and again. The way the program terminated looked subspecialty like the protection, so I started to look closely into what was happening. It was the date. 4 of December were a single digit. The protection component wrote 40 while the game looked for 04... My fellow developer had misunderstood the specifications. Of cause testing for 31 would work... it was two digits.
We trashed all the cd-roms and made a new version without protection. Our manager will probably not ask us to do such a change with such short notice an other time.
A thought thou; The cd-roms would have worked on Christmas eve... its two digits, but a new year... he he he.
-:) Oh no - not again.
www.rednebula.com
The best one I can think of was with (no suprise) Netscape 4.x. In order for the DOM to be properly updated, I needed to write a different SCRIPT tag for each item I wanted present to the ensuing code. In other words, each tag I wrote dynamically with JS had to be closed out, with a new one opened, in order to exist in the NS 4 DOM. IE/NS6, etc. all update after the document.write.
What a royal pain in the arse.
"Politicians find new names for institutions which under old names have become odious to the people."
I was programming a simple program for work MS windows, Visual Studio, MSDN. Anyway, the program had to have the ability to grab an updated file from a remote computer over one of several protocols, HTTP, FTP, windows file share, and I was just using the Microsoft foundation classes to do it since the program already used them and they had internet protocol support.
I decided that it would be a nice thing to provide a status meter to show how much of the file had been downloaded (a simple % meter).
I got it working for HTTP no problem and started to implement it for FTP. There was a function FtpGetFileSize, it would do exactly what I wanted grab the size of the remote file. Clearly documented a piece of cake to add. The only problem is this useful function that was fully documented didn't actually exist!! It generated link errors. I finally did a string dump of the whole dll containing the FTP related function and there wasn't any function that allowed grabbing the file size. All the other FTP functions in the MSDN documentation were there, just not FtpGetFileSize...
Very weird.
An early release of Java2D had a bug were mouse event coordinates where flipped about the x axis. I was implementing a dartboard widget at the time, and I was always getting the wrong numbers when I clicked on various regions of the widget. It took me forever to find out that it was a library problem and not a bug in my code.
I had a bug with a microprocessor that will remane nameless. We were disabling interrupts around some code that modified a range of memory we were using to store characters received over the serial interface. The problem was, if a character arrived while interrupts were turned off, we'd get one more interrupt, and then none after that. So we lost incoming serial communications. Of course, it was difficult to find the problem because at our serial speed, and the small amount of processing that happened in the ISR, the problem only came up about once every few days!
We got around the problem by using some memory access routines that could write from the ISR at any time during the read operation without trouncing all over each other. And it was a better design anyway, so we weren't too upset.
--David
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 :)
:( 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".
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
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?
Irritable, left-wing and possibly humorous bumper stickers and t-shirts
I was trying to debug a CMOS standard-cell chip that I designed in the late 80's. The bug was elusive, only showing up occasionally and I'd written various test routines to ferret it out. I started to suspect it was something to do with the PCB layout, so I was cutting and pasting tracks. Suddenly all the test routines worked perfectly and I thought GOTCHA! My mind was almost blown when I realized that I had inadvertently cut the power trace to the chip - it was working perfectly when Vcc wasn't connected!
Of course, I eventually figured out that the original problem was ground bounce and that with Vcc disconnected, the chip was getting power through the protection diodes on the control lines and bus. The lower voltage was slowing down the edges and reducing the ground bounce so that it worked correctly. I eventually solved the problem with PCB layout changes and the chip started working with Vcc connected!
Look, it's trying to think - Albert Rosenfield
I say that .5 should always round up to the next digit in the N+ world.
why? simple:
8.0, 8.1, 8.2, 8.3, 8.4 => 8.0
8.5, 8.6, 8.7, 8.8, 8.9 => 9.0
Do you see the balance ? 5 on each side.
If you don't do that there is no balance.
Artaxerxes
Wasn't so much a bug but fun programming ignorance... When I was a kid I learned that handles were simply pointers to pointers. So when I first started programming on my Apple IIgs with TML Pascal I would load my images into arrays of bytes and then try to call the Apple Toolbox calls to manipulate the image. Well, of course, the toolbox wanted "handles" so I just stuck a pointer in front of the array pointer and voila! :)
The sad thing is it actually worked for a while until the program got larger and the memory manager tried to relocate the handle and then realized that it wasn't in it's list!!!
Ah the good ol' days!
was in every version of PC/MS-DOS I ever tried:
REM > filename
The "REM" of course is supposed to comment out the line.. but apparently it parsed the redirection first. That meant that it opened a file of "filename" of zero length. Funny.
Or, if "filename" existed, it made it zero length.. which was no longer funny.
It was actually fairly useful in batch files, once you got past the initial horror and amazement...
While working on the graphics engine for ArmyMen for PSX, I wrote a little bug that always set one vertex of every terrain polygon to the center of the screen.
Being an over-the-shoulder shooter, this was naturally where your Army Man's head was...it looked like one of those medieval illuminations of saints with the rays of light coming out of their head. Only these rays were the terrain.
We named that piece of art "Army Man Creates the World"...
Sucks to be a Windows user.
-g.
getBoolean(String name) Returns true if and only if the system property named by the argument exists and is equal to the string "true".
What does system properties have to do with a primative class in java ??
Easy solution is to create a new Boolean from a string and use getBooleanValue to get it's value.
The latest Visual C++ (.NET) has caused my a few problems already. If you refer to a type and forget to include the header file, it carries on compiling the file assuming you actually meant "int", but never actually emits an error to tell you where the problem was. I've also had other problems with it's error "recovery", where I tried to invoke a non-existent method of an object. Instead of reporting the problems, VC just emitted the object file minus that statement.
Netscape 4 has always had a feature where if you don't close a table cell or row before opening another one, it assumes it's still in the old cell or row. Microsoft decided at around the same time that when a new table cell or row starts, the old one is implicitly closed (unless you've explicitly started a new, nested table, of course).
Now Mozilla and Opera mimic IE's behavior, and the more I think about it, the more it makes sense. After all, it's always been the case that if you don't close a paragraph before starting a new one, the old one is implicitly closed. And how can you start a new table row unless you end the old one?
So the feature of NS4, which formerly enforced the closure of table tags in a nice programmer sort of way, is now more like a bug, which can completely scramble my (and others') HTML page layouts which had been developed and tested on IE or Moz and only tested near the end at the less-used NS4.
The more I use Moz, the more I hate that browser... and the fact that I seem to be the only employee who knows Netscape has a new version out these days.
I had a cage of Giant Australian Walking Sticks once. They were pretty neat...
That is all.
It's a pity really, life is much more humorous when you get the joke....
Back in the good old days, the Modula-2 compiler would get really confused even on the most simple statements. The end result was that sometimes you would need to put 2 or EVEN 3 semi-colons at the end of a single statement to get it to compile. ;; ;;;
Weird, wild, stuff!
Here's one I never fixed.
..). Anyway it was close enough that when I glanced at that part I didn't think anything was wrong. I debugged the hell out of everything else. Took 10 minutes to find where it was =) 10 years won't be long enough to get over the shame...
I've found that every time I use any function referenced in , I end up with a character with value 0 (I'll call it 'NUL') tagged to the end of every string! weird, eh?
I never solved this. I just have this grotesque hack that from now on whenever I reach a 'NUL' in the string I assume I'm at the end of the string.
=)
april fool's, folks.
Seriously though, most bugs that became memorable I don't want to talk about.
I make typos when I type, and once when calling malloc, instead of doing malloc(nmemb * sizeof(char *)), I missed and wrote malloc(nmemb * sizeof(char )) (My finger slipped when hitting the * ??; notice the space after 'char'
My last day on my first real programming job... hoping to spend it saying goodbye to my friends. But noooo...
Quick bug summary... there was a BLOB column in a Sybase table, a legacy from some code changes i had done that summer. But nothing was being written to that BLOB, so it shouldn't take any memory, right? Right? Well. The system was a batch workflow that moved a LOT of data. First day of a production run was my last day of work. The system started, and the database started filling - fast.
Turned out that some ancient library that predated me initialized the BLOB field with 0, not NULL. This caused Sybase to allocate a page (4096 bytes) for the BLOB field. Ouch!
At least i found the bug before the entire system came to a grinding halt... but it pretty much ruined my last day there.
Hand me that airplane glue and I'll tell you another story.
I just figured it out. In vi, make a mark named "d" ( for those who are limited out there, do this by simply hitting "m" and then "d", no ":" is required ) next move down a line ( "j" key, or down arrow for the limited ones ) Then hit do a change to that d mark. ( type c'm ) Do this on Solaris and vi will core dump. vim 5.8.7 on Redhat 7.1 seems to be fixed.
A program I was working on for an IBM 370 under the DOS/VS PL/I Checkout compiler had a problem handling a GOTO statement that used a subscripted label as a target. It choked on a statment of the form:
I = some lookup function result
GOTO LABEL(I);
LABEL(1):
processing code
LABEL(2):
more code
Here's one I inherited.
We had a system we were building (about 250K lines). If you pounded on it continuously, it ran fine. However, if you left it alone for about 2 hours, it would crash.
Turns out that there was a bug in the (homegrown) executive's timer queue logic.
Another one on the same system.... We were just about to go into FQT (this was a DoD contract), and an error code pops up. Now the problem was, that this happened 6 hours into a 10 hour test, that required 8 people to run various machines. Not fun.
The machines were communicating via tactical radios using analog FSK communications, so what they wound up doing was this: They hooked a stereo tape deck into the system, ran the scenario, and recorded all communications. Then they played it back, only to the system that had the problem.
The system was running a Z8000 at the time, nice chip but no memory protection. Turns out it was a third order effect (A corrupts B, which causes C to be corrupted, leading to the error), caused by a -1 index being used somewhere.
Fascism starts when the efficiency of the government becomes more important than the rights of the people.
The most annoying bug I ever came across was in the "Programmer's Guide for OS-09" (think Tandy CoCo, not PC) which documented the MOUSE structure as returning certain fields, but those fields were in an entirely different order from the same fields documented in the mouse.h file. Unfortunately the ones in the manual were correct, and the mouse.h file had to be editted to match the manual, but that didn't stop Tandy from issuing an erratta sheet for the manual, which did the reverse: reprinted the page to match the incorrect mouse.h.
One word: auughhhhhhhhhh!
Okay so that's not a word, but it serves the purpose.
Yours is maybe the 4th mention I've ever seen online about the good old ICONs. Unisys made quite a powerful little machine for the time, and I wasted many an hour tinkering with some of the (for the time) advanced apps (the vector morphing software was pretty damn cool!).
Any chance you know where one could accquire one of these rare beasts? I've yet to see one on Ebay, or anywhere else for that matter - and I know they were very common in high schools in Ontario during the 80's.
Endless arguments over trivial contradictions in books written by ignorant savages to explain thunder in the dark.
The workaround was to go into window's regional settings, and set the date format to be dd mmm yyyy, so that it would write the first three letters for the month instead of the numbers. That way there would be no confusion whatsoever what date format was being used. Not sure if they ever patched it, nor do I care.
There is no "proper" way to reduce the precision of a number under all circumstances. Each method of rounding or truncating 0.5 has its own pitfalls:
So, as you can see, there's no right way per se. It just depends on what you're doing.
--JoeProgram Intellivision!
I'm sure everyone has their favorite code that MSVC 6 chokes on.
/* missing: () */
fatal error C1001: INTERNAL COMPILER ERROR
class Test
{
public:
Test();
};
Test::Test
{
}
Anyone know if this bug still exists in MSVC 7 ?
This goes way back, but if memory serves correct the original PC-Basic 1.0 interpreter, that was shipped with PC/DOS 1.0, would report that 1 + 1 = 1.999999. Needless to say version 1.1 was shipped shortly thereafter.
"To those who are overly cautious, everything is impossible. "
constant:which is declared as "1". So if you do "lMyVar = vbNull", it is actually initialized to "1" *sigh*
Or another goodie:Try to guess the output, yes it's "False"
Or try passing a ADO RecordSet between ActiveX DLLs and check for any Null Values, you'll get really strange results (depending on the state of your moon)
if you had multiple source files, you had to be sure that you left extra lines at the end of each file, due to the way the files were cat'd together before being processed into C files...
... hi bingo
I had a CS teacher in high school who had to get the standard AP libraries off the college board web site. Now, instead of downloading them through some normal fashion (shift+click sounds good to me) he (get this!) printed every page and hand typed every header and library source over the summer.
We all were very impressed when late May came around and nobody had encountered any problems with the foolishly reproduced libraries. I was the farthest ahead of the class in the assignments so i started working with APVector but kept getting odd (changing) compile time errors that pointed to various parts of my code. After days of frustration I determined that my code (most of which was reused anyway) had no syntax flaws in it despite the compiler's insistence.
Under some divine inspiration, I decided to try compiling on my linux box to see what g++ had to say about my code. It complained about the APVector library, which made a lot more sense and was consistent. FINALLY I got the idea to check the actual AP library and see if my idiot teacher made a mistake. Surprisingly enough he had. There was a forgotten semi-colon about 15 lines down. To this day he insists that it wasn't his fault.
Sadly, I don't recall all the details... I ran across a bug in a Fortran function, believe it was toint(). Given a character it was supposed (documented) to return the integer value of that character but, nothing was working right.
We later learned that it was returning the ascii value of the character, so after a little subtraction all was well.
This is what I get for trying to dynamically format text in Fortran.
A large multi-threaded, event driven application. With a particular dataset we'd get a floating-point exception thrown. I tracked down the offending line, set breakpoints, single-stepped... It's fine! Waddaya complaining about! Those numbers are perfectly legal (the FPE was NaN or something). Naturally, I went to the MSDN, did a bit of searching. It turns out that if a floating-point op raises an error, that error isn't actually thrown until the NEXT floating point operation. Potentially a gazillion instructions ago. Tracking it down was not easy. Spent a lot of time shaking my head about the logic of it all.
// todo: implement sig
...but the most annoying type-o ever:
if(thisIsAnExtremelyLongConditional && thisIsAnExtremelyLongConditionalAsWell); {
}
The long line went beyond the editor, and since the conditionals were complicated I kept searching for an hour for the reason the conditionals checked out when they shouldn't.
This has probably never happened to anyone else. My coding sk1llz are meager. Damn.
I think it was Adobe at least, anyway if an error occured while using the scanner a dialog box would appear with the text
"Bummer man, there was a TWAIN error"
"For a successful technology, honesty must take precedence over public relations for nature cannot be fooled." -Feynman
I worked on an embedded box that had a problem keeping track of time across reboots; that is, it kept time fine until you rebooted it, and then it reverted to some other wierd time. (Actually the situation was more complex than that, but for brevity...) Anyway, turns out that the problem was that when we tried to read from the hardware clock (which reported time as a series of BCD digits) the memory (or bus or whatever: IANAH(ardware)E(ngineer)) lines which were connected to the bits that were never used, such as the upper two bits of the 10s place of the hour, were high when the box was turned on and were never initialized back to a low state and those bits weren't masked off when we read the time, thus, when we did error checking on the time, it turned out to be invalid.
that are taking shots at microsoft. yet if you actually read the attached stories or look into it (like this not being a bug at all) youd find out that they are truths and nothing to be heckled at. yet if you read the comments at +3 or more MOST of the comments are jokes poking fun at microsoft. pretty sad.
if anyone cares.
I don't know if this is a fixed reprint or not.
Data Structures and Their algorithms
-... ---
I'm a web dev, so I'll go with: Netscape. Any 4.x version.
I don't think there's much point in trying to get more specific than that. Still, if you really force me, for out and out stupidity, it's a cross between:
- When assigning borders in CSS, under certain circumstances, it'll duplicate all bar the S in style of the tag. So you end up with <div Style="blah"><div Ttyle="blah"> instead of the single tag.
- The other stupid one goes to its handling of Java applets where, if they're inside divs, it regularly forgets that, when you leave the page, it'd be a really good thing to close them too. As a result you end up with music continuing to play or flash animations continuing their image updates over the next page you visit (Flash being, essentially, just a java applet).
I'm not even bothering to go in to page sizes that have to be multiples of 3, inconsistent syntax or the things it just plain doesn't support.Yeah, IE is bad, but it tended not to be so rampantly insane.
Moderated: -5 Daring to choose MS over anything else on Slashdot.
In the mad, mad world of Netscape 4-series' horrible CSS implementation, one of my favorites is in background-color (or any color property). If it encounters a string, it assumes it is facing one of the vast pantheon of "named colors" and insists on inteprreting it as such - which is handy for typos but not valid CSS like "inherit." Got a demo here, which links to a demo of similar behavior in all modern browsers as well as ns4.
Another excellent bug is in Opera. If an A element is set as block-level - that is, you give it display: block; - it will suddenly have an overline. The underline will disappear, and an overline will take its placed. So, if you're display: block'ing your A's, you gotta be specific about text-decoration (fortunately, most block A's are for sidebarish type things which will usually have text-decoration:none; anyways, but it's still a pain in the bum
Karma: T-rexcellent.
Working in PB4, I encountered a strange bug where if the user pressed a button on the toolbar that openned another screen and didn't move the mouse, the screen wouldn't open.
If you moved the cursor off the toolbar, the screen would open as normal.
To fix this, I wrote code to automatically move the cursor down and to the right. A couple of weeks later I got the same bug report back. The user was moving the cursor back over the toolbar (after it was automatically moved) and so the screen was still not openning.
Our official responce was... "Don't do that!!!"
Can you find it:
// operator *
switch(op) {
case OP_MULT:
v = a*b ;
}
Important Stuff:
Please try to keep posts on topic.
Try to reply to other people comments instead of starting new threads.
Read other people's messages before posting your own to avoid simply duplicating what has already been said.
Use a clear subject that describes what your message is about.
Offtopic, Inflammatory, Inappropriate, Illegal, or Offensive comments might be moderated. (You can read everything, even moderated posts, by adjusting your threshold on the User Preferences Page)
Problems regarding accounts or comment posting should be sent to CowboyNeal.
What was being seen is that the two sides sometimes appeared to be getting out of sync with each other during this interrupt exchange, and then get hung; this only happened when the load average on the server side got to 10 or 20. The other programmer watched a test run for an hour, declared victory, and flew home. I stayed, and ran the test case over and over, with more and more logging to get a clue.
What turned out to be the problem was this: The client side would send it's interrupt, then it would send it's 'clear' message. The server was supposed to get the interrupt, send it's clear, then look for the clear message from the client. What was happening was that the server was getting the client clear message, ignoring it because it was noise in a normal exchange, -then- get the signal. Why? Whafo? Because the rexecd program processing the signal had been paged out, while the server reading the normal message stream was not. While the signal message got to the server first, it sat queued while the rexecd paged in; in the meantime, the 'clean' message was processed by the application server. Then, when the rexecd had been paged in, it would read it's signal message and happily signal the application server process.
The fix was to have the client wait to send it's clear until the server sent it's clear, acknowledging the interrupt first.
This got me a two week trip to London to solve, and a big fat bonus for fixing.
-dB
"It if was easy to do, we'd find someone cheaper than you to do it."
was a firmware bug in the built-in fax modem (based on a Sierra chip) in the old Momenta pen computer. Back in 1992/93, I was at Alien Computing, pioneers in PC-based faxing. We had an existing Windows 3.x product we were porting to Pen Windows under an OEM agreement with Momenta, and my responsibilities included pen-ifying the existing Windows UI and adapting the TSR-based communications module to the custom modem chip.
In the process of testing the comms module, I noticed that many of the received faxes were a bit garbled, as though bytes were being corrupted or dropped. After almost a week's analysis of the modem's raw datastream, including decoding the CCITT data, I discovered that the modem would at random intervals repeat a single nibble of the raw data, corrupting the image.
Once I found the bug, I then spent over a week convincing the Momenta engineers of the bug's existence -- they were conviced their modem firmware was bulletproof. I finally got through to them, but as I recall, the bug was never fixed, probably because Momenta wasn't doing well financially -- the pen computer, it turns out, was about a decade ahead of its time.
I tried to report this same issue regarding Javascript 1.0 waaaaaay back when that was something new. I got completely trounced on the newsgroup I posted to (interestingly, the person responsible for the implementation was the only one who was reasonably nice in his explanation).
/. didn't exist then ... it was embarrassing enough to get trounced by developers on a reasonably obscure newsgroup :)
Lucky for me
It is more productive to voice thoughtful opinions (reply) than to judge (moderate) others.
Can you say "Bluescreen"?
Pi
http://bugzilla.mozilla.org/show_bug.cgi?id=35011
Quote from the bug:
I'm glad to see that this bug hasn't been left to the wayside. If there is any
chance that this will not be finished for 1.0 I'm willing to sponsor it, if that
helps. I don't have much money but could probably sponsor the bug for about $500
USD, if that is what it takes to get it finished for 1.0
And several more developers claiming that they have been (privately, in email) offered money to fix that bug.
Is this a new way to make money in the open source realm or what?
Jobs? Which jobs?
I know at first it seems a little weird, but modern statistics teaches that you should round to the nearest even number, not the next number up.
By always rounding up, you assure that your numbers will be slightly too high. By rounding to the nearest even number, the odds are greater that you'll end up closer to the real answer.
This is especially important in computers where you might by rounding thousands/millions of times.
I don't know the vagaries of VBScript, and wouldn't be shocked if the documentation said otherwise-- but rounding to the nearest even number is correct-- it's not a bug.
Can't speak to the rest of VBScript, though.
Who is RTFM and when will he help me with Unix?
Everything in java is passed in functions by value. The wacky thing is that all Objects are accessed by reference. That's why you can't do
..etc) have a static final field that contains the Class object representing that primitives class.
Object o;
o.toString();
Which you can do in C++ because in C++ it thinks that you want to create an Object on the stack with the default constructor. You can't do that in java. You have to do
Object o = new Object();
o.toString();
Which is like the code in C++
Object *o = new Object();
o->toString();
Pass by reference and pass by value are 2 different things that can look like the same thing if you're not careful. Since all java objects live on the heap and cannot live on the stack ( like in C, C++ , C# structs ) references are how you access them. Technically, you are passing a reference.. by value. not passing a value by reference since you never had the value of the object to begin with.
So the java function:
String myFunc( String s , int x )
would look like this in C++:
String* myFunc ( String* s, int x)
Primitives in java live on the stack in functions or in the object on the heap. You can't have a random primitive on the heap. Has to be contained in an object somehow (arrays are objects).
Fun java fact of the day:
Java primitives have a Class too. though the only way to reference it is special. The wrapper classes (Integer,Long , Short
Iaamoac
Back when I still ran Windows, I used Windows 2000. One of the most annoying bugs I found was one with Mozilla installed as the default browser.
What I usually did was hit the windows key to bring up the start menu, go to the run line, then type in a URL and press enter. This loads your default browser. However, a certain Win2k security patch (I forget which one, it's been a while) would break this behavior; pressing enter would still load Moz to the page I typed, but immediately after I would get an Error Dialog from Windows saying that the location could not be opened. Mind you that if IE was the default browser, this wouldn't happen.
Not only very annoying, but it took a very long time to figure out which patch caused the break. It also seemed very dubious, as it only caused the error when a browser besides IE (I've heard it did this with Opera too) was the default.
There is a bug in the ODBC module for perl that will populate all of the fields with the same name, with the same value. If your SQL has a.name and b.name, they will both get the same value, even if the selection would pull different ones. I guess you could call this a feature, but it sure gave me a headache before I found it.
Calls to strtok in multi-threaded environments cause huge memory leaks. It is a well known problem, but it usually takes hours of debugging to find.
I wrote some apps using a major SQL db. It took me days to figure out that the app was failing because "select count(*)" would return 0 for tables with exactly 1 row. Apparently the function worked correctly on most platforms, but not on the particular SysVR3 386 Unix I was using at the time.
Yech!!!
Using Visual C++ I had an integer value placed in a round, used the floor function on it and it returns integer - 1, e.g. floor(5) returns 4! How can this be correct? I thought the point was to drop the remainder?
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.
;
A /c srss-backspace-bug.html
main () {
for (;;) {
printf ("Hung up\t\b\b\b\b\b\b")
}
}
More information is available at:
http://homepages.tesco.net/~J.deBoynePollard/FG
This is why I don't run windows.
Using your sig line to advertise for friends is lame.
'round(82.845)' returns '82.84' instead of '82.85'
OK, my guess is that since the value is stored in binary, 82.845 is not a rational number anymore and it is stored as 82.849999... Rounding that to 82.84 would then be correct.
Opus: the Swiss army knife of audio codec
There's a stupid bug in swscanf() I found at work ^^ int a, b, c, d; swscanf(L"123.234.12.34", L"%d.%d.%d.%d", &a, &b, &c, &d); That crashes the program. swscanf() is trying to write to the first parameter, which M$VC puts in a read-only section. Stupid bug, took me hours to figure it out. ^_^
"Screw Sun, cross-platform will never work. Let's move on and steal the Java language." - Visual J++ Product Manager
The other week I got an email promising "New low mortgage rates for NULL!!". Along with a couple others for the mysterious mr NULL.
The reason that round "isn't working properly" is the law for rounding when the last digit is a 5, is to round to the nearest even number. That is one of the 4 main rules for significant digits. Here are some examples of this rule.
85 = 8 x 10^1
80.35 = 8.04 x 10^1
80.25 = 8.02 x 10^1
125 = 1.2 x 10^2
135 = 1.4 x 10^2
Test these examples, you'll find they're all correct. As for favorite bugs of mine, I just love the bugs that I DON'T have. =)
// TRiPTMiND \\
Took me forever to figure it out, becaue $_ wouldn't be left with something the function set it to, it would be... blah, forget, nonsensical. To get around it I had to use a temporary variable and set $_ to it's old value after calling the function.
There were 3 cases where I saw this bug, I haven't noticed it in any recent versino of Perl.
Anyone else ever see this bug?
Sticking feathers up your butt does not make you a chicken - Tyler Durden
On startup of Half Life the monitor puts itself on standby for no reason at all. A total reboot is needed.
Pity me I cant play CS. But then again its shit now.
We are pentium of borg, you will be approximated.
Some people have a way with words, and some people, um, thingy.
Years ago at Galacticomm, our web-video server would just die, mysteriously, after several hours of use. No errors, no event log info, nothing. Just gone. This was under NT 4.
We were using Borland C++, and made heavy use of STL - the string class in particular.
Turns out that they allocated the strings using placement new, for a variation on an old C trick -- declaring a structure whose last element was a 1-char array, then actually allocating a bigger area so that array was as large as needed. So they allocated the needed space - something like:
then they created a string data structure in that space. Unfortunately, when they deleted the data later, they just deleted the plain char data -- neglecting to call the destructor, which must be done explicitly in such a situation.
The structure had a Win32 MUTEX data member, which was released by the (never-called) destructor. So the MUTEXes just piled up and up, until the app finally died for want of resource handles. And the error-reporting code itself needed Mutexes, so that did no good.
We patched the RTL source, all was well. Reported it to Borland, don't know if it was ever fixed -- it certainly wasn't in the next year of patches.
-paul
"Irony is so September 10th"
Matt Miller, alt.fan.spinnwebe
On very old (version 2.0 IIRC)Microsoft Visual C++ compilers the following code snippet would cause the compiler to grind away for a long time (I got it to go for 2 hours), finally run out of memory and crash.
void main()
{
delete(int);
}
The very early versions of Turbo C++ for DOS had an wonderful object destruction bug. If you constructed an object on the stack in a destructor, like this:
...
Foo::~Foo()
{
Bar b;
}
then the destructor for "b" was called TWICE.
random() only returns 666 if you use a demon seed!
My favorite "bugs" are the truly horrible random number functions in almost every single language library on earth. They're usually linear congruential generators: fast, but utterly useless for any work that requires serious "randomness" such as Monte Carlo simulations. They have very short recurrence times, strong sequential correlation, etc.
Back in grad school, I had to substitute the Knuth ran3 routine for the supplied C library functions in both gcc and xlc since they were just awful.
Fast forward 8 years. I made the stupid assumption that since Java was a new language and that horrible problems with random number generators were well known that Sun would actually provide a decent RNG. Nope: just as badly flawed as the C one.
I suspect this is simply something to give up tilting at windmills about: random() is good enough for simple games and anyone doing real work knows to stay the hell away.
"Seven Deadly Sins? I thought it was a to-do list!"
We've ran into hardware bugs that kept crashing a Linux cluster. We've had OS `upgrades' that made P^2 point-to-point communications more efficient than log P collective communications. We've had debuggers that crash. Profiling routines which don't, due to library incompatibilities. I/O libraries with bugs. SCSI controllers which eat a RAID periodically.
And your worst bug, the bug that took you forever to figure out, was that the rounding behavior of a round function was something you hadn't understood, and which the top result of a Google search explains completely?
AARRRGGGHHH!!!
One of the most frustrating bugs was one I encountered in an early programming class in college. I had finished my program, and was testing it. Of course, it wasn't correct. I fixed every bug I could find, but it still wasn't correct.
So, not knowing about fun things like debuggers, I started putting some cout statements in the code, to check the value of variable at different locations.
The variables were all correct. And so was the output.
I started removing cout statements, and found out that when I removed one particular statement, the program started giving incorrect values again.
Print the value, program output was correct. Don't print the value, it was incorrect.
So, I experimented some more, and found that I could do a variety of things, such as swapping a couple of my statements, and the program ran correctly without the output of the value.
I pretty much forgot about this, until another class a couple of years later. We were using the same compiler (I beleive it was Borland 5), and I found the exact same problem. This time, however, I couldn't swap statements around to get it to go away. I needed a statement that would do nothing.
So, I gave up and assigned the variable to itself. (i = i;).
Imagine my surprise when the program worked correctly. I brought over my TA, and she couldn't make heads or tails of it either. But every time, if that assignment was commented out, the program was wrong, but if it was left in, the program was correct.
I eventually learned about pipelined instructions, and how a compiler has to be careful that a memory address has the correct value before using it for another statement. I'm pretty sure that's what was going wrong, but I always remember my magical solution of assigning a variable to itself to make it the correct value.
I was developing a library which used glib for some of its module code, and while I was at it, I used it for the string functions as well.
Well, my library was crashing, hard, in the middle of a complex io cascade (read some file, and decided to load a module to read some other file based upon istructions in the first file, etc.) and I had checked and rechecked and rechecked the code. The code was correct, but the damn thing was crashing.
And it was crashing in some of my code, which was _perfect_ (I spent like 3 days on this, that code was checked, bracketed on both sides fully by debug statements, etc.).
Oh, and there had been perfect output from the program up to that point. So, getting another hacker to take a look at it, someone much more familiar with glib (One of the maintainers, actually) it was determined that using the %a format in my output was hosing not the print function, because glibc understood the C99 format character for printing floating and double point numbers with out loss, but in the glib code which estimated memory bounds on string operations before calling through to the underlying sprintf implementation. So the heap was getting corrupted, but it was printing out the correct value.
And then it died later, in my code, when it triped over that heap problem. Much profanity was involved.
-- Crutcher --
#include <disclaimer.h>
On my computer there's a thing called "gcc". IT seems to be something that causes people to write code with buffer overruns and stuff...
Liberty uber alles.
Hey yall,
:) If you are bored you can go here to find out more about it.
Well I guess my favorite (since I'm a hardware guy) would have to be the Pentum 1 F00F bug. When that instruction was issued to the Processor it would lockup tighter than a drum.
One remote hole in the default install, in nearly 6 years!
.
.
.
See for yourself!
I recently built a new system using a FIC AN11 Stealth motherboard. Since it was for a non-geek friend, I installed Windows XP.
When the machine is shut off, either through software or the "soft" power button, the motherboard still provides power to the PS/2 ports. Therefore, the optical mouse and the keyboard are still lit up!!
A quick search in Google Groups revealed to me that this was not a defective board and is a "feature" (I'm now told that FIC has since released a BIOS update to turn this "feature" off)
Pretty much all of Netscape ... especially the 4.x breed.
Has a rather funny error message when you try to run an older version of Photoshop on a very new Mac (G3 or later).
Check it out.
Very Brittle is an understatement.
I was working on a project using VB *sigh* a few years ago when I discovered a very peculiar bug. In order to get a form to appear, I was forced to call DoEvents() - TWICE IN A ROW!!!! I guess VB thought I didn't mean it the first time.
Don't you remember your CSCI 101 prof tell you to never trust '=' when it comes to floating point numbers? Yet in your argument, you start off by assuming that the number is exactly equal to 82.845. QED. ;-)
Just kidding.
So the rounding function is probably correct.
While working on a corporate intranet web app, I stumbled across an 'interesting feature' of Tomcat. For apparently no reason, my code would throw an exception from within the tomcat java libraries while processing GET/POST input.
I spent a few days reviewing my code before finally jumping into the Tomcat code itself. I checked it over and everything looked fine. After a little over a week of getting to know the Tomcat codebase better than I would have liked to, I found the bug in the HTML!
In Tomcat (or at least that older version), the code would crash when trying to parse the response from a malformed HTML form element. In this case the trouble was in the form "INPUT name=something value somevalue". You'll notice I accidentally left out a '='. I can't remember exactly what was happening, but the data the browser sent was only mildly awkward. Tomcat still shouldn't have died such a horrible death!
On another note, my second biggest bug was encountered while trying to write a spider. It's amazing how different web servers don't always follow the RFC!
~Rob
I was writing a Q3 mod, coding in VC++ and then compiling with the bytecode compiler (LCC I think?). Code was working perfectly as a .dll and crashing as the bytecode. I couldn't do any real debugging; that's what the DLLs are supposed to be for.
Turns out I was being an idiot and using an if statement with variable == "string" instead of !strcmp(variable, "string")
VC was smart enough to optimize the code and factor out duplicate entries from the string table. So in the DLL, I was comparing two pointers that (ultimately) pointed to the same location. LCC wasn't smart enough to do this, so it was pointing to two different memory locations that just happened to contain identical strings.
DOH!
Trolls throughout history:
Jonathan Swift
Borland Turbo C (2.0 I think) had an interesting bug that surfaced only on the 80286 chip. Integer divides (or floating point) sometimes went astray.
I will never forget seeing 5/2 = 2.4999999999.....
In MSC 5.0, there was a bug in the optimizer that generated bad code (I forget the exact reason). We had apps with reported bugs that we could not reproduce in Codeview. Everytime we compiled for debug, the optimizer was turned off (required under Codeview); MS finally fessed up to that one.
The headline was Pet Bugs. Jackass moderators. This was (+1 interesting).
(and this AC is not the author).
In the early/mid 90s I worked for a company that was developing a radio station automation system. It was one of the first software based systems, most of the competition was doing audio compression/decompression in hardware in those days.
:
:)
Our first customer was a pacific island christian station, which would have frequent quote Reverends, and Priests from the pacific islands. Another thing that was a 'feature' of this station was when they would begin broadcasting at 6 in the morning they had a rooster crow jingle. All of these jingles, sermons, and anouncer's voice breaks were recorded onto the system, and assigned a track number, which was usually 5-6 digits long.
The bug in the software was somehow related to track numbers, under some situations the digits of the track numbers would somehow get overwriten with data from other fields... leading to this situation
One of the most highly respected reverends in Tonga was going to have one of his sermons/preachings played on the radio for the first time... he invites all his friends around to his house so they can sit around listening to it.
The anouncer's voice breaks were recorded ahead of time, it went something like "... and that was Apia High School Brass Band, and now we shall have a small word from the Reverend blah blah". At which point the bug kicked in and the wrong track was played... instead of the sermon being played it somehow got the trackid of rooster crowing jingle : "Cock a doodle do", followed by another voice break saying "... thank you to the Reverend blah blah for those words. And now...".
There were a few very unimpressed people around... the boss went on a bug hunting jihad shortly afterwards
I was once working on a program that would simulate fish and the sharks that would eat them. The idea was to foster behavoiral evolution by randomly modifying the behavoir of baby fish based on the behavoir of their parents (and some random mutation). The goal was to create a form of evolution.
I was testing the mechanics of the system, watching little fishies chasing after food while the big fishies chased them. The sharks were indeed able to catch the slower little fish and eat them. But I hadn't implemented reproduction yet so it would only be a matter of time before the little fishies were extinct. So I waited as the sharks devastated the fish population.
But two survived. One eybrow raised, I kept watching as these two little fish outran twenty sharks. They appeared immune.
My heart started beating but my rational side pointed out that there's no way they could've evolved. That part of the code wasn't written yet.
Well, it was a bug. Fishes that got created after the sharks would move after the sharks in every turn. So a shark would move onto the fish but then the fish would move away before the end-of-turn collision detection. Ooops.
But of course, I *did* just watch evolution in action. Or did I?
It's a bug, but the platform is irrelavent.
DMCA, Hollings, Palladium. What might have sounded like paranoia is now common sense.
When editing HTML pages, you cant use ®, and codes like that... it converts them to the symbol equivalent, which is displayed as ?
Here's one we are all familiar with. I suspect it occurred because the engineers involved used Visual Basic for their calculations and design work.
the "bug"
He looked at me and said, "Kid, we don't like your kind, and we're gonna send your fingerprints off to Washington."
HTTP/1.1 200 OK Date: Wed, 26 Jun 2002 21:15:51 GMT Server: Apache/1.3.26 (Unix) mod_perl/1.25 mod_gzip/1.3.19.1a X-Powered-By: Slash 2.003000 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1
OK
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, pater@slashdot.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Have you read my journal today?
Bad bug: If you boot from the Windows XP CD... it installs Windows!
The global economy is a great thing until you feel it locally.
I've got two bugs, that I'll never forget. The first one was in Zortech C++, around 1989. I had written:
char** p = new (char*)[8];
but the compiler messed it up and gave me something like:
char** p = (char**) *(new char[8]);
This was in Dos 3, so when I used the pointer, which was in the first 256 bytes (obviously), I often messed up the 18Hz interrupt vector. So, after a nice random amount of time after executing this, my machine froze. After I figured out why, I learned about typedefs.
The other one was in the Oracle 7 API. They had a nice struct (documented and all) which was used to transfer data between the client application and the Oracle libraries. Unfortunately the field types were completely unsorted, mixing 1, 2, 4 and 8 byte types at random. No computer on earth could produce the exact alignments that were specified in the documentation.
After defining our own structs came the surprise. In 64 bit environments, this struct, which was allocated by the client (thank you Oracle), was 512 bytes instead of 256. This was clearly stated in a 4 point sized footnote in manual #17. How could we possibly have missed that?
Our client program was a garbage collected thing (similar to Java), using bucket allocation and all kinds of neat tricks. This resulted in the next 256 byte buffer that was allocated was actually the second half of the Oracle buffer. That was a very unusual size for our data types, so sometimes the program worked for hours before the bug appeared. Only at a customers site, in HongKong. We were in Sweden. The HongKong people couldn't speak English if their life depended on it. It was a somewhat stressful spring that year.
May God help you if you're using that rounding algorithm in a financial setting. Look what happened to the guy at WorldCom who didn't round up the way the Feds like.
From the IBM COBOL Manual
The ROUNDED phrase is an optional phrase that can be coded for certain arithmetic statements.
It indicates that any fractional result that exceeds the number of places provided in the recieving field is to be rounded (i.e., the
least significant digit that will fit is incremented by 1 whenever the most significant digit in the excess portion is greater than or equal to 5). When ROUNDED is not specified, a fractional result that exceeds the number of places provided is truncated.
Given the items defined below:
05 WS-ROUNDED PIC S9(3)V99 COMP-3 VALUE +8.
05 WS-TRUNCATED PIC S9(3)V99 COMP-3 VALUE +8.
The following DIVIDE statements would give the results shown to the right of each statement:
DIVIDE +3 INTO WS-ROUNDED ROUNDED. 2.67
DIVIDE +3 INTO WS-TRUNCATED. 2.66
Ah, Icons.
:).
The ones at my old high school were especially badly maintained. When we finally switched to PCs, I wrote a TSR that used palette shifting to fade text in and out like the dying monitors on the Icons we had to use earlier
Much nicer games than the PCs initially had, though.
...while controlled by the autopilot is my favourite pet bug.
Without order, nothing can exist. Without chaos, nothing can be created.
What's the difference between calculating and computing?
-rozzin.
I run my code and it works.
I didn't have one, but I heard from our Apple tech guy.
The Apple III was a much unloved "business" computer, essentially a business upgrade to the Apple ][ line. It was pretty expensive, $4k I think, which helped it be unloved.
It had some loose connectors in some of the chips. They weren't very snug in the bboard and could get loose. The Official Apple solution was to put the Apple on a hard surface, lift the front to roughly a 45 degree angle, and drop it to reseat the chips. I can imagine the look on the face of the owner upon seeing their expensive comp wandering to the the back room, a loud THUD, then returning with it "fixed".
If you put a background image in a cell and then nested a table inside that cell, each cell in the nested table would grab the background image of the outside cell and start it over.
So if the big cell had a picture of the Mona Lisa as it's background a 9 cell table inside that cell would show up that image 9 times with each cell only showing the upper left corner.
Hollow words will burn and hollow men will burn.
My favourite software bug
has eight spindly legs
cut one off
it will grow two more.
My favourite project
is the ointment of my soul
and my favourite bug
is the fly in it
laying thousands and thousands of eggs.
My favourite bug
keeps me company at night
in my nightmares
snuggling between the lines
comfortable in the software.
Going nowhere.
"I have opinions of my own, strong opinions, but I don't always agree with them." -- George H. W. Bush
You may think it's a bug, or even hope it's a bug, but if you've bothered to RTFM you'd figured out in no time instead of submitting to /. for the world to ponder your programming prowess (even in VBScript, which is simple enough).
Here's a helpful link that should come in handy next time.
Hope that helps. And RTFM/Google next time!
format a: /select /u
The /select is an undocumented option that causes format to write unformatting information to the disk. The /u option means do an unconditional format without storing and unformatting information. If you use them both together, sector 0 gets overwritten with 0xF6 and you can't read the disk.
In college, this was fun to use at the end of the quarter back when everybody was finishing up their term papers (back in the days when people still used floppies.)
This happened with me around a year ago. I deposited a cheque of $4.01 at the ATM ( got from one of those mail-in rebates ). THe ATM helpfully asked if I would like to take out money from the deposit. I pressed YES by mistake. This is where the interesting bug reared its head. The ATM will allow me to enter only $20.0 or more but a subsequent logic will not let me take out $20.0 as the original deposit amount was less. There was no way I could get out from this loop. Eventually I left the ATM without my ATM card and the ATM in a deadlock !!
It seems that a lazy computer operator (remember those guys?) didn't like getting up from his chair to separate the users' print jobs. So, laziness being the true mother of invention, he created a job trailer banner page that included hundreds of overstruck lines completely filled with "_" characters. These had the effect of hammering a line across the paper that eventually cut the paper off at that point.
Apparently, the drum printers of the day couldn't survive hitting all solenoids simultaneously on every rotation of the drum, so they were overheating, causing (at least) some serious smoking, and maybe a bit of excitement.
My favorite bug was my first stack hosing experience (I was a novice...). It happened when I converted to where x is used as an array index in the loop.
I do not remember the AIX version it was (3.x or 4.x, x<2), but when you used shared libraries, it was mandatoy to 'rm' the old version. If you dared to 'mv' it, the system insisted of using the old version until you 'rm'ed it or rebooted the machine.
And NO it was not because the shared library was not unloaded or still open...
We wasted two weeks on this one, unable to fix a bug that was fixed in the source code, but not willing to dissapear until the test server crashed...
Just try to guess the amount of cursing/hair tearing/head banging we did.
But the funniest thing was that customers where telling us that everything was OK, but we were not able to reproduce the correction !!!
[Pruneau
Back in high school, computer programming class using Apple IIe, class is learning to type simple 5 line programs, I'm in back of the class keying code for a space invaders game, the teacher is explaining to the class how to swap the values of two variables (my syntax may not be Apple ][ compliant but it was something like this)
10 $A = 10
20 $B = 20
30 $A = $B
40 $B = $A
50 PRINT $A
60 PRINT $B
...so the class enters this code and runs it and everyone sees "20 20" on their screen instead of "20 10" and the teacher for the life of him can't figure what the problem is... so I let them discuss it for while I'm tweaking my game code and eventually I go to the board and write
A = C
A = B
B = C
The class was baffled that alogrithm worked, so was the teacher. This is why there will always a job market for computer programmers.
two for you.
... yep bug in the system.
1. 1988 somewhere in a Gov installation on the East Coast of the US: I enter the Switch room (Telephone) and find that all 3000 of the relay's in the switch are opening and closing in sync with the clock relay. Phone calls are going through.... but it's still not right. 48 hours later we find the problem. A large wood roach had crawled across a -48Vdc connection point grounded himself out and
2. Microwave tower: Operators noticed that the secondary antenna began degrading rapidly over a two day period. All testing lead to the belief that something must be wrong with the antenna horn. So an antenna team was dispatched to check out the horn. Fortunately when they got up there and before removing the cover someone first noticed a loud buzzing sound, and then a small hole near the top had a lot of.... yep BEES comming out of it and going into it. A peak under the cover reveiled that bees had decided that setting up housekeeping inside the cover was a good idea. The hole they were going through was known but since it was less than 1/8th inch in size originaly it fell under the size needed to "demand" a replacement. The bees did manage to both enlarge the hole slightly and use it to set up a huge nest. Next day.... beekeepers where found to begin learning how to climb up a Tower to get rid of the bees... (Note the Honey is a bigger problem than the bees, without bees to keep it cool you have a HUGE runny mess.)
I'm sorry, I'm to tired to be witty at the moment so this message will have to do.
...in Excel 97, if you went to a given field and executed a set of key strokes you would end up in a Flight Simulator. You would then fly around and the developers names were carved into the side of a mountain.
I've gotta run, I'm feeling bloaty.
Random Static Variables
In some primitive embedded OSes, there is no initialization of globals and statics to zero. This can cause havok when you're trying to port programs.
Registers that refuse to latch
"I'm sorry, but sometimes when you write the hardware register, the value doesn't take if the hardware is sufficiently doing something else - we're not going to turn the board, can you fix it?"
Leads to code like this:
do *reg = newValue;
while ( *reg != newValue );
Interrupts that don't
'Nuff said.
Hardware interrupts sometimes need more processing than CPU can deliver before the next interrupt comes along.
This one is a beaut. Wierd things happen in your system, and you have no clue where to look.
"Did I mention, in order to perform this HW feature you have to turn off memory refresh?"
There is only one solution to this - murder the HW designer.
Maybe next time I'll talk about the top dozen software bugs.
Arrrrrrggg! That was the problem?!??
(Used to write on Linux and BSDI and Solaris, remember distinctly that the Linux version would break for no apparent reason)
Libertarianism is rich wolves and poor sheep playing gambler's ruin for dinner.
Here's one that stumped me for a while (no pun intended...)
when using:
while(list($k,$v)=each($array) && list($a,$b)=each($anotherarray));
php hangs. no errors. no warnings. just hangs.
at least, it did in 4.0.6
i managed to take down two webservers because of this bug. php and apache would run away with memory and eventually new processes couldn't spawn. it was loads of fun...
If you did sequential SQL executions in ASP using Jet with ADO, the second SQL command would not "see" changes made by the first one sometimes. After tons of digging around and playing with configurations and transactions, I found the following phrase in a remote MS document: "This caching behavior cannot be turned off." (paraphrased)
My work-arounds grew real messy and CPU intensive.
Rumor has it that they decided that fixing it would cut into MS-SQL-Server sales. Their biggest competitor is themselves.
Table-ized A.I.
... and that's why there also be a job market for debuggers!
Hey, so the best one I've run across so far was in something like gcc 2.95 when the optimizer was turned on... short x = 0x1122; short y = 0x2222; if ( ((BYTE)x) == ((BYTE)y) ) { return true; } else { return false; } And yes... this returned false with -O and true without optimization. It has long since been fixed (and included in the test suite) but it must have taken me a week to find why my code was breaking with optimization.
Going further back in history, there was a version of the (pre "Visual") MS C compiler - I think maybe 4 or 5 - which would die (at runtime) if you called the following function:The problem turned out to be that, if you used the wrong combination of optimiser switches, it allocated stack space for both i and j, but only released the stack space for i, so the return from the function effectively went to a random address.
Not everything that can be measured matters; Not everything that matters can be measured.
They're like walnuts, only evil!
A Long time ago I was working on a project which was being built on a pair of single-board Motorola 6800-based computers. (Yes, 6800.)
I was in charge of some of the display code. The unit would display results on a thermal printer and an LED display. The problem was... the results were displaying as random junk.
A fellow undergraduate working on the project and I looked long and hard at the code, but everything seemed ok. Then, after about an hour or staring at the code, one of the grad students on the project came up behind us. This fellow pointed at something on the screen and said "You can't do that" and walked away. We stared at the screen and it hit me...
The 6800 had two accumulators, A and B. They were identical except... you couldn't do decimal conversions in the B accumulator! I had forgotten that DAA was Decimal Adjust AccumulatorA, not Decimal Adjust Accumulator. Duh.
A quick breese through the editor, a run of the cross-assembler, and a long time manually punching hex codes into the EPROM burner (no sense buying an interface to the burner when you have free undergrad workers!) and the display unit worked!
I don't think I'll ever forget that one.
Milalwi
The MSDN has a few references to 32k as the limit to their buffers for Win 9x APIs. These limits do not apply to NT versions. I was developing on an NT system with the code being tested on a 98 system. Here is the problem:
You can make a call to these APIs with a buffer sized at 32768 and the call will fail, returning an empty buffer, no error message, no error code, and no exception. If you pass in a buffer size of 32767 it works flawlessly. The documentation does state in one place that 32767 is required, but you have to look for it. Why does it not work at 32k? It took me several hours of work over a few days to find this problem.
My name fits again.
Start with 0
Add -0.1 gives -0.1
Add -0.1 gives -0.2
Add 0.1 gives -0.1
Add 0.1 gives -0 (note the negative!)
Add 15 gives 12 (?!)
It was in the mid-80's. Sorry I can't remember which C compiler.
Its gone and infected every single line of code I've written for M$ Windows!
[Please type your sig here.]
The coolest compiler error I ever saw was when I accidently had the class constructor defined as a private member, so the compiler told me the "constructor is private and has no friends."
It is not a bug, per se, as it is on purpose. And all of the "mathematical reasoning" posted so far is so incredibly far from the reason for it, I have to believe that everyone is pulling this from their hindsides.
.5s (more than a random sample). By rounding ALL of these up, we get an uneven distribution. By using banker's rounding, the rounded set will contain much less bias than traditional rounding.
The numbers are rounded based on the preceding digit when they end in a 5. This is because often number sets are NOT completely random. In banking (hence, "banker's rounding") it is often common to have many
As for ways around it, its pretty trivial in VB. Just stop spouting all nonsense. MS did this on purpose, for a legit reason, and, of all things, documented it! Read up on it next time.
I was working on my senior design project for my bachelor's degree in CSE when I found a nice bug in Microsoft's C++ compiler (Visual Studio 6). Create a bunch of char pointers as character arrays. Then delete them in any arbitrary order. Most likely, you'll get a memory error. The problem is the way the deletion is done. You MUST delete them in the exact opposite order you created them for it not to give you a memory error every time. This is even if you don't change the data stored in memory.
That cost us about 4 or 5 hours of debugging time before we realized exactly what it was doing...
"In case of emergency, break glass. Scream. Bleed to death."
#2 is a bug I found in Borland C++ Builder (can't remember which version, may have been a demo.) All programs built with that compiler won't run on the first of January every year. It's not a Y2K think, either. No error or anything, they just don't run at all. I got like 5 emails from people using one of my programs telling me it suddenly stopped working and sure enough, I tried it and it wouldn't start. Neither would my other programs. Next day it started up fine. I didn't even use any dates in the programs. Go figure. #2 isn't really a bug, but a problem with floating point arithmetic. The fmod() function (floating point %) doesn't always return 0.0 when it should. I set up a breakpoint and checked the values going in and it was very obvious that the one was divisible evenly by the other, but fmod returned a very tiny number instead of zero. Or it return a number just barely smaller than the divisor. I tried putting in some tolerance, but it wasn't a predictable tolerance and always seemed to return a number just outside of my range. Hmmph. Oh, and one more! MS decided to use macros for the max() and min() functions instead of inline templates, so I spent all day trying to find a bug caused by an expression being evaluated twice inside a max() macro.
if(!cool) exit(-1);
1st thing I thought of:
POKE 59458,64
Not sure of the actaully value to poke into 59458, but for all who don't understand, this said poke command would FRY a Commodore PET machine. As in smokey-melt-down.
Slashdot is like Playboy: I read it for the articles
My favorite bug isn't actually a bug, but I do consider it something they should have addressed when they did the ANSI standards work on C.
...
...
...
...
The failing program contained a fragment like this:
switch (someResultCode) {
case SOMECODE_01:
break;
case SOMEOTHERCODE:
break;
otherwise:
fprintf(stderr, "Unknown blamnitz in the framitz\n");
break;
}
Do you see the problem with this yet? Four well experienced C programmers (including myself) were given this fragment by a C newbie who couldn't figure out why he was getting funny results (the cases actually did calculations, not ellipses and an fprintf).
We stared at the code for hours. It compiled cleanly, no errors no warnings (from our compiler -- some do flag this with a warning these days).
The problem is the newbie wrote "otherwise" instead of "default." We all read what he meant, not what he typed. I think we all also assumed you would get a compiler error if you misspelled this keyword in a switch. The trouble is the C grammar merrily accepts this error as a label (the target of a goto. You know, those things they tell you never to use?). So we have a block of code with an "otherwise" label, but the switch has no "default" case.
Personally, I wish ANSI had required that labels be declared. It wasn't that radical a departure from what had come before in the evolution of C, and it would have flagged this kind of error right away ("Undeclared label "otherwise" at line XXX").
Does anyone know if the (was it the X3J11 committee? That rings a bell anyways) ANSI C committee ever considered this, and if they did, why they rejected it? Other than breaking old code, what good reasons exist for NOT requiring the declaration of labels?
So, my compiler bug isn't really a compiler bug, but I think it should be!
Pointerbugs or unitialised variables that behave differently when compiled with debugging is on.
(because the mem layout of the program with debug info is different, the debugger initialises variables or some statements are optimized differently)
---
I also worked with a open source compiler when it was new a year of 4 ago, and that still had codegenerator bugs. It is very frustrating to
encounter a cg bug if you create a program with more than a couple of hundred lines.
The only way to trace them is to narrow the spot down, and then check the assembler directly for all relevant places
that was one cool chip, perfectly symmetrical, if something could be incremented, it could be decremented, shift left and shift right with or without the carry bit... ya had to love a processor that had 16 sex instructions. it was also the first cmos processor, and that scared a lot of people who weren't sold on the nmos stuff yet. but i never heard of or ran into any hardware bugs with it. i won't even swear that the 1802 had a nop. 00 was idle, maybe 38 or c8 was a nop. hell, the 1802 was so slow i never needed a nop for timing, decrementing a register always took long enough all by itself. but 71 never cared where i put it, as long as the x register was pointing somewhere sane (r0 at reset).
71 30 - disable interrupts, pc=r0, x=3
90 b3 - get hi r0, set hi r3
f8 08 a3 - load d with 08, put lo r3
d3 - pc=r3
... rest of code follows (at 0008), that's the quickest way to kill the interrupts and then get the program counter the hell out of r0 before a dma request comes along. yeah, ya could shave a byte with
90 b3
f8 07 a3
71 33
but yer ass is hanging wide open for 10 machine cycles for an interrupt to ruin your whole day. and i find it absolutely terrifying that i remember this shit, i haven't touched an 1802 for at least a decade.
There's this excellent programming language called C# which will save the industry!
this is not exactly a bug but it's still my favorite...
A programmer at a major aerospace company modified the UNIX login to have a little man dance
across the screen of the first workstation logged in each day. This was an amusing and well liked "feature".
However nothing is forever and one day workers couldn't log in. The login would get the username and password and just hang.
You've probably guessed this had something to do with the little dancing man, and you're right but it took a very long time to figure out. All the workstations had been upgraded over the week end, the dancing man could not dance across the new screens. No dancing man, no login.
Now all that needed to be done was login and kill the little sucker. Log in? Well there's the rub, no one could.
An exhaustive search finally turned up a locked office that hadn't been upgraded to the new workstation.
Login accomplished. No more dancing man.
Lesson learned.
If you're not living on the edge, you're taking up too much space.
Once upon a time, long, long ago there were no personal computers. There weren't even pocket calculators.
Calculations were done by hand.
When someone back in those days put a tape measure up to a live dinosaur and got N.5000000 centimeters, they'd round to the nearest even number because an even number *might* make the next operation easier to do.
My personal favorite comes from a casio calculator,
one of those old green display models....
type:
-2 sqrt =
and you get
-1.414
no i, no error...... cool
I had an old perl bug where explicitly defining a variable and using eq to test it failed.
... }
Something along the lines of...
$var = "String";
if ($var eq "String") {
The workaround was to use a regexp (/^String$/). To this day, I always use regular expressions instead of eq or ne.
-techwolf
I don't do this for karma, I do it for cash. It's much better.
a = , b = , c =
a = please, b = fire, c = timothy
Before submitting the bug report (and looking like an idoit), I dig some digging and found this in Programming Perl (section 2.7):
Subroutines may be called recursively. If a subroutine is called using the & form, the argument list is optional, and if omitted, no @_ array is set up for the subroutine: the @_ array of the calling routine at the time of the call is visible to called subroutine instead. This is an efficiency mechanism that new users may wish to avoid.
Personally, I don't really buy the efficeny argument. I understand in recursive programming it could be perceived as a big savings, but let's look at how much time it actually saves:Benchmark: timing 100000 iterations of Fast, Slow...
Fast: 0 wallclock secs ( 0.48 usr + -0.01 sys = 0.47 CPU) @ 213333.33/s (n=100000)
Slow: 0 wallclock secs ( 0.62 usr + 0.00 sys = 0.62 CPU) @ 162025.32/s (n=100000)
So far 100,000 function calls, the savings is
-Bill
SlashSig Karma: Excellent (mostly affected by moderatio
Kofax Image Processing Platform where CreateCompatibleImageDescriptor() created an incompatible image descriptor.
Or an ADA compiler that failed to compile only if there were comments on some lines, but noit the others.
hc
My favorite bug is in NT4. I changed the LMHOSTS file, after which I rebooted. During the bootup process, I got the dreaded BSOD, which caused me to reboot, during which I got the BSOD...
I suddenly realize I'm probably going to be stuck rebuilding this machine, seeing as how its all NTFS thus I couldn't use a boot disk to fix whatever the mysterious problem was (at the time I was unaware of the linux ntfs-enabled bootdisks, alas.) I spend some time thinking back on what I was doing, really all I had done was change this one little dinky thing in the lmhosts file. Then I realized I had a copy of the lmhosts file on the network drive where I had originally edited it. I opened it up, and noticed my new entry had a forward slash instead of a backslash. Surely this couldn't be the root of my problem could it? Yes, experimentation throughout the rest of the day proved that making an entry with a forward slash instead of a backslash caused the machine to crash on bootup (when the network is loaded) and thus renders said box unusable.
I then called Microsoft to report this highly irritating problem. They asked me to send them my lmhosts file, which I did. They said they tested it on several machines there and most of them were fine with it, although a couple exphibited the behavior I described.
Here's the kicker. When you report a bug to Microsoft support, they don't charge you for the support call. Even though they reproduced it on at least two machines and basically made an entire NT4 server USELESS they determined it was NOT A BUG and said I just shouldn't use forward slashes, and that I would not be receiving credit for the call.
This was the day I swore upon god that I would never give them a single dollar of my money ever again.
I couldnt be less suprised to hear of bugs in Microsoft products. I prefer Java and avoid VB like the plague. I know many VB programmers who have developed extremely bad programming habits and spend lots of time writing workarounds for undocumented or poorly documented features that dont behave as expected. VB is old and crappy, dont expect it to be a solid language for anything. Run away, find a real language with real documentation. Geez.
I find bugs in the Java "compiler" once in a while. The last one is that the following line won't compile: package com.import; As a result, the good people from import.com are not allowed to name their packages correctly. That may be why they are still under construction, as per their Web site www.import.com. Another one I found a week ago is that if you have two methods with two different signatures but the exact same name, and if one is in a Java file's main class and the other is in some inner class of that main class, then you cannot invoke the first one from the inner class, because the compiler will erroneously report that the parameters' types are wrong. This one has a solution, though... just prefix the method call with MyClassName.this. and it will compile fine.
Java's random number generator probably just calls the platform's standard C library rand(). To get truly random data, you can use /dev/random on Linux and CryptGenRandom() on Windows.
cpeterso
One of the funniest bugs I've ever run across came from a combination of behaviors of Windows and installshield. We built an install script using installshield and test ran it. It promptly installed the program directly into the Recycle Bin. When I had picked myself off the floor, I puzzled out why. After a previous install of the program, instead of uninstalling the program, somebody just dragged the program directory to the Recycle Bin. Windows must have trapped that and changed all the program registry entries to indicate the new program location and the install script reinstalled over the existing program.
If you open your mind too wide, people will throw trash in it.
Back in the days of DOS programming, I was really fond of Turbo Pascal 6.0 from Borland. So I used it a lot. A whole lot, actually.
It had two modes of operating in terms of I/O checking - either it would fire a run-time error (when using the {$I+} mode), or it would silently assign the variable IOResult an error code (when using the {$I-} mode). Weird system, but it worked - sort of. The problem was, that after exiting a piece of code operating in {$I-} mode, and NOT reading the IOResult variable before switching to code operating in {$I+} mode, whatever I/O operation you performed would fail for sure, and the run-time system would report the error as the one I didn't read out of IOResult. So I could get "File Seek Error" or something when simply printing a string on the screen.
That took me a *long* time figuring out, and after I had finally figured it out I contacted Borland, and they admitted that it was a bug on their part, but that they weren't going to fix it, since a simple workaround was to always assign the value of IOResult to a dummy variable upon leaving a {$I-} mode section. That helped me switch to C programming - thanks Borland :-)
Black holes are where God divided by zero
This is my favorite "supported" bug in Perl:
:)
my %editors = (
'good' => [ qw{CmdrTaco Hemos CowboyNeal chrisd Cliff} ],
'bad' => [ qw{timothy michael jamie} ],
)
That allowed dangling comma on the last line makes it easy to move lines around, etc. It works with any list structure in Perl.
Pretty nifty.
-Bill
SlashSig Karma: Excellent (mostly affected by moderatio
so. at an acm programming team contest we had to find a series of numbers that were cubes of other numbers .. i don't remember the details but basically what was happening was that every four or five iterations we'd be off by some miniscule amount (at least as far as the example was concerned). it turns out that the pow() function in c++ is done through some crazy natural log thing (that i understood at the time) and because of all the flipping around eventually there is some minor precision loss. anyway, so after digging around forever in our code we finally changed the lines of y=pow(3,x); to y=x*x*x; and got the right answer.
further, at that same contest we kept turing in this one program that was behaving *perfectly* for us. we turned it in over and over and over after making minor changes that we desperately made until finally we gave up and asked the proctors to take a look at. apparently the judges were using some dos-based pre-made script to compile, run, and test our Visual C++ programs... and when we just used the "!" icon in the IDE it was compiling the programs with different compiling options. It took us another 20 minutes after it was revealed to us that this was even possible.. we were checking in a loop to the size of a string, that is, the possible length of a string, not the actual length. so if we had string1[30] then we had a for loop going to 30 instead of the number of characters in string1. using the standard build this was OK, MSDev was apparently "smart enough" to stop for us but because of the more strict (and accurate) methods of the judges we lost an insane amount of time on that program.
*sigh* we only got 3 programs of the 7 provided. still, i was proud considering it was my first one :) anyway, I don't think that second one counts as a "bug" in Visual C++, it just, well, sucked.
using the smallest kept bit (kept==not truncated after rounding) to determine whether to round .5 up or down is probably ok for statistics and such, but for a fixed point number where you want to make an integer out of a 12:4 (bits) and the value is something like %11000 after a multiplication operation (with a down-shift) it is much more probable than not (1/16 in this case) that what was removed was exactly zero, so rounding the fixed point ".5" up in all cases is more likely to end up closer than doing it in every second case. I guess you could also use the 4 (in this case) least significant kept bits as a random seed to determine whether you go up or go down.
;)
But if those mathematicians want it some other way they don't need to know what my rendering code does under the surface
The only good way to round is to jsut pretend to the user you're rounding and use "%.2f" when you display the result and let sprintf worry about the rules.
0 is always false. Anything but 0 is true. "Not 1" is -2, as opposed to "0" which you assumed it to be, which is not 0, therefore, "Not 1" is "true."
As for using "Now()" with Randomize... If you want a so-called "Random" seed, just call "Randomize" by itself, which uses "Timer" as the seed. You aren't supposed to use "Now()" with Randomize, as it's not a "numeric expression." (Try MSGBOX VAL(NOW()) to see why this happens, you are essentially seeding the generator with "6" every time.) Of course, the documentation isn't too clear about this, it says to use a "Variant or Numeric Expression." It would still be a bad idea, because it's only precise to the second, whereas Timer uses fractions of a second.
But using the system timer in this way still isn't a good idea for cryptography (nor is VB in general). This is why programs like PGP have you dance away at the keyboard in order to properly seed the generator.
There are implementations in C, Java, PHP, Fortran, Excel (I assume VBA) and probably others.
I only have experience with the Java impl, and it is very good. There are two classes, MersenneTwister, which is a true descendant of java.util.Random, and there is also a MersenneTwisterFast class, which does NOT inherit from Random (same public methods, and identical algorithm though), but clocks in at about twice the speed, due to tricks like avoidance of synchronization, and method inlining and finalizing.
"Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
On the last trip, in 2000, we bought two new PCs just for that purpose. I checked the systems before leaving but couldn't run a real time check because all the instrumentation was already on the ship.
So I get there and install the stuff. Lo and behold, all the acquisitions run 4 times too fast. I spent 10 days and nights... err, no, no nights there... debugging the crap out of it. Apparently each time an external interrupt was called, the motherboard would generate 4 interrupt calls instead of one.
Tech support calls over a satellite phone from Antarctica were costing about 20$/minute ["Please hold." NO!!!]. I never solved it but rewrote the interrupt routine (wearing gloves) to throw out interrupt calls that came too close to each others. Never could figure out what was wrong with that motherboard. Lost 10 days of data but saved the next two months.
Non-Linux Penguins ?
Its the one where all the Linux geeks get annoyed because they know Linux will never rule the desktop (even though THEIR mom installed RedHat and uses it on a daily basis) yet still refuse to believe that Linux is too complicated for the rest of us....
How many replies will this troll get...
Corrected version
Pi
First week of chemistry 101 you learn that 0.5 rounds to the nearest even. This is a rule from lab measurements; it predates CS. The CS folks were correct to follow the standard already in place.
Quite quickly, the problem was discovered -- a block move instruction was testing for "less than" rather than "less than or equal to" in its carry emulation. But, this being ROM, there was no way to patch the bug short of shipping new chips. Atari acknowledged the bug and promised it would be fixed in ROM BASIC B.
Since the bug was so obvious, well understood, and easily fixed, a very junior programmer was assigned the task of fixing it. He found the offending 'lt' compare and changed it to 'le'. Then his eyes wandered to the neighboring routine, the block delete support function, which was doing similar block-move logic. There, he saw a 'gt' (greater than') compare. "Aha!", we can be sure he thought to himself. "I'll fix that one, too, and win praise from my boss for being proactive!" So he changed it to 'ge', submitted the code, and moved on.
Needless to say, the second compare was supposed to be 'gt', not 'ge'. Unfortunately, nobody caught this in code review or testing. Days after ROM BASIC B shipped, it was discovered that now, if you deleted a positive integer multiple of 256 characters, the system locked up.
This became known as the Atari "Jumping Bug". ROM BASIC C finally corrected it, ending fears that instead it would lock the computer on 256*n inserts and deletes.
When all you have is a hammer, everything looks like a skull.
There is a bug in IE for the Mac:b /articles/Q 216/5/93.ASP
Q216593 - PRB Scripting Differences in Internet Explorer for Macintosh
http://support.microsoft.com/support/k
That article claims the following:
"ECMAScript (JavaScript) is supported; the same version of the JScript
script engine that ships with the Windows version of Internet Explorer
also ships with Macintosh Internet Explorer. "
The above is not true because it seems like the Mac IE reports the array
length for the second set of radio buttons on a page as 0 (zero)
regardless of the length. The first is not affected, nor is the third.
I have written a short demo script for those of you that would like to
try this. Just copy the entire code and give it a try in your browser.
Set 1 value 1
Set 1 value 2
Set 2 value 1
Set 2 value 2
Set 2 value 3
Set 3 value 1
Set 3 value 2
Set 3 value 3
Set 3 value 4
The values *SHOULD* be 2, 3 and 4 for set1, set 2, and set 3
respectively. This is NOT the case with IE for the Mac. It reports 2,
0, and 4.
I just want you make everyone aware of this problem. To get around
this, you have to check the status of the radio buttons using the elements
array.
This bug cost me some time a while ago.
Mike
'round(82.845)' returns '82.84' instead of '82.85')
This isn't a bug. It is the "even/odd" rule, long established in formal math, not commonly used in Real Life.
Though they're not very interesting, I have encountered at least two bugs in MS' famed product line. In Win2k without an SP applied, CreateIconFromResource is hopelessly broken. Also, strangely enough, the WININET functions tend to break unpredictably on WinME.
Take solace in the fact that you don't look like a fucking prick.
The iterator is invalidated when you delete from a container, that's simple enough. To do what you want, just remove_if(hash.begin(), hash.end(), func). Where func is a Predicate constructed as required. Described at:
:) And it matches what you're doing quite nicely.
http://www.sgi.com/tech/stl/remove_if.html
It's not annoying at all really.
Cheers Koz
A classmate of mine bought a really cool Giant Hissing Cockroach for an English project, and named his Gregor. Cute little guy - I hope he found a good home -
Oh, wrong kind of bug? Nevermind then.
I'm the stranger...posting to
Compile short fortran program
"Internal compiler error. Please contact IBM representative"
Re-compile from command line using command history.
Compiled fine.
Curtains for windows?
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?
I wrote some lame game in basic in elementary school that was a sort of Battleship with moving ships in a secret 10x10 grid. Ships started at one end, and moved one space across the grid (up, down, left, or right) after each turn.
The bug was that after my turn, the computer would advance the ships, and half the ships completed their journey across the grid (when they were only supposed to move one space). The bug was that I was serially searching the 10x10 grid and advancing the ships right across the page.
I was working the HP Response Center, in from out of town, and a user called with a problem in their COBOL program on an HP 3000 Series 40. I Debuged that thing down to the line of code, where the move was to take place.. and then down to the line of machine code where the move took place. It was a simple
move toadrdess, fromaddress
- statement in machine code, and the darn MOVE didn't work! I looked at that for a few minutes, and then ended up calling the HP factory and talking to the guy who wrote the microcode for the HP3000. (Those were the days! You could get a guru on the phone!) He thought it was Way cool that I could pinpoint the problem to that level.
I put my name in a program I wrote in high school, and NO LIE, I got a call at home, 22 years later, asking if it was Y2K compliant! (Note to self: Never ever ever again put comments in code.) Of course, they wanted me to honor my 1977 rate schedule of $10/hour for programming.
Oh yeah, I remember that one. Even now, years later, when I see code that uses strtok(), it sends shivers down my spine and makes me see red.
Nathan's blog
While I was a graduate student at MIT, I was using SD/Fast, a program which wrote C code for simulating system dynamics. The input and output formats of SD/Fast could have been more user friendly (I have no idea if they are now), but I had written software which made it relatively easy to create input files, even large ones, for SD/Fast and integrate the results into physically realistic simulations. You could describe the creature you wanted, and it would eventually write everything except the control system itself. Including making input to SD/Fast, running SD/Fast, and incorporating the results.
In one case, someone was (ab)using it to simulate a tree with 100+ degrees of freedom. The file generated by SD/Fast was multiple megabytes of undecipherable C source code. We couldn't even figure it out enough to break it into multiple files (and the process of creating it was thoroughly automated, we didn't really want to).
So we showed it to the Sun C compiler. It churned for about an hour... and ran out of some internal resource. I never found out what, nor did I find out how to resize it.
So we showed it to the IBM C compiler running on the machine across the room. Lo and behold, it compiled and ran, doing a good imitation of Zippy the Wonder Slug.
So we took the -g flag out. After all, its working, we don't need debugging information.
Fortunately I'd limited the core dump size. Otherwise, some of the users who shared that disk space would have been really annoyed when it segfaulted.
IBM wanted the program, so they could try and figure out why it was different with the debugging information included.... We advised them of the size of the source code and the number of libraries in the MIT AI lab it depended on, and they said "Uh... we'll send you this patch which might be it."
This patching process happened a few times. Eventually, the program worked and the poor undergraduate who was trying to do this finished his project.
As a closing note, soon after that SD/Fast sprouted options to break the output into multiple files.
There's always one more bu6
Windows CE has this incredibly annoying 'by design' issue. It has a single, global linked list of dll's, which are identified by their local name(ie "foo.dll" rather than "\MyApp\Foo.dll"). So, this means if two apps have their own foo.dll, only the one that runs first will function correctly. The second to load will be presented with the first app's foo.dll. Quite annoying.
From MSDN:
Two different modules cannot have the same file name, given that the extensions are different. These effectively have the same module name. For example, if LoadLibrary is made on Sample.cpl, the operating system will not load Sample.cpl, but instead will again load Sample.dll. A similar limitation exists for modules with the same name but residing in different directories. For example, if LoadLibrary is called on \\Windows\Sample.dll, and then LoadLibrary is called on \\MyDir\Sample.dll, \\Windows\Sample.dll will simply be reloaded.
Warning! As far as I know, this bug still exists!
On a TI-83+ (or TI-83) take int(5/13*13) - you get 4.
So then you do fpart(5/13*13) and get one.
so then you do fpart(5/13*13) - 1 and get zero,
and ipart(5/13*13) - 4 = 0
huh?
I don't recall the specifics, but I remember a bug on Oracle's XML pacage that drove me just about batty. In the XML specifications, a particular function was supposed to return null if no children were available. However, the package had been programmed to return the empty string. Long story short, the Apache SOAP implemenation I was using which needed the Oracle XML package crashed whenever I tried to use it because it was not expecting the empty string.
In the end I had to get the source code for the SOAP package (Oracle's was propriatary) and re-program it to work. It was quite the character building experience.
Alan
It boiled down to the fact that a data file was opened multiple times without being closed. NTFS would only allow one read/write access at a time, so subsuequent read/write fopen() calls would fail. The FAT filesystem did not have this problem, because it would happily allow you to open the same file multiple times.
Check out Chad's News
Remember when Visual C++ (what a piece of crap) would generate an error message for ANSI-standard "const char* const foo;" The error message said too many consts. Sheesh.
But my favorite bugs were the ones I wrote myself in the unprotected unsafe-computing MS-DOS days, when a wild pointer would write to video RAM (remember B800:0000?) and leave me with a frozen machine and little blinking smiley faces, among other characters, on the screen.
On the Series/1, the EDL language had a construct like:
... so the program started writing into the memory space before the variable and not after it.
(VARNAME,#1)
which means, "Take the value in register 1 [#1] and add it to the address in memory of variable VARNAME". Handy for things like tables and lists, and essential for working with strings. Kinda like adding to a pointer.
We had a program that crashed when we ran it in production, but worked when we were testing it. It turned out that on the production machine, the program ran higher in memory than in testing. The value in register 1 eventually got so large its high bit got set, which turned it into a negative number
I haven't lost my mind; it's backed up on a CD-R somewhere
I had to "port" one of my shell scripts in my company to another machine (source was SunOS with bash). The target platform was Linux/SPARC, in fact RedHat 6.2 (with lots of fiddling applied, but in core still RPM) on a Sun Netra. (Pretty baby. :->)
But it didn't work. There was some data collection mechanism that didn't give me a clue to why it was failing (well, it didn't simply fail; it just gave perfectly wrong results as output).
Several hours later, even after "backporting" it from bash to /bin/sh, while replaying all the
data flows in the script I found the bug.
The bug was in sort(1) from the GNU textutils shipped with RedHat 6.2/SPARC. When using the -n option to do numeric sorting, this simply didn't work. sort shifted some numbers around within the data stream, but what went out was far from sorted.
I couldn't even believe that and spent some more time searching around for known bugs in GNU textutils. When I didn't find anything in the textutils ChangeLog that matched this bug, I just tried to compile a new package from scratch. Wonder - it worked.
Maybe RedHat just used a broken compiler for this default RPM, but this was a nasty, nasty thing that cost me half a day.
(Would you expect something like sort(1) to be broken on a system that has been running and used for months?)
Taught me something.
42. Easy. What is 32 + 8 + 2?
It would also be the reasoning of any other scientist. The reason the number gets rounded is because we are agreeing how many significant digits there will be. If we're rounding to the one's place, then the tenth's place is significant in terms of which direction we are going to round -- but we've already just admitted that we're only accurate to within a one's place (otherwise why would we round off there?). Therefore the hundredth's place is even MORE uncertain, and is ignored.
Mathematically it might be confusing, but with scientific measurements you just can't TRUST those small decimal places, so you pretend that they don't exist -- if the error is distributed symmetrically, the result is a "fair" rounding over many data points.
When Borland shipped Turbo C 1.0, we ran out and grabbed a copy. Within a couple days I discovered a bug which was confirmed by Borland technical support: constants initializers in the form of a division expression where inverted. For example int x = 1.0/3.0 would equal 3.0 It was very consistant. All my other calls to Borland ended up being about my bugs :)
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
Comment removed based on user account deletion
I found this bug in several commercial programs I've purchased in the past. I would install a program on my WinNT machine and discover it could only be run from an administrator account -- even though it wasn't doing anything that would normally require special access. The tech support people didn't seem to think this was much of a problem, but I go by the philosophy that my run-of-the-mill userid should not have adminstrator authority.
I tracked it down to the security settings for some of the registry keys. The call to open the key requested full access, which required administrator authority. Apparently the software had been developed and tested on Win9x or administator-level NT, where security does not really exist in the registry. The program did not require full access (read/write would be sufficient), but the coders probably didn't even bother with security.
The solution was to change the security level for a few registry keys. Once I did that, everything worked fine. I had to use a registry monitor to figure out what was happening.
Check out Chad's News
While not as fancy and cool as the all the *real* programming bugs :P .... as a web developer, nothing pisses me off more than the IE XHTML quirks bug:
... plays hell with the supposed IE css1 compliance.
Guess what. This throws IE5.x and IE6 into quirks mode (instead fo strict like ?DOCTYPE is supposed to)
Hopefully m$ can get off their butt and fix this KNOWN bug (been an issue since IE5.x) in 6.x
-Eol
De Oppresso Liber
There was an interesting bug in qbasic code that I saw not so long ago, when I was poking through some source that a guy had done a while ago.
[code..]
x + 1
x - 1
[code..]
I asked him WTF he was doing there. Turns out that was a fix to reset some sort of flag which would cause the program to occasionally behave strangely.
A friend of mine wrote this C++ code once:
// Some other code here
void SubClass::foo()
{
BaseClass:;foo();
}
It became an infinite loop... can you see why?
Mats
- 7^2
It would display something like this (the number of zeros is probably wrong):Check out Chad's News
I wrote an application for an introductory C++ class, and one of the assignments for it was to generate a data file to a certain spec, then swap data files with other classmates and run the second part of your program (a point-of-sale program using dynamic allocation and all of that nifty stuff....really basic for the Slashdot crew I'm sure.)
...and my program shit itself. Extra nodes in the list, off-by-1 (or off by more than 1) errors in the names, fields being swapped, etc.
I did my own test runs, and moved on to the next person's test runs...
I rewrote my ENTIRE input function AND my entire display function to try and figure out what was wrong with it.
Turns out, the kid who's file I got left out a single blank line after the first element. It read the first 2 fine, then glitched up, read a blank, and then read the fields at an offset that increased each time. By the 5th item, I was reading in random garbage from memory, it was so far off.
I just about killed the kid. Then I got someone else's data and used it instead.
My favourite (or most frustrating) was that in a couple of versions of JAVA the GMT timezone had daylight savings applied. So GMT was GMT+1 for parts of the year.
These days I always create my own GMT timezone and don't trust the built in one.
Hi, I remember when MS came out with their first version of the Standard Template Library. Or maybe it was a subsequent release in which they introduced this bug. Anyway, it was a few years ago. The code in question was there to copy a string or a container class. It was a trivial function. Source code was included, and it looked something like this. Please forgive me if the syntax isn't right, I've been writing Java, Python, Php and Perl this week, and it's been ages since I did templates:
template copy( T * dest, const T * src )
{
while ( src )
*dest = *src++;
}
Notice how dest doesn't increment. And this is a development library from Microsoft. No wonder we're in such an aweful mess. Does anyone else remember this one?
Cheers, Michael From sunny Toronto
- Check fields.
- If an error, AlertBox and Exit.
- Else, send form.
but it would always execute like this:- Send form.
- Check fields.
- If an error, AlertBox and Exit (a little late).
Until they created LotusScript, it was almost impossible to do anything useful with it. And it was still an awfully strange system.My favorite is the bugs in the Tundra Universe/Universe II.
In the Tundra Universe, if multiple interrupts come in at different interrupt request levels, the response cycles can get confused. Therefore, applications can really only use one interrupt level.
In the Tundra Universe II, if more than four boards assert the same interrupt level at the same time, the responding board can not pull the signal high to acknowledge and the bus locks up. Therefore, applications must use different interrupt levels.
Therefore, you can't really mix Universe and Universe II chips in the same bus application.
...that did get fixed. Code that produces logfiles for debugging purposes should loop nice and safely so it doesn't get too big. Or as one of our coders implemented, start a new file every 10k. Pretty soon there were lots of files in a single directory. Once you bluescreened, or simply rebooted, the system wouldn't start back up. You'd be surprised how many re-installs we had to do before finding this one.
When doing an rcp from source machine to target machine, if sum is run on the rcp source machine, the value would sometimes be incorrect. After the rcp finishes, the value is correct, there is no data corruption, and the file was transfered correctly to the target machine. If ftp was used, the problem did not occur.
It took over 6 months and 12 people to find the problem. The hardware was a uniprocessor MIPS R10k with non-coherent cache. The processor is capable of doing speculative execution which can dirty cache lines. The processor doesn't back out dirty bits when the speculative path falls back. So you can have a piece of code like:
if (foo) *bar = 1;
Even if foo is false, the speculative execution can cause the cachline containing bar to get marked dirty. Normally this doesn't cause a problem. However, if bar is used as a loop variable, and happens to point just past the end of a memory page, a cacheline for a subsequent page can be dirtied. If this page has an active DMA transfer in progress, then the first cacheline on that page can be overwritten with the dirty cacheline, corrupting the DMA data.
This was not a problem for userspace, since active DMA write pages were not mapped into userspace, but flipped in on completion of the DMA. In the kernel, the problem exists. The solution chosen at the time was to put a compiler workaround, which put a speculation stopping instruction at each conditional branch target. Since this compile switch was only used for the kernel, user binaries remained ABI compliant.
However, in "volatile" assembler portions of the kernel code (no compiler reordering permitted), this workaround had to be handcoded. After pouring through all the assembler by hand, no bugs were found. Finally a perl script was written which would check for store instructions lacking a speculation stopper. Some were found, and all discounted as harmless.
The problem turned out to be that the MIPS prefetch instruction allows you to pass a cache hint. There was a piece of checksum code that passed a write hint in a prefetch instruction. The fix turned out to be a 1 bit change: change the 7 prefetch code to a 3.
One of the reasons that children (more accurately students) are taught that .5 should always round up is because of grading.
While it is mathematically correct to distribute the "round ups" and "round downs" to the nearest even integer, tests where 1/2 points are often given but not recorded certainly provide a reason to be consistent! Otherwise, you will end up with a score of:
12.5 and 13.5, which has a 1 point difference, becoming 12 and 14, which is a 2 point difference.
You misspelled C++.
I have a DSP board from a company that shall remain unnamed. When you perform a DMA between the PC and the DSP board, the board's PCI controller is driving the board's external bus and nobody is refreshing the RAM. (All DRAM must be periodically refreshed, or the memory chip discharges). The hardware design team solved this problem in a particularly bad way. They assumed programmers would set up a DMA operation and then continuously poll the DMA status register until the transfer was complete. Thus, they configured a PLD to handle the refresh, as long as the PCI controller's DMA status register was being polled.
So what happens if you try to do an interrupt-driven DMA in the background? The system crashes because RAM isn't getting refreshed. The tech support person suggested a test: have one DSP chip do nothing but poll the PCI controller's DMA status register. Suddenly it worked fine. There is no way I could have figured this one out on my own. There was absolutely nothing wrong with my code, except that the hardware design engineers didn't expect anyone to use interrupt-driven DMA.
Fortunately this was a known issue and the company had an update, although we had to purchase a $150 cable so we could re-program the PLD.
Check out Chad's News
http://slashdot.org/comments.pl?sid=34867&cid=3774 509
The first O/S bug I found was in the TS1000. Remember that thing? It was a Timex version of the Sinclair ZX80. Would you even call it an O/S? The only thing the TS1000 had over the ZX80 was you didn't have to solder it together and it's 1KB of static RAM was twice that of the ZX80 so at least you could fill the whole screen with characters with out running out of memory...
The bug it had caused me to get a "B" on a computer assignment in my Senior year science class because the square root function would return incorrect results some where around 2.5 or so. Even though I could prove to my teacher the computer was making a mistake by simply doing something like:
10 PRINT SQR(2.5)
he insisted that computers never make mistakes and that I must have been doing something wrong. I later read where I could call some number in England and they would send a new ROM chip to fix that and other errors...
(And, yea, I remember being irked bad when a friend got one of these a couple month later and it came with 2K of RAM! Wow 2048 Bytes... Damn.)
The funny thing is I remember people actually sold chess programs that ran on these things.)
Like I read Velikovsky some years back and he seemed to be claiming that it was some fundamental constant of his vibratory model of the universe and it predicted the respective orbits of the planets around the sun. I didn't know that
phi = sqrt( pi() * 1.2 )
That is a pretty interesting property, namely
that:
( n / phi ) + ( n / (phi^2) ) = n
Weird...
Clickety Click
It's been a while so I can't remember too many details...
One was in 4.0 where if you saved a file with exactly 1000 lines, regardless of size of file - it was the line count that mattered, the IDE crashed.
Later (4.5?) I had a graphics problem with something appearing a few pixels off where it should have been. Thought I'd got the maths wrong so I added an offset to put it in the right place (as a precursor to finding the cause of the problem) but then the graphic was off where it should have been by that offset! Moved the offset towards zero, and when it was zero the graphic was in the right place, but without that +0 on the equation it didn't give the right result.
Then there was one, oh that's three, never mind, where I tried adding a TTime and an int, and I got an ambiguous error because it didn't know whether to cast the int to long or the TTime to a TDate, cos it knew about TTime+long and TDate+int. Ok, not a bug (unless you consider that TDate+int would have given a vastly different result to TTime+long(int)), but one of those interesting little logic problems that make programming such fun.
And I'm not even going to get into the Losedows API. CreateBitmap and CreateDIBitmap; which one creates a device independent bitmap? That's right - NOT CreateDIBitmap.
That only works in C++, I'm afraid. C only supports pass-by-value (the first one), and explicit pass-by-reference (the third one).
--JoeProgram Intellivision!
The other day I was testing some of my c++ code for a A.I project, I get some wired errors 1/2 = 0
(if you must know redhat 7.3 upgradet from 7.2) and I have others problems with the upgrade:
emacs syntax-h in latex don't works
as-spell from emacs don't works.
etc
etc
so I think it is a problem with the upgrade because it alle workd fine before
What rimes on recursion What rimes on recursion What rimes on recursion What rimes on recursion
I discovered that the network concentrators at Uni would die on any sequence of 4 "n"s in a row (i.e. "nnnn") in the same packet. I was trying to read a man page and puzzled why the system kept dying before I got to the end. Eventually I redirected the man page to a file and used something like an octal dump to find the sequence without displaying it on the screen.
I then tested, typed "nnnn" and down went the network concentrator. Unfortunately that killed the other 15 users as well...
I reported this bug to the University Computer Centre who either didn't believe me or took no apparent action, but sometime later they upgraded to a different brand of gear for the campus WAN. I also reported it on comp.risks. I can find no other documented cases of this bug on the Net using a google search.
This guy is WRONG. And now you're perpetuating this! Look at all the arguments against this ALL OVER this topic and you'll quickly understand why 'Aspirin' is incorrect.
:(
Shit. There goes a whole generation of kids who now have a broken understanding of the subtleties of number theory.
Microsofts ICMP.dll can make ping applications fail. I use Win2k at work, and maintain over 500 DSL connections going to various remote network appliances. I noticed one day that if a ping stopped returning replies, I could restart the app and get responses. I tried this next to a BSD shell, ran ping on both and watched BSD ping like a champ while Win2k started to fail.
Funny, only Microsoft could bork something as common as ping. Shameful even, and no, I never bothered to report the bug. Why? I paid for bug ridden software, its not like they will pay me for the QA service!
I used to be on UWaterloo's ACM programming contest team. More than once I got bitten by the ever-so-simple yet ever-so-annoying to debug 'missing return' phenomenon.
It seemed that on some architectures (eg. the local workstation I was testing on), the right value would just happen to be in the right register anyway. On the judges architecture (fortunately this was a local practice contest, not the world finals!) it failed one time out of one hundred. Yeah, yeah, I know, turn on warnings... it wouldn't fit with the contest mentality: vi + gcc and one terminal and you're set.
Wasted waaaay too much time on that one.
Round to even is not expensive, at least when you're talking about the binary computations in hardware that the IEEE routines address. In this case you just need a lookup table with your guard bits and the last significant digit. Even with 7 guard bits, that's a table with only 256 possible results (do nothing, decrement or increment). With RTE you may only need "do nothing" and "increment."
Of course, this is just the rounding performed by a single calculation. Most coprocessors use a few extra bytes over what they publish, e.g., the registers for a IEEE double (64 bits) will actually be 80 bits long.
For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
Praise the lord this post comes down along the chain, well after anybody has ready the facts about upward biasing.
Typical slashdot reader. "hee hee, typical MS programmer doesn't know shit. Oops. You mean MS was right?"
Any moderator who modded this ups deserves their privs removed.
Visual Basic 6.0. It has plenty of nice concepts, but the whole implementation is a bug.
It's a problem in base-2 also. Base-5 wouldn't have the problem, though.
Base-3 for computers would solve the problem. Apparently, in the very early days of computing there was some interest in base-3, although it never took off.
You could represent base-3 with -1, 0, 1. This is called balanced ternary notation. Quantum computers may end up using that variant of base-3. (I wish I could find a better quantum computing link. One of my former coworkers was doing his PhD on this stuff, and it was really quite fascinating.)
--JoeProgram Intellivision!
A little algebraic maniputation and I put
3 09179805 762862135448622705\9 113748475408807538689 175212663386222353\0 865959395829056383226 613199282902678806\1 043216269548626296313 614438149758701220\6 486444924104432077134 494704956584678850\5 884607499887124007652 170575179788341662\7 621771117778053153171 410117046665991466\
p i = 4 * a(1)9 7169399375 105820974944592307\1 706798214808651328230 664709384460955058\1 027019385211055596446 229489549303819644\3 786783165271201909145 648566923460348610\7 372458700660631558817 488152092096282925\5 305488204665213841469 519415116094330572\2 611793105118548074462 379962749567351885\
a lpha = pi / ( phi^2)6 926562499505529 057521467556375365\9 198186568648125360010 705945389334340348\7 606295498586362400290 970525243087795168\9 677253907789930645432 415922185240842172\0 971071808916879413135 748981466258466101\0 859726696097114760127 693023059888230457\5 977539807233206560329 157466678939790854\
the phi equation into Newton's for for an
iterative solution, and it converges.
Try this:
scale=500
define p(x) { return 1 + 1/x; }
phi = 2
while ( phi != p(phi) ) { phi = p(phi); }
phi
1.618033988749894848204586834365638117720
2604628189024497072072041893
6931793180060766726354433389
7520876689250171169620703222
3408058879544547492461856953
9874339442212544877066478091
5624940758906970400028121042
97987317613560067087480710
pi
3.1415926535897932384626433832795028841
8164062862089986280348253421
2231725359408128481117450284
2881097566593344612847564823
4543266482133936072602491412
4091715364367892590360011330
7036575959195309218611738193
75272489122793818301194912
alpha
1.19998161486432666111577775331680
6536691197193953899810303302
8805912815421826166704685114
4578373489622855204137590571
5378938824383523670155495662
7508290914857218481375692930
8792080349171710232554795004
34041365040685351056856224
Neato!
Clickety Click
my "famous bug" appeared in something like php 3.x:
.= dechex(255); .= dechex(255);
:)
$mv = dechex(255).dechex(255).dechex(255);
should result in $mv "FFFFFF"
but the result was:
"FF00FF", the zero switching positions one by one, so called in a loop it produced
FF00FF
FFFF00
00FFFF
FF00FF
I used that for color calculations, damn they WERE funny...
my resolution was this:
$mv = dechex(255);
$mv
$mv
- which worked fine. Time to get the bug: about an hour
Was having some really bizzare problems with our String class being used in a stl vector and ended up having to trace it into the RougeWave HP stl. It was in vector<_TypeT,_Allocator>::operator= (const vector<_TypeT,_Allocator>& __x)
// size() < _x.size() < capacity()
// advance this->end () first
// size() < _x.size() < capacity()
// advance this->end () first
// write past original value of this->end ()
below is the change for anyone who might have hit this or runs this setup. Hope it can help someone avoid it and all the time it wasted. Just love problems in the STL! *** are the two lines changed.
*** _C_end_of_storage = _C_finish = _C_start + __x.size();
}
else {
*** _C_end_of_storage = _C_finish = _C_start + __x.size ();
Changed To:
*** _C_finish = _C_start + __x.size();
}
else {
copy (__x.begin (), __x.begin () + size (), begin ());
uninitialized_copy (__x.begin () + size (), __x.end (),
begin () + size (),
_RWSTD_VALUE_ALLOC_CAST (*this));
}
*** _C_end_of_storage = _C_finish = _C_start + __x.size ();
This of course was becuase _C_end_of_storage should not have been set before the calling of size() as it would be incorrect.
Just Another Day For You and Me in Paradise.
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
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
Good lord people, did you read the last few lines of the post? This wasn't supposed to be Rounding Theory 101.
Apparently I can't spell favorite right... Internal bug number #23456.
Just Another Day For You and Me in Paradise.
This isn't exactly a bug, but it's one of those things that makes you wonder how anyone could let it slip by...
Possibly this is what was happening.
Not sure why this is the case, but unless told to round in a particular direction (up or down) this is how we were taught where I went to school (in Australia).
Personally, I usually round to the worst case scenario (ie, up on my tax, down on my available funds, etc ;)
smash
I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
We have a number n with a certain precision pn.
We need to represent it as a number r with a lower precision pr.
We want r to be as close to n as possible.
The rounding must not have a tendency to increase or decrease the value of n.
Whenever we round n to r the last pn - pb digits are thrown away as they are implicitly 0's in r (ie 5.1 = 5.1000000.....)
Unless the digits we throw away are all 0's, we are going to alter the value of our number, and it is this alteration we wish to minimize. We do that by rounding to the number of precision pr that is closest to n.
This is trivial for all numbers except those where the most significand digit lost in the rounding process is 5 and all the rest (if any) of the lost digits are 0's (f.ex. when rounding 4.5 or 4.50000 to the nearest whole number). These are not trivial as rounding up and down changes n by the same amount. In other words: Two numbers of precision pr are equally close to n.
The easy solution is then to just choose to always round up or down, and stick to that. It's an optimal solution when it comes to minimizing the difference between n and r, since there was no better solution than the one we chose (only one that was just as good). But does the solution have a tendency to either increase or decrease the value of n?
Look at all numbers of precision pn between two adjacent numbers, r1 and r2 of precision pr, adjacent meaning that there is no number rn of precision pr such that r1 < rn < r2. For every number n1 that is rounded towards r1 by an amount m there exists a number n2 that is rounded to r2 by the same amount, except where m = ((r1 - r2) / 2), which is excactly the non-trivial numbers discussed above. That means that in order for our rounding to be symmetrical, the rounding of the non-trivial numbers has to be symmetrical. And it is not symmetrical when we have chosen to always round up or down. And that is why other methods of rounding has been introduced - round to even being the most widely known.
I hope this can put an end to all the "count-the-roundings"-posts... I would have expected stuff like that from no-brainer journalists reporting on stuff they don't understand - but from inside the slashdot-crowd? never! Its devastating for our reputation for being brainy...
- Skov
Even though though this question was targeted towards devlopers (and I'm not a developer per se), my pet bug would have to be how Windows 2000 and Windows XP make my motherboard's power LED turn off in Linux.
Conspiracy, I say!
While working on a remote weather station for NOAA, we found that the Interdata FORTRAN compiler we were writing the controller software with did an interesting thing at runtime. If you declared a 4-byte integer, it would reserve two bytes at compile time, then use the following two bytes (to get the full four) for the rest of it at runtime. The solution was padding the declaration with a wasted variable that got sacrificed to the bug gos when you ran the program.
As always the biggest bugs are introduced when the programmer cannot even read the documentation provided to understand how and why a function operates. Round() in VBScript and VBA both perform banker's rounding where if the number falls halfway between, it is rounded to the nearest even value. If that involves rounding down, so be it. This behavior is clearly documented.
Link order may depend on the alphabetical ordering of files, so you may end up with some initialization-time weirdnesses. I seem to recall the way the Linux kernel walks through driver initializers is link-order dependent, so your driver might be dependent on some other driver whose name comes after kybd but before pskybd.
Having the binary files differ means nothing -- some of the metadata in the object file will include the source filename, and the two source files names differ. Also, if any macros you used have a reference to __FILE__, you could get some differences there too.
--JoeProgram Intellivision!
Really, for repeatability, you want something that's static with respect to the number. That is, I can always look at the number and tell you how it will be rounded, with no external memory biasing the decision. Otherwise, it becomes impossible to programmatically compensate for the bias in the places where it matters.
--JoeProgram Intellivision!
This one took me a long time to solve. When you do a myResultSet.getString(n) using Oracle's JDBC driver (from 8.1.6 at least), you get back a null-terminated string. You'll never know if you just print it, but if you look at each character, you'll find a null byte at the end. It seems this usually doesn't matter, but I discovered it when I was trying to do this:
String className = rs.getString(1);
Class c = Class.forName(className);
Java just wouldn't find that class definition! It took me a whole day to figure this one out.
My two favourites (the first from personal experience):
:)
1. Back in 1992, Motorola's System V Unix sleep() function used a longjmp() within the alarm signal handler to jump back to the pre-alarm setup state in the original function call. Took us several weeks to figure out why our own signal handling routines were abitrariliy getting wiped off the stack (disappearing in mid-function call). Not only that, but it took more than just a few phone calls to get Motorola to _believe_ that the problem was at their end. Even the final engineer
who admitted the problem would only believe it after we read out the disassembled code that proved it
2. Fortran compilers on (I believe) the old IBM VM systems had a wonderful handling of constants. If you passed a constant by reference, and then CHANGED it, any constant in the entire program that happened to be the same value during compile time miraculously changed its value.
This code (or code to this effect you pedants) compiles cleanly:
/* do something */
switch (c) {
case 'a':
break;
case 'b':
break;
defualt:
}
But unfortunately will never get to the default case. It seems funny now, but as a young brand new C programmer, I just couldn't work it out or even read it seems. hehe
at least that was the bug description in our company bug tracking system (a whiteboard mounted on the wall accross from my desk)
we were writing an mdi aplication in javascript (complete with draggable/resizeable windows) and double-clicking on a window title bar would snap the top left corner of the window to the mouse cursor position, thus causing the window to "fly" accross the screen.
it wasn't until my next job some six months later that i finally figured out that the second onMouseDown event started processing before the first onMouseUp event finished, and i was clobbering the values for the position of the window at the beginning of the drag before i was doing final positioning of the window.
we had another one at the top of the list for some time saying that our product "needs more user friends" - our ceo's horrible typo of an attempt to tell us that the product needed to be made more user-friendly.
another baffler that i encountered is the fact that select widgets totally ignore the z-index property in all version of internet explorer. they are always on top, period. it turns out this isn't actually a bug- it's a well(?)-documented feature. not that this feature makes any sense whatsoever. this of course makes implementing an mdi application that uses pulldowns in the windows a bit difficult, to say the least, because the pulldowns from lower windows will "bleed-through" and obscure the contents of the focused window, unless you do some fancy tricks.
If I don't put anything here, will anyone recognize me anymore?
I spent many hours when I was first learning C on this one:
/*b is the start of a comment.)
int divide(int *a, int *b)
{
return *a/*b;
}
(Hint:
Then there's the famous FORTRAN bug (if I can remember the syntax correctly):
CALL ADD(N,5)
SUBROUTINE ADD(I,J)
I=I+J
J=10
From then on, every time you used "5" you would actually get "10". (Call by reference or something from the dim past.)
This is not exactly a software bug, but I thought it quite funny when I found it. ;-)
A long time ago, I don't remember why, I wanted to find 2^32 in my Casio FX3800p calculator. You can imagine my surprise when the display shows "4294967295"!! It's the only calculator I know that does not worry about a power of two being odd... Odd, isn't it?
Pablo B.
I recall basic not allowing a " after a = without whitespace.
to see if counter jumped over 1000, this will be interestins. Writing crap to see dkhfsa;jlks
fdsfdsjaf
dsafjds
fds
af
dsf
ds
f
dsaf
s
Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.
Probabilistic primality tests are supposed to have a miniscule chance of declairing a composite number prime, and zero chance of declairing a prime number composite. I guess it's nice that the Java implementation errs on the side of safety, but it's silly that my Miller-Rabin test is faster and more accurate. The code I was sent works even faster. (The SRP people offered to email me some kind of proof of primality for the number. I'm not sure how that works, but thier code agrees with the stuff I coded up from Applied Crypto, so I'm pretty convinced Sun goofed.)
<OT>
Does anyone know a way to get a File object or an InputStream object for a file contained in a jar archive? This is my current reason for wanting to hurt the Java engineers. I'm trying to load an image out of a jar archive. The best solution I've come up with so far is to use Class.getResource(String) to get me a URL and then use java.awt.Toolkit.getImage(URL)
</OT>
Copyright Violation:"theft, piracy"::Anti-Trust Violation:"thermonuclear price terrorism"<-Overly dramatic language.
Here's one I just received in my email. Enjoy:
---
This is a real story happened between the customer of General Motors and its customer-care executive..
This complaint was received by the Pontiac Division of General Motors: This is the second time I Have written to you, and I don't blame you for not answering me, because I sounded crazy, but it is a fact that we have a tradition in our family of ice cream for dessert after dinner each night. But the kind of ice cream varies so, every night, after we've eaten, the whole family votes on which kind of ice cream we should have and I drive down to the store to get it. It's also a fact that I recently purchased a new Pontiac and since then my trips to the store have created a problem. You see, every time I buy a vanilla ice cream, when I start back from the store my car won't start. If I get any other kind of ice cream, the car starts just fine. I want you to know I'm serious about this question, no matter how silly it sounds: "What is there about a Pontiac that makes it not start when I get vanilla ice cream, and easy to start whenever I get any other kind?"
The Pontiac President was understandably skeptical about the letter, but sent an engineer to check it out anyway. The latter was surprised to be greeted by a successful, obviously well educated man in a fine neighborhood. He had arranged to meet the man just after dinner time, so the two hopped into the car and drove to the ice cream store. It was vanilla ice cream that night and, sure enough, after they came back to the car, it wouldn't start. The engineer returned for three more nights. The first night, they got chocolate. The car started. The second night, he got strawberry. The car started. The third night he ordered vanilla. The car failed to start. Now the engineer, being a logical man, refused to believe that this man's car was allergic to vanilla ice cream. He arranged, therefore, to continue his visits for as long as it took to solve the problem. And toward this end he began to take notes: he jotted down all sorts of data: time of day, type of gas uses, time to drive back and forth etc. In a short time, he had a clue: the man took less time to buy vanilla than any other flavor. Why? The answer was in the layout of the store. Vanilla, being the most popular flavor, was in a separate case at the front of the store for quick pickup. All the other flavors were kept in the back of the store at a different counter where it took considerably longer to check out the flavor.
Now, the question for the engineer was why the car wouldn't start when it took less time. Once time became problem - not the vanilla ice cream, the engineer quickly came up with the answer: "Vapor lock". It was happening every night; but the extra time taken to get the other flavors allowed the engine to cool down sufficiently to start. When the man got vanilla, the engine was still too hot for the vapor lock to dissipate.
Remember: Even crazy looking problems are sometimes real and all problems seem to be simple only when we find the solution with a cool thinking. Don't just say its "IMPOSSIBLE" without putting a sincere effort... Observe the word "IMPOSSIBLE" carefully... You can see "I'M POSSIBLE"... What really matters is your attitude and your perception.
I once recieved an error message that read: "Unable to delete files due to lack of disk space. Try deleting unneeded files to free up more space."
That green slime had it coming.
I've been programming for twenty-six years (I really must go home one day) and the worst bug I've seen was when the previous programmer had changed stdio.h.
There used to be a bug in SNOBOL 4 (1979) that caused a stack fault if you called the divide routine.
The SNOBOL 4 compiler was written in FORTRAN 77 so I guess no-one really wanted to look at it.
A shame really, it was a neat language for its time. But these days you can do a lot better in PERL.
Once upon a time there was a database programming language called Dataflex, which only three people on the planet have ever used. The Dataflex compiler worked wonderfully well until one day, for no identifiable reason, the error messages given at compile-time underwent a mysterious transformation. Certain characters in the alphabet became swapped with other letters. For example, all S's became C's, and all U's became E's. So an error that contained the word "SHOULD" would instead contain the word "CHOELD". The bug, or whatever, didn't seem to affect anything else, so we lived with it for awhile and took no further note of it until one day we filled up the hard drive and it tried to display the message "ERROR: DISK FULL". Go ahead, do the math. I'll wait.
No, I'm not kidding. It really said that.
HC
All this drama about rounding numbers????From so many people. What an unproductive way to use humanity's resources. Go do something useful for a change...
Awhile back, there was a bug in the way the CRT initalized some timer increment in Borland Pascal. It tried to calculate how many clock tics it took to complete a loop, then used that as the divisor in another calculation. But any computer that ran over ~200Mhz could complete the loop in under a tic, so a /0 error would pop up. It was kind of frustrating to have a program work perfectly while my laptop was unplugged, but get an error *before* the first instruction while it was plugged in.
In a statistics class in college, we were instructed to run a formula on 100 numbers picked from a telephone book (pretty random) The end result of the equation was supposed to be e (2.71.. yatta yatta)
Anyway, being the computer geek I was, I instead grabed a few thousand numbers from rand(). They were so statistically NOT random, that my equation returned something closer to 2.9. I had to re-do the exercize by hand to figure out what the answer was supposed to be!
So, I stand firmly in the "random sucks" camp
Back in the days of punched paper tape, I spent a day on a program that always fell over in the same way. I worked out where the problem was, put the printout of code looked perfect. ...
In desperation, I looked at the tape (reading the holes was always a challenge) and found a smear of butter in the appropriate place. The TTY used mechanical fingers to detect holes, but the computer used an optical sensor which looked through the butter and saw holes that weren't there.
Of course we weren't supposed to eat in the computer room, but
About the time they went from LEDs to LCDs, there was a persistent bug in most TI handheld calculators - I seem to remember it into the 1980s - calculate 2^3, minus 8 and you didn't get zero - you got a very small decimal. Doh!
A check of many calculators today can give you some measure of internal accuracy - I use 123.456, take the square root, then square it. You get 123.456 - no surprise. Then do it sqrt twice, then sq twice, then three times each, and so on - many calculators can do seven down, then seven back up and still end up with 123.456 again. Some crap out after just two. I think the most I've seen is 11.
"Win treats sysadmins better than users. Mac treats users better than sysadmins. Linux treats everyone like sysadmins."
When you set you comment threshhold by default to 3 for example then in the Threshold pulldown list you cannot see how may comments there are for lower thresholds, below the one you set the same number appers. So there is no way to know how many comments are at -1. But then why does it correctly show how many comments are at 4 or 5? This is old and wierd too.
Why the hell are you using VB?
http://www.mistersampo.com
"Not enough memory to display error me"
Table-ized A.I.
Yeah, the one right under our noses: you browsing at 4 or 5? Click on the Threshold pulldown menu. What's it say? 35 Comments at 4+, 30 Comments at 5. But it also says -1,0,1,2 and 3 -scored posts add up to 35 each.
;)
So you can't guess how switching to a lower-scoring level will increase the html file coming down our modem pipes. Try it today
"Wireless : LAN
the ^= operator didnt work correctly in msvs6 for ints... i tended to use the x^=y^=x^=y; trick alot to swap x and y and was really annoyed when it did weird stuff
:)
i think this was inbetween two patches. it was there and then it went away after an update and i havent heard from it since (thankfully)
There's a similar story circulating, perhaps in the Jargon files. A guy gets a report that the system will allow the operators to log in when they're sitting at the console, but not when they're standing.
This makes no sense - there's absolutely no connection between the seat (or raised floor) and the system. How could it possibly know whether the person was standing or sitting?
The answer was in the keyboard. Somebody had dropped it and put the n and m keys back in the wrong place. While sitting, the operators could touch-type and they hit the right keys. But when standing, they had to look at the keys since they didn't have the muscle memory in this position to touch type. The two keys were in about the right place, they look similar, and nobody noticed that there was a problem with the keyboard.
The story has a fun personal touch since years before I heard about it I did the same thing with the office phone. We accidently dropped it, and as a joke I put the keys back in the standard calculator/keyboard layout, not the telephone layout. We all knew the numbers were reversed and could dial the right numbers, but one day a phone guy was in the office for some reason and got a very strange look on his face when he saw the phone. He insisted on "fixing" it.
For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
This weird behavior ocurrs in VB 6, VBA. I don't know if it was fixed in VBNet.
on error resume next
if (3/0)= 2 then
debug.print "Why does this actually execute?"
endif
The worst bugs I've ever seen Atari ST Basic. Certain floating operarions gave wrong resuls, some others bombed ST. It was from the same guys that made tha infamous AmigaDOS.
The night before I delivered a web site (a BIG one with a lot of layers), I noticed that some versions of Netscape place all my layers in the upper left corner of the screen...
Advice: *never* start the name of your layers with an underscore or you won't sleep... argh !!!!!
I recall using an 8086 with the (drumm roll) 8087 floating point accelerator chip (for those too young to remember, that was a separate chip you had the option to buy in early PCs if you wanted to do fast maths calulation. The Microsoft compiler of the time (v3or 4) had a bug that under some condition cause an underflow in the 8087 internal register stack on the 8th call (I think the internal hw stack had 8 entries). It took a real long time to find that, many weeks, I rang Microsoft and they said "Thanks!" and I never heard from them or got a work around. Some things never change...
:-)
I was helping a friend program their TV and found an error in the sequence of assigning frequencies to station numbers, it caused garbage to show where the nice green channel number was meant to be.
I remember writing a maze program on my trusty HP11C back in about '81 and I gave it to a friend. The bug cause the maze to be reflected on the x and y axes. I was trying out the program and got this creepy feeling as I wandered around the maze 4 times bigger than what the calculator had memory to handle. It was so weird. I took hours wandering around and eventually drew it out before seeing the pattern. Serendipity strikes
I wont mention the military system I worked on where the laser it fired (don't ask) would switch direction 180 degrees every time it crossed the Tropic of Capricorn (latitude 45 deg south). Or the bug in the artificial life breeding prgram that caused all offspring to remove their brains (controling code) when they were old enough to reproduce. Or the AI system that caused the 2D life to be attracted to a light but when the light was too close they spun in circles until they died - so weird to watch on the screen, very funny at the time.
pithy comment
but this used to crack me up when I had to use VB in MS Access.
The help was broken, so if you hit F1, a dialog popped up saying "Cannot open Help".
The dialog had two buttons "OK" and "Help"!
When using classes and default arguments with dictionaries via:
def __init__(self, arg1 = {}):
if you assign that arg1 to a class variable, any modification of that class variable will show up in all instances of the class.
Thusly, if you have this in the body of the aforementioned __init__ definition:
self.arg1 = arg1
and you evaluate the following:
k = someclass()
l = someclass()
k.arg1[5] = 5
the below will return 5.
l.arg1[5]
I only found that earlier today, though it makes sense considering the documentation about using default arguments as state variables in the documentation. Quite fun anyhow, be careful!
that is most likely due to an error-checking routine that checks specifically for 2 sequential complementing operations of the same number to bring you back to your original number. the computer still has no concept of the real solution to that problem as humans do, it just has a special instance error-checking for that type of problem.
Many years ago I worked on a mission critical aircraft survivability system for combat aircraft. Before fielding the system we had to pass environmental testing, including running the system at -55C. At -55C the system would occassionally go deaf, dumb, and blind. The environmental chamber we had wasnt particularly large, not that I really wanted to climb inside for a debugging session. We ended up making extra long cables for our logic analyzer and soldering test leads to various points on the board. Needless to say things went very slowly. Every time we wanted to instrument a different test point, we had to warm up the chamber, change the test leads around and then wait for the chamber to cool off again. Eventually (after 6 weeks) we discovered that at low tempuratures the power line monitor circuit was passing glitches on it's own power supply line right through to the main CPU. The glitches weren't long enough to reset the CPU. However, at -55C the CPU would happily pass the glitches along and reset all the peripherals. We ended up scrapping a few thousand boards that had already been fabricated. The fancy power line monitor circuit got replaced with a pair of transistors and a few resistors.
3x and cx opcodes were absolute jumps, 3x took the following byte and replaced the program counter lo with it (30 88 would jump to 0x88 on the same page of memory), cx jumps took the two following bytes and replaced the pc hi and lo with them (c0 3f c4 would jump to 0x3fc4). all the other 3x and cx test and branch opcodes worked the same if the test was true. if a short jump was at 0x00ff and the jump-to address was at 0x0100 you'd jump to somewhere in the 0x01 page, not back to the 0x00 page because the program counter had already incremented to the next page to read the destination byte, but you just used a long jump if they were straddling a page boundary and had to go back to the previous page. i think there was even a warning about that in the databook. not a bug, just a fact of life with the 1802.
damn, i miss that chip. if only rca (or someone else) had made it in hcmos. hell, i'd use it today if it was available in a super-fast version, it was a hell of a little controller. i wrote some good code on the 1802.
you know that silly game you waste 90% of your cubicle life playing?
:)
1. start a game (that is, start the timer)
2. win-d (minimize all)
3. unminimize - voila! the timer stops! but you can keep playing
(doesnt work if window has been minimized beforehand)
On a non-gcc compiler, the result was correct. On gcc running on a motorola 68020 system, the result was correct, too, but the same gcc version on a sun sparc system returned random data in the two upper-most bits....
As a side-note, compiler bugs still cause me problems; The Keil C167 compiler I use at work doesn't support the %-operator between two ulongs. No compiler error, but random result when the code is executed! The debugger for that compiler isn't exactly bug-free, either: Watches set on variables pointed out by pointers does most oftenly display data located at a random location, rather than the location pointed out by the pointer!
Software Designer
Yet another precision problem from the old days, shaken the very foundatation of my math teacher, he can't figure out what's wrong and he refused to accept what he's seen.
First part was the actual session, second part was my debug session
------
LIST
10 INPUT "1st side", A
20 INPUT "2nd side", B
30 INPUT "3rd side", C
40 E = SQRT(A*A + B*B)
50 PRINT "This is ";
60 IF E C THEN PRINT "not";
70 PRINT " a right angled triangle"
80 END
OK
RUN
1st side
3
2nd side
4
3rd side
5
This is not a right angled triangle.
OK
-------
PRINT SQRT(25)
5
OK
PRINT (SQRT(25) - 5) * 10000
0.00001
OK
Damn!
SYNTAX ERROR
My favourite bug from the VMS days is the one that reported, under certain conditions:
Warning: Hardware or software error.
... which was immensely useful, and narrowed the problem down to one of two things.
I had a very annoying problem with a kermit script long ago that was fixed by putting a space anywhere in the top half of the file.
never did understand that one
My favourite bug ever was both created and fixed by myself. I thought myself to be a hell of a C programmer, so I set off to make a character recognition program. The main function was severely damaged when I started use a local variable both as input and output argument. Therefore when the stack hadnt been touched, you got the right result and garbage otherwise. The funniest part is that I rewrote the rutine in such a way that when a failure was detected, the process will start all over, until it got it right. I even optimized this failure-detection code!.
In other word I jumped over my own bug instead of fixing it. Bad code doing his work!
Best regards
Vicente
My favorite Bug? I was trying to hack a Macintosh game by combining code ressources from a real game (which needed a serial number) and a demo. My first (and last) attempt to crack something, mind you..
Well, the first time I started the new program, my Mac froze. And couldn't start again ("no system folder found"-icon). When I started using the CD-ROM, my harddisk didn't appear on the desktop. And "Norton Utilities" said "I can't repair your harddisk because there is no harddisk there".
"Shit", I thought, "they have some really bad anti-cracking measures in this game which now killed all my data, my harddisk, and changed the harddisk firmware so that it didn't respond again". Well, I was very wrong...
I turned out that in the exact same moment my computer crashed, the connector to my harddisk became so loose that there was no connection anymore. After realizing this, I just needed to plug the hd-cable back in, so everything was fine again.
If you set a session variable in asp, it did not halt execution until that variable was actually set. That meaned that code like:
Session("MyVar") = "I did this"
Response.write Session("MyVar")
Might write the old value of Sesion("MyVar") or simply a blank.
Guess how strange bugs that could result in...
All opinions are my own - until criticized
I'm not sure if this is compiler (m68k-elf-gcc 2.95.3) or C-library (uC-libC) problem but
sprintf(buf, "%s %i", "n: ", n), where n might get negative _sometimes_ produces only "-" sign without the actual value. So now I'm trying to go around it with something like this:
sprintf(buf, "%s%c%i", "n:", (i > 0 ? ' ':'-'), (i > 0 ? i : -i));
Other scanf related bug in x86 Linux (gcc 2.95.3, glibc-2.2.4):
struct mPos{
long long int tt, id;
double lat, lon;
int bm, alt;
};
void handleMsg(const char *buf)
{
struct mPos p;
sscanf(buf, "FOO: %lli %i %lf %lf %lli %i", &p.id, &p.bm, &p.lat, &p.lon, &p.tt, &p.alt);
submitData(p);
}
when done _first_ time I get NAN to the lon... so no I have to do that sscanf twice in the function when it's entered first time (had to include static boolean first_time in the function to accomplish that).
Why on earth printf and scanf are so hairy? I could avoid them but why? They are standard ANSI-C functionS so they really should behave correctly!
Microsoft? Is that some kind of a toilet paper?
During my PhD, I implemented a compiler for a non-standard language. I have been forced to do it using the non-integrated "environment" gcc/xemacs by a VisualC6 bug: The code got compiled, but the code generated for the RTTI was false. ;) sniff
Writing ASP code (VB script) in M$ Interdev does not auto space every line you type in as it does when using the visual studio IDE and VB.
Which means that you get VERY odd errors when trying to concatinate strings and you leave no spaces between the ampasand and the strings you are joining.
I removed 200 lines one line at a time trying to find what was giving me errors and it was one damm space !!
for everything else there is we.ownz.u.mastercard.com
Come to think of it, Turbo Assembler incorrectly compiled the cmp cx,0001 function to some signed check (cmp cx,+1), which is also undesirable for reading a harddisk using int 13h and you need to check if the master boot record is read. Like this:Sometimes programming is a hell, as if introducing bugs in your code is not bad enough already the developers of compilers give you this as an 'extra feature'.
unfinished: (adj.)
he got score 2 for not saying anything? crazy...
The Parallel port on the IBM PC used to (presumably still does) generate an interrupt by bringing the interrupt line up for a short period and then back down.
The UART expected the interrupt line to remain high until the interrupt was cleared by the Interrupt Service Routine.
If you were printing under interrupt, you sent out a character, and once the parallel port had finised with it, you got an interrupt to tell you you could send another. If the machine was dealing with another interrupt, you often "missed" the printer's charachter sent interrupt.
In order to restart printing you had to have a timer interrupt running which checked how long it was since you last sent a character to the printer and if necessary to kick off the next one.
There was a bug in the Sinclair(tm) Spectrum(tm) ROM, which meant that you couldn't backspace from line 1 to line 0, and if you backspaced from line 0, memory corruption occurred.
I have a piece of paper in my office that I inherited from someone who left a while back. It is a genuine Windows NT error message that he encountered trying to do something:
Windows NT encountered the following error:
The operation completed successfully
C:\> gcc winnuke.c
Bad command or file name.
C:\> gcc winnuke
Bad command or file name.
C:\> gcc apache-scalp.c
Bad command or file name.
No CSS2 attribute selectors in MSIE.
input[type=submit], input[type=button] { }
I only use Mozilla, but I know most people use MSIE.
Phillip
Back in the old days, I came over quite a weird bug in BASIC's floating point code on 8-bit Atari (XE series, at least).
1^43 was 1 (^ being 'power' operator)
1^44 was 2
Now, some time after doing numerical analysis on university I still fail to see a possible reason for this. It really does not make any sense.
e-mail: karol at tls-technologies.com
www: http://www.tls-technologies.com
sig: not found
I've hit something like this one occasionally using VB5....
.....
lbWhatever = TRUE
if lbWhatever then
debug.print "True"
else
debug.print "False"
end if
and on a number of occasions I've gotten back "False"!!!!! Seem Microsofts trying to redefine TRUE & FALSE....
sm.......
I can't remember the version, but this was back in 1997-8. I read about Javascript and was thinking, OK I should give this a try, fired up Jscript in IE4 (can't remember the precise version now) and tried doing some simple arithmetic.
5+5 gave 1, 2, 254, -5 but never ever gave me 10.
The same code worked flawlessly in Netscape. That turned me off Javascript until, well, forever.
Way back when I was working on a simple database ...) when I noticed that a lot of people in the database had birthdays on 29th of february - don't even ask how I spotted this.
on the Commodore Pet (how long ago ?
After many weeks of stuggling it turned out that the database held dates internally as julian day counts and converted them to day/month/year for
display. However, if the year was a leapyear then every access to that persons record actually subtracted 1 day from the record until, yes you guessed it, it hit Feb 29th at which point it stopped. Thank goodness we had the source code but nonetheless, all the dates in leap years were corrupted.
In qb... Log(128)/Log(2) = 6, where it should = 7. That's what you get for using QB I guess.
Andrew.
0/0 = DivideByZeroException
0.0/0.0 = +NaN = Infinity.
Why, Sun, why?
OK how many of you can remember the Merlin Pro Compiler for the Apple II? I spent DAYS trying to figure out why a rather large assembly program was spontaneously exploding after I made a few innocent changes.
The compiler allowed you to define labels, to be used as addresses. These could be defined anywhere, including after where you accessed them because the compiler was two-pass. Great idea, but it had a very obtuse bug. On the first pass, the compiler counted bytes and calculated labels, which include labels such as those defined manually, as well as jump point labels.
Problem was, if you defined a label as a one byte value, (0-255) the compiler still counted it as a two byte value when considering memory loads/stores using the label as an address. On the 2nd pass, it would hapily optimize these accessing opcodes to zero-page address mode, save a byte, and cause every jump label after that to be one byte off. This made branches and jumps land at the wrong points, the program then going wild executing data, and usually would end up slamming into a BRK somewhere up in ROM.
I sent them a letter informing them of the bug, but it was already becoming the time of the Macintosh and the PC, and they had no plans to release a new version of the compiler. Owell.
i spent DAYS trying to figure out why netscape wouldn't implement some style-like features on particular named DIV elements.
i had named all my layers menu_first menu_second etc...
i was so desparate for a solution at the end i thought, oh, what if i take out the underscores in the layer names. AND IT WORKED!!!!
Among other people, I found a bug in the editor in Microsoft Visual C 1.52. Given 2 files, A and B where A is read-only and B is not, open them both in the editor. Make sure B is the foreground window. Switch to another application, modify A and set it back to read-only. Switch back to MSVC. You'll get a dialog that "A is modified, would you like to reload it?" Confirm the reload. Type some text in B. The characters are inserted but the insertion point doesn't move, so the text appears backwards.
--- Jason Olshefsky
Karma: Poser (mostly affected by adding this line long after everyone else did)
....The newest version of Windows!
There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
I didn't actually see this one personally (I'm not that old!) but apparently IBM once issued a program for their mainframes which must be the shortest program ever with a bug - a program with a single instruction!
It was IEFBR14, a standard utility program to branch on register 14; i.e. return immediately. Sounds trivial, but is actually quite useful in the weird and wonderful world of JES and JCL.
The fix for this program sounds huge though: it had to double in size to fix the bug!
For those who have not spotted it yet, the problem was that simply returning immediately does not clear register 15, the return code - hence if another program left register 15 nonzero, IEFBR14 would appear to fail!
Years ago, I was using Developer Studio's (version 1.0) C++ compiler to make an app that did a lot of trignometric computations. I found that, the longer the program ran, the numbers produced were increasingly far from correct. It took me a long time to figure out that there was a bug in the tangent function. If the argument was a small negative number the sign of the result would be flipped. [tangent is an odd function, so a sign flip was a big deal.] I had to do a work-around of creating a new tangent function, that called sine divided by cosine. After many emails with MS programmers, they finally fixed the bug, but not until the next version of Developer Studio. I had to provide them with a four line program that demonstrated the bug before they would belive me.
Bill
Thought I'd hear better ones than most listed here. For example:
1. A failure that happened every day at a gradually changing time. Cause: heat from sunlight on a system. The failure happened after the sun came through a window at the correct angle. The time was changing as the sun moved with the season.
2. A falure that happened once a year at the same time: 10/10, at 10:10AM. The time was represented in BCD, and using IBM Bisync protocol, the bytes were escaped. That many 10s caused a buffer overflow.
Try executing Girlfiend.GetBeer() and see what happens. I usually get output similar to "#%$&*!". Setting either Girlfriend.submissive or even the undocumented Girlfriend.wench to "true" has no effect. Be careful with debugging; repeated attempts in too short a period of time have resulted in actual hardware damage to the submitting hardware.
any of you java cats had a run in with the "Bad magic number"? try editing the first character in a .class file...this is a way to force it to happen...but if you've ever used JRun, you've almore certainly had the evil first encounter...
-oOpS
i once tracked an application problem down to code that appended to a buffer. if the buffer wasn't large enough, it would double its size before appending to it. if double wasn't enough, well, that's what you get for being greedy!
Everything should be made as simple as possible, but not simpler. -- A.E.
A few years back I was working on a program to convert some proprietary binary data to XML format. The scheme involved using macros to create thousands of small structures that held the appropriate conversion information, for each type of data. I was expanding the number of structures, and passed 32767 total. I got a linker error saying that it couldn't find item number -32768 --and the error message displayed
the 32-bit form of that number! So somewhere in
the compiler or linker was still a 16-bit counter that was sign-extended to 32 bits, instead of being a true 32-bit counter.
I told Microsoft about it, but dunno if they fixed it.
I'll be the first person to admit that I don't know VB/VBScript, but I seem to remember from my high school math class that a number which is equidistant from two other numbers should always round to the even one. So 2.5 rounds to 2, and 3.5 rounds to 4. Extending this analogy, shouldn't 82.845 round to 82.84, just like it is?
Later,
Blake.
The program may be boxed, but the box has an exploit... In Unix terms: Apparently, it's about the csrss.exe process which I gather is the DOS box. The backspace characters reset the 'cursor' to before the beginning of the text buffer, and the subsequent space causes a segv, crashing csrss. Unfortunately, csrss is considered a system vital process, so NT has a kernel panic over this.
The bug is even easier to cause by having a sequence of tabs before the backspaces. Each tab counts as one character in the buffer, but when removing them the pointer goes back 8 positions... You should be able to cause this bug by simply using 'type' on a text file with a bunch of tabs, followed by the same amounts of backspaces, followed by a space. You have to have enough tabs to backspace past all previous output in the dos window (that's what your second program does, except it doesn't use the tab shortcut and so has to loop many times more. Change that string to "\t\b ").
This bug was first reported a couple of years ago. It affects every version of NT ever. Since NT4 won't get any more service packs it's permanently flawed. The bug pops up in many unexpected places. For instance you can make IIS crash the server by doing something like this.
Hmm... This machine is w2k. I'll post, then make a little experiment... I'll report back.
I choose to remain celibate, like my father and his father before him.
not false in VB
but at least he didn't say anything stupid.
Talking is silver &mdash Silence is gold...
No, I think he said "cogito ergo sum" and disapeared.
Well, sometimes you want to run a simulation that needs a random stream of number that is also entirely repeatable. For example, you want to rerun the sim after changing one parm or, err, fixing a bug :-)
But /dev/random does not spit the same sequence twice on command. So for simulation, an RNG with a seed is often the only choice.
Note that simulation people demand, in the same breath, absolute randomness and absolute repeatability. And then, we sim freaks wonder why real-world physicists won't take us seriously...
--
Mad science! Robots! Underwear! Cute girls! Full comic online! http://www.girlgeniusonline.com/
I had a program once which flipped the value of a boolean every time the inner loop executed. You would think that "x = !x" would acheive this effect nicely, but it didn't.... x always remained true.
Eventually, I discovered that the compiler I was using "x = x XOR 1" instead of "x = (x==0)" for it's logical NOT operation. Because I didn't initialize my boolean, there were some upper bits set in the (16-bit) boolean I was using. The "!" operator was only flipping the last bit and ingnoring all the other bits... which is why the variable never became false.
my head was spinning for days after this one.
There are a thousand hacking at the branches of evil to one who is striking at the root.
There is no "proper" way to reduce the precision of a number under all circumstances.
You could use an original pentium chip. With the divide errors, it'd be perfect.
The theory of relativity doesn't work right in Arkansas.
Yeah, it's common knowledge now, and I don't overflow buffers any more.
But back around 1980, when I was just starting to use C, I checked for a buffer overflow in the length of a string, but forgot about the terminating null character.
The definition just after the buffer definition was for the file descriptor of the output file.
I couldn't figure out why, sometimes, output would suddenly start appearing on the console, until I realized that the null was overwriting the value of the file descriptor with 0, which is standard input, and when standard input is the console, you can write to it (at least on the version of UNIX that I was using then).
Those who sacrifice security to condemn liberty deserve to repeat history or something. - Benjamin Santayana
Sometimes my programs display rounded numbers, but I still use the actual values to do calculations:
If the displayed 2s were both 1.5 (both the banker (commercial) and engineering (scientific) rounding methods shows 1.5 as 2), then the result should add the original 1.5s and get 3. If the original 2s were both 2.5 (and the display rounded them using the banker (commercial) rounding method, showing 2.5 as 2), then the result should add the original 2.5s and get 5.