Sunday, June 07, 2009

wget 1.10 hurts -- or, Perils of an Old OS

The ex-teen's friend tried to update Firefox on our box and discovered that the commands he knew just didn't work. What operating system are we using, anyway?
$ uname -a
Linux p4 2.6.11.4-21.11-default #1 Thu Feb 2 20:54:26 UTC 2006 i686 i686 i386 GNU/Linux
OK, so it was compiled three years ago. Well, ffox 3.x wouldn't run on this box anyway, even if whatever commands had worked.

So I decided to overcome my Luddite slothful tendencies and download the latest stable OpenSUSE version -- which turns out to be 11.1 (there are release candidates for 11.2, but I didn't want to go there). So I went to the download site, selected DVD and 32-bit processor, and fed the ISO image link to wget, like this:
$ time wget -O /content/openSUSE-11.1-DVD-i586.iso \
http://download.opensuse.org/distribution/11.1/iso/openSUSE-11.1-DVD-i586.iso &
[1] 9452
[[...]]
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /pub/opensuse/distribution/11.1/iso ... done.
==> PASV ... done. ==> RETR openSUSE-11.1-DVD-i586.iso ... done.
Length: 262,916,096 (unauthoritative)
It got off to a good start, though 262-263 Mbytes seemed pretty small for a DVD install image. I feared a 32-bit arithmetic problem, but anyway, the download speed was over 1Mbit/second over DSL. A few hours later, I got some bad news:
100%[==================================>] 2,147,469,984  157.43K/s    ETA 00:00
wget: progress.c:704: create_image: Assertion `insz <= dlsz' failed.
-bash: line 4: 9453 Aborted wget -O /content/openSUSE-11.1-DVD-i586.iso http://download.opensuse.org/distribution/11.1/iso/openSUSE-11.1-DVD-i586.iso

real 275m45.797s
user 0m4.908s
sys 0m26.973s
$ ls -o /content/openSUSE-11.1-DVD-i586.iso
-rw-r--r-- 1 collin 2147502816 2009-06-07 12:46 /content/openSUSE-11.1-DVD-i586.iso
$
That looked to me like a 32-bit problem. I mean really, 2147502816 is clearly bigger than 2,147,469,984, right? Well, not in 32-bit signed arithmetic:
$ d2x 2147502816
0x80004ae0
$ d2x 2147469984
0x7fffcaa0
$ type d2x
d2x is a function
d2x ()
{
python -c "print('%#x' % $1)"
}
$
Awww, man! What kind of wget were we using here anyway?
$ rpm -qf /usr/bin/wget
wget-1.10-1.3
$ rpm -qi wget
Name : wget Relocations: (not relocatable)
Version : 1.10 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 1.3 Build Date: Fri 14 Oct 2005 09:34:32 AM PDT
[[...]]
$
So, it was compiled over three years ago. I made a token effort to find release notes for this 3½-year-old version of wget but no joy.

Well, it turns out that the file was actually 4557883392 bytes in length. Translated into hex, that's 0x10fabc800. If we trim that to 32 bits, it comes to...
$ x2d fabc800
262916096
$
Which matches the bogus "Length: 262,916,096 (unauthoritative)" that my old version of wget gave me earlier.

Well, perhaps OpenSUSE 11.1 will give me a version of wget that'll handle a 4.5Gbyte download, even in a 32-bit version.

"Hope springs eternal..." --Pope

Workaround

So what to do? Fortunately my office is very Linux-friendly. I pulled the image onto one of the boxen there, and I'm running rsync. Yes, even a 2005 rsync (version 2.6.3, Build Date: Tue 22 Mar 2005 10:54:18 AM PST) can handle files bigger than 2GB; hopefully it can also handle files bigger than 4GB. I guess we'll see.
Yes it does!

<Pope again here> "A longing fulfilled is a tree of life."

No comments: