Sunday, February 25, 2007

Weekend in Philly

Spending the weekend in Philly with Vikki. At Last Drop working on MythTV.

Just received a ticket update on my Perl core patch. It's been committed to their repository!

http://rt.perl.org/rt3/Public/Bug/Display.html?id=41560

Still trying to get MythTV to compile on OSX cleanly. I'm seeing some interesting differences in the behavior of ln (create symlink) on UFS versus HFS Plus.

For example, on UFS creating a symlink to an empty file does the following:


devin-heitmuellers-computer-2:~/mythtv4/.osx-packager devinheitmueller$ ln -s "" foo
devin-heitmuellers-computer-2:~/mythtv4/.osx-packager devinheitmueller$ ls -l
total 8
drwxr-xr-x 9 devinhei devinhei 1024 Feb 20 00:51 build
lrwxr-xr-x 1 devinhei devinhei 0 Feb 25 11:53 foo ->
drwxr-xr-x 10 devinhei devinhei 1024 Feb 20 00:54 src
drwxr-xr-x 2 devinhei devinhei 2048 Feb 25 11:31 tmp


However, do the same thing on HFS+ and you get the following:

devin-heitmuellers-computer-2:~/mythtv4 devinheitmueller$ ln -s "" foo
ln: foo: Invalid argument


While it's pretty clear from looking at the Makefile output that there are no attempts to do an ln -s "", the nature of the problem I am having has to do with symlinks pointing to nothing, so this could certainly be related behavior.

At least it's something new to look at, which is good since I've been debugging this for three weekends now.

Friday, February 23, 2007

Life is good

Meeting with Co-op board scheduled. Product Demo went great. Fixed the intermittent crash that has been bugging me for a few days.

Met up with Carter last night. We watched The Prestige, which I would recommend to others.

Wednesday, February 21, 2007

How not to check if a hash key exists in Perl

Just had a job candidate in here. This is how she checked if a hash key existed:


foreach my $val (sort keys %foo) {
if ($val eq $searchstring) {
print "Found!\n";
}
}


We decided not to hire her.

Monday, February 19, 2007

Day off

Have Presidents' Day off today. Spending it at the coffee shop in Philadelphia with Vikki.

Stumbled across this on CNN:

'Bullet magnet' fears for Harry
http://www.cnn.com/2007/WORLD/europe/02/19/harry.iraq/index.html

So the third in line for the British throne is off to serve in Iraq. Makes me think back to that Michael Moore movie where he found that of the 535 members of the U.S. Congress, only a handful of them had a child in the military.

Fixed the last of my Perl bugs on Friday (finally). Was going to see if I can get the debugger working now.

Sunday, February 18, 2007

Borat in 30 seconds as performed by bunnies

For those of you at work who attended our last company function:

http://www.starz.com/features/bunnyclub/borat/index.html

Thursday, February 15, 2007

FTD: Do not do business with FTD Florists

Yesterday morning I ordered flowers for Vikki. The FTD website indicated explicitly that it was not too late to have them delivered on Valentine's Day.

They never showed up. I put in a status request, and they said they would not be delivered on Valentine's day due to excessive volume. I put in a cancel order through their website, and got back the following email:

Thank you for contacting FTD.COM. We are always happy to hear from
our customers and enjoy assisting you.

We received your recent request to cancel your order. Unfortunately, your order was already in the process of
being delivered. We are so sorry that we were unable to accommodate your request.

Thank you for shopping with FTD.COM


Bullshit. I called them to cancel the order via phone, pushed "3" to speak to a customer support representative and was told that due to high call volume they would not be able to take my call. **CLICK**. Yeah, the machine hung up on me.

So I called back, and pressed "2" to "check order status". Same message. **CLICK**

So I called again, and pressed "1" to order flowers. Put on hold. No hangup. So they have representatives to take my orders but not to cancel them. Nice. The hold time was set to be over an hour though, so I hung up and figured I would call back once I got to the office.

Called when I got back to the office, same process except this time I can't even talk to a representative to "take my order".

Next stop - credit card company for chargeback...

To add insult to injury, the website now has a banner that says "Forgot to Order for Valentine's Day? Better Late than Never", where they are willing to deliver the same flowers today for 50% off of yesterday's price. Wow.

Monday, February 12, 2007

Done is good

Finally finished all the crap for doing my Co-op application. What a pain. At least it's good to know that if my career as a software developer falls through, I can always fall back on the stuff I learned in Practical Business Skills in the ninth grade. They don't teach kids nowadays how to use a real typewriter -- how to unlock the margins or horizontal align form fields -- how to fill out a form and not have it look like crap.

So now I have a 3/4" stack of paper and a handful of checks to various parties. Just need to get one more item from the bank relating to the financing and everything will be good to go.

Thursday, February 8, 2007

Another bug in Perl core

Fun fun fun. Looks like I found another bug in Perl core today. Been trying to track down the source of a crash for the last couple of days. After finally getting Perl and all my modules compiled with debug info, got this stack trace (truncated by me):


(gdb) bt
#0 0x08179556 in Perl_vmess (my_perl=0x85e79d0, pat=0xf4c51060 "%s handle %s is not a DBI handle", args=0xf7526ad4) at util.c:1013
#1 0x08179b8b in S_vdie_croak_common (my_perl=0x85e79d0, pat=0xf4c51060 "%s handle %s is not a DBI handle", args=0xf7526ad4,
msglen=0xf7526ab0, utf8=0xf7526aac) at util.c:1088
#2 0x0817a214 in Perl_vcroak (my_perl=0x85e79d0, pat=0xf4c51060 "%s handle %s is not a DBI handle", args=0xf7526ad4) at util.c:1208
#3 0x0817a364 in Perl_croak_nocontext (pat=0xf4c51060 "%s handle %s is not a DBI handle") at util.c:1229
#4 0xf4c3beae in dbih_inner (orv=0x97651e4, what=0xf4c511ad "dbih_getcom") at DBI.xs:735
#5 0xf4c3c195 in dbih_getcom2 (hrv=0x97651e4, mgp=0x0) at DBI.xs:814
#6 0xf4c437f0 in XS_DBI_dispatch (my_perl=0x85e79d0, cv=0x912d130) at DBI.xs:2629
#7 0x08197119 in Perl_pp_entersub (my_perl=0x85e79d0) at pp_hot.c:2888
#8 0x081247c8 in S_call_body (my_perl=0x85e79d0, myop=0xf75270e0, is_eval=0) at perl.c:2361
#9 0x081244a1 in Perl_call_sv (my_perl=0x85e79d0, sv=0x912d130, flags=150) at perl.c:2282
#10 0x081a16bf in Perl_sv_clear (my_perl=0x85e79d0, sv=0x9ba5074) at sv.c:5110
#11 0x081a1f5f in Perl_sv_free (my_perl=0x85e79d0, sv=0x9ba5074) at sv.c:5356
#12 0x0819874b in do_clean_objs (my_perl=0x85e79d0, sv=0x912d850) at sv.c:394
#13 0x0819868a in S_visit (my_perl=0x85e79d0, f=0x81986b1 , flags=524288, mask=524288) at sv.c:340
#14 0x081988c3 in Perl_sv_clean_objs (my_perl=0x85e79d0) at sv.c:434
#15 0x08120859 in perl_destruct (my_perl=0x85e79d0) at perl.c:565


This is pretty enlightening, since it tells me exactly what line the segfault occurred on (util.c line 1013). And it looks pretty simple:

if (GvIO(PL_last_in_gv) && IoLINES(GvIOp(PL_last_in_gv))) {


That is, until you expand the macros, which means the above line is really:

if ((((my_perl->Tlast_in_gv)) && (((SV*)(my_perl->Tlast_in_gv))->sv_flags & 0xff) == SVt_PVGV && (((XPVGV*)((my_perl->Tlast_in_gv))->sv_any)->xgv_gp) ? ((((XPVGV*)((my_perl->Tlast_in_gv))->sv_any)->xgv_gp)->gp_io) : 0) && ((XPVIO*) (((((XPVGV*)((my_perl->Tlast_in_gv))->sv_any)->xgv_gp)->gp_io))->sv_any)->xio_lines) {

Also raises the question as to why nobody else has seen this. Did some poking with gdb, and found out that the first part of the if statement does evaluate to a non-null value. The segfault actually occurs in the second part. You see, GvIOp() actually translates to this:

(((((XPVGV*)((my_perl->Tlast_in_gv))->sv_any)->xgv_gp)->gp_io))


and then the result is taken and passed into IoLINES(), which just dereferences it like so:

->sv_any->xio_lines

BUT.... "->sv_any" is 0x0 according to the debugger. In other words, the attempt to offset for xio_lines is a null dereference.

(gdb) print ((((((XPVGV*)((my_perl->Tlast_in_gv))->sv_any)->xgv_gp)->gp_io))->sv_any)
$5 = (XPVIO *) 0x0

CRASH.

So, why doesn't this happen more often? Well, take a look again at the stack. The problem occurs when the Perl interpreter is trying to figure out what Op code and therefore what line number the error occurred on (that's what Perl_vmess does after all). But in this case, the error is actually occurring while shutting down DBI, and in particular in the XS portion of DBI (DBI.xs line 735). So the Perl interpreter cannot figure out what line it occurred on since the error occurred in native code.

Given all this, the fix looks pretty simple. Just don't use GvIOp() if its null.


if (GvIO(PL_last_in_gv) &&
GvIOp(PL_last_in_gv) &&
IoLINES(GvIOp(PL_last_in_gv))) {


Neato.

On a separate note , I still have to get to the bottom of why the handle is not a DBI handle (which is what prompted the error message in the first place), but at least it won't crash anymore...

Tuesday, February 6, 2007

New Apartment

Met up with the appraiser this morning. Here are some pics I took.



The outside of the building. And it's got a Starbucks right across the street, so I can get my morning hot chocolate on the way to work.


View from the front door.


Inside the apartment.


The window looks out on the Empire State Building.

Monday, February 5, 2007

Can't sleep

It's 4am and I have to meet up with the inspector at the new apartment in five hours, then get to the office. Knowing my luck I'll fall asleep soon and oversleep for my appointment.

Sunday, February 4, 2007

Bill Gates on Vista and Apple's 'Lying' ads

Bill Gates gave Newsweek an interview on Vista.

http://www.msnbc.msn.com/id/16934083/site/newsweek/

I love this little gem:

I mean, it’s fascinating, maybe we shouldn't have showed so publicly the stuff we were doing, because we knew how long the new security base was going to take us to get done. Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine.


Doesn't he know better? Little doubt in my mind that someone in the community is going to respond to this little 'dare'.

Saturday, February 3, 2007

Philly for the weekend

In Philadelphia for the weekend with Vikki. Eric and Michelle came over last night and we played some Scattagories.

Trying to get all the apartment stuff straightened out. Sent out a couple of requests for personal references for the Co-op board and so far everybody has been extremely supportive despite needing them by next Friday. Mortgage is done.

Going to try to finish proofing the user manual today. Started yesterday and found it needs alot of work. About what I expected given the relative state of the project.

Off to Last Drop to get some coffee and get some work done...