

A single line assignment filled with epic fail - jgrahamc
http://www.jgc.org/blog/2009/01/single-line-assignment-filled-with-epic.html

======
simianstyle
Doesn't bug #4 eliminate supposed bugs #2 and #3? The intent for the author of
the code would have produced bugs #2 & #3, however since that isn't the case,
there are only really 3 bugs.

Either way, this rant doesn't really offer any insight on the programs
context, and what the author should have done. Nothing to learn here folks.

PS - Can we stop using "epic fail" and other internet-fanboy like
colloquialisms in our titles please?

~~~
palish
_Can we stop using "epic fail" and other internet-fanboy like colloquialisms
in our titles please?_

It's not _our_ title. That is the title of the post. So for example, if Joel's
next article is entitled "The Cat Pictures Were an Epic Win For Suzie's New
Startup", then that's a completely valid HN submission title.

~~~
tjr
Of course, in this case, the author of the post was also the submitter, so it
truly was _his_ title, but in general, sure.

~~~
palish
Ah, gotcha.

... But it really _was_ epic just how horribly that line of code failed,
though. 5 bugs in just 48 characters; or 1 bug every 9.6 chars. The rest of
the system was probably equally epic.

~~~
raganwald
May I suggest that _epic_ is not synonymous with _severe_. Epic suggests scale
in both time and place. To me, an epic bug would affect a large number of
people over a very long period of time. Perhaps something to do with IE
security would be epic by virtue of its world-wide and decade-long impact.

On a smaller scale, epic might describe something that brings an entire
company down, perhaps (if you believe some of the rants) the decision to
rewrite the Netscape browser from the ground up.

JM2C on "epic"...

~~~
palish
Since your reply may possibly reshape the way in which "epic" is used on the
internet, affecting a large number of people over a long period of time, would
you consider it to be an "epic reply"? And if so, does that imply we're
currently in an "epic debate"?

------
mattmcknight
I disagree with the quintuple counting...it's not really an epic fail. It
seems relatively minor to me. Consider this: if the program is running as a
user that doesn't own that directory, it can't change the permissions on it.
This dude is saying it's okay if the OS is giving the program the access to
change the permissions on the directory, but it's not okay to use that power
to write to a directory. "Imagine if it were My Documents" is silly- don't run
the program as root...

In any case, the polite hacker thing to do would be to set the permissions
back to what they used to be after you write the file. That's why they
invented the variable name temp.

------
ojbyrne
One good thing, which in principle, makes up for all of that. They included
the source.

------
Hexstream
That line was just _evil_.

------
alain94040
I must say that's one of the most scary one line of code I have seen. I'd be
hard pressed to come up with a more scary single assign statement.

Any volunteers?

~~~
BFalkner
In C#..

public string SomeProperty { get { SomeOtherProperty.Something = whatever;
return someProperty; } }

------
dpeq
Would be interesting to see the line in it's context

~~~
cabalamat
I bet the rest of the program is almost as bad.

