Page 1 of 7

Dumbest mistake you have ever made

Posted: Mon Oct 29, 2007 1:21 pm
by XCHG
What is the dumbest mistake you have ever made when writing a program? Did you laugh at yourself after noticing your mistake? What was the situation? :lol:

Posted: Mon Oct 29, 2007 1:35 pm
by Alboin
I had a pretty stupid one yesterday. I was working on my bootloader, and rewriting a memory map check function. After 15 minutes or so of testing with no results, I look to my code, and realize I forgot to call int 15h.

Y...e...a...h.... 8)

Posted: Mon Oct 29, 2007 2:07 pm
by AJ
Oh, but there are so many to choose from :)

Posted: Mon Oct 29, 2007 3:08 pm
by Candy
Too much options.

I'm torn between stupid mistakes I keep making over and over again and those that took me very long to find.

First category:
- Undeclared variable: i
- Forgetting an increment of an iterator in a while loop
- ((some) problem (lisp programmers ((wouldn't) have))

Second category:
- Including a comment on the symbols filtered by the next loop, consisting of ;, : and \
- Not zeroing memory and leaving a single uninitialized pointer in my task structure, plus adding a page fault handler that takes another random page to put at the location of page faults...
- Forgetting to overwrite the executable image before testing again.

Posted: Mon Oct 29, 2007 9:21 pm
by 01000101
I was recently working on the interrupt handler for my network cards and I couldnt for the life of me figure out why when I recieved a packet, it didnt fire up an interrupt and go to the handler.

after a good half-hour of beating my head on the desk, I realized I never installed the network cards IRQ's.

stupidstupidstupid. =)

Posted: Tue Oct 30, 2007 2:11 am
by Solar
Not incrementing the loop variable in some kind of while-loop has propably happened to everyone at one time or another. I for one had this as a "favourite" error while drawing NSD diagrams during SE classes (because I was "thinking" for-loops, where you write the increment at the top, and forgot to add it at the bottom).

But nothing could beat the 36+ hours of madness-inducing debugging of the PDCLib print() function (the one that does the brunt work for printf() and its relatives), which happened at Breakpoint 2006. It turned out that I did increment the wrong variable. It was so stupid a mistake I howled in pain when I finally found it.

But, as a colleague of mine once put it, "every bug is trivial - once you've found it".

Posted: Tue Oct 30, 2007 3:01 am
by AndrewAPrice
I once was calling:
someClass->someFunction((0,1));
wondering why it wouldn't work. I took me about a week until I realised I had double brackets which calculated to passing 1 as the first parameter, rather than passing 0 as the first and 1 as the second parameter.

Posted: Tue Oct 30, 2007 3:07 am
by JamesM
My favourite has to be when I recompiled Bash for my OS. The autoconf script this time picked up on more features I'd added to the standard libraries so enabled more builtins. The size of the executable went up from 880KB to 1.6MB.

It took me a good two days debugging and wondering why the string tables wouldn't load properly to discover that in fact a 1.6MB file plus my kernel and 3 servers wouldn't fit on a 1.44MB floppy disk...

D'oh!

Posted: Tue Oct 30, 2007 4:23 am
by AndrewAPrice
JamesM wrote:My favourite has to be when I recompiled Bash for my OS. The autoconf script this time picked up on more features I'd added to the standard libraries so enabled more builtins. The size of the executable went up from 880KB to 1.6MB.

It took me a good two days debugging and wondering why the string tables wouldn't load properly to discover that in fact a 1.6MB file plus my kernel and 3 servers wouldn't fit on a 1.44MB floppy disk...

D'oh!
You have two options:
- Decrease the size of the file.
- Increase the size of the disk (http://www.netadmintools.com/art195.html)

Posted: Tue Oct 30, 2007 5:01 am
by JamesM
MessiahAndrw wrote:
JamesM wrote:My favourite has to be when I recompiled Bash for my OS. The autoconf script this time picked up on more features I'd added to the standard libraries so enabled more builtins. The size of the executable went up from 880KB to 1.6MB.

It took me a good two days debugging and wondering why the string tables wouldn't load properly to discover that in fact a 1.6MB file plus my kernel and 3 servers wouldn't fit on a 1.44MB floppy disk...

D'oh!
You have two options:
- Decrease the size of the file.
- Increase the size of the disk (http://www.netadmintools.com/art195.html)
You forgot the third:

- Get my ext2 driver working. Then I have a 50MB image to use :)

Posted: Tue Oct 30, 2007 10:16 am
by inflater
You forgot the fourth :D ... make your own 2,88MB floppy drive from your ordinary 1.44. ;) [Couldn't find where the manual was located]

One day, when implementing main system interrupt in my OS, I tested my "WaitForKeyPress" function. The whole system froze. :D
I spend one hour tracing the assembly code in Bochs and I couldn't find the bug. Now I saw the beginning of my INT 0x30 code; CLI on the start; forgot to STI before the function call. *bangs head* :mrgreen:
XCHG's sig wrote:On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
LOL :shock: I didn't heard what you said, can you repeat that? :lol:

Regards
inflater

Posted: Tue Oct 30, 2007 5:23 pm
by piranha
OK, here's mine(happened yesterday):

I spent 2 hours writing a complicated function that reads a file from the disk, and scans it then loads settings from it, and configures the rest of the program from that one file. But it didn't work. I tried for another hour to find the bug. Then I realized that I had forgotten to make the file. :evil: :evil: :evil: :evil: :evil: :evil: :evil: :cry: :cry: :cry: :oops: :oops:


I was annoyed, maybe pissed off.

-JL

Posted: Thu Nov 01, 2007 7:06 am
by ucosty
Early in my os I was wondering why a whole block of code was not running at all. Turns out I kept forgetting to copy the newer kernel to the floppy image. :(

Posted: Thu Nov 01, 2007 6:23 pm
by niteice
I had some debug messages that were printed at a verbosity level that was generally reserved for annoying debug messages (i.e. a printf on every line). I had them at that level because I assumed they would never be seen.

I sat banging my head against the desk for three weeks or so, and ended up removing the functionality that depended on the module that printed those messages.

About a week later, I was polishing up said module. I discovered that the messages were never printed, but had some critical error information that could have saved three weeks of work and had the intended functionality still working.

Posted: Fri Nov 02, 2007 5:25 am
by XCHG
I was just writing my file system's driver, and I was wondering why the result of a string comparison on two strings was being inaccurate. Seems that I had put 266 instead of 256 in my code like this:

Code: Select all

          LEA     EAX , [EDI + 256]
          LEA     EDX , [EBP - (266 + (3*4))]

I have to ENLARGE MY EDITOR'S FONT SIZE :roll: