2009/05/15

String::CRC::Cksum module for 64-bit Perl

When I used the following command to install String::CRC::Cksum on my 64-bit Ubuntu,
perl -MCPAN -e "install String::CRC::Cksum"
the following error message is shown and perl rejected to install it:
Use of uninitialized value in bitwise xor (^) at at /usr/local/share/perl/5.10.0/String/CRC/Cksum.pm line 73.
I managed to google the solution but in vain. Finally, I realized the problem is caused by 64-bit integer on my 64-bit Ubuntu.

To fix this problem, force to install String::CRC::Cksum module first:
$ sudo cpan
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> force install String::CRC::Cksum
and then patch it (/usr/local/share/perl/5.10.0/String/CRC/Cksum.pm, "chmod" first! it's read-only):
--- Cksum.pm    2009-05-15 00:33:20.000000000 +0800
+++ Cksum.pm 2009-05-15 00:25:36.000000000 +0800
@@ -70,7 +70,7 @@

for(my $i = 0; $i < $n; ++$i) {
my $c = unpack 'C', substr $_[0], $i, 1;
- $cksum = ($cksum << 8) ^ $crctab[($cksum >> 24) ^ $c];
+ $cksum = ($cksum << 8) ^ $crctab[(($cksum >> 24)&255) ^ $c];
++$size;
}

@@ -111,7 +111,7 @@
while($size != 0) {
my $c = $size & 0377;
$size >>= 8;
- $cksum = ($cksum << 8) ^ $crctab[($cksum >> 24) ^ $c];
+ $cksum = ($cksum << 8) ^ $crctab[(($cksum >> 24)&255) ^ $c];
}
$cksum = ~ $cksum;

2009/05/10

將 Ubuntu 從 8.04 升級到 9.04

Ubuntu 9.04 已經出來一陣子了,口碑還不錯。而 Ubuntu 8.04 是 LTS 版 (Long Term Support),所以不能直接升級到 9.04,必須用以下方法來升級。

首先要修改一項和更新有關的設定 (系統->管理->軟體來源->更新):將 顯示新的發行版本發布長期支援的發布 改為 正常發布




接下來,執行更新管理員 (系統->管理->更新管理員),應該會看到 有新的發行版,只要按 升級 就可以將 8.04 升級到 8.10:



升級過程約需要三十至六十分鐘。等升級完畢,再執行一次更新管理員,從 8.10 再升級到 9.04 即可。

PS: 升級完畢,可用以下指令刪除一些不必要的 package,節省空間:
sudo apt-get clean