Tue, 29 Apr 2008
GCC Tail-call Bug
Today I spent several hours debugging one of my distributed applications. The bug appeared to be in the sorting routine, which sometimes left the data not completely sorted. The strange thing was that when I added a debugging test at the end of each quick-sort recursive call (thus making sure I catch the unsorted data as early as possible), the problem has disappeared.
So, another Heisenbergish bug, I think. The source code is here: it is a straightforward recursive quick-sort, sorting entries with 32-bit key and 32-bit value (written to work on 64-bit systems only, do not bother to report that it is broken on legacy systems).
Now try to compile it and run with gcc -O2
. For me
(gcc 4.1.2 from Fedora 8) it works. However, when using -O3
(or even -O2 -finline-functions
) it doesn't. Also when
you uncomment the debug printout at the end of qsort_data()
,
it should work even with -O3
. I think the tail-call recursion
is not enabled when the debugging code is present.
Does it work for you? Is my code broken in a way I don't see? If this is not only a problem of my system, I will try to report it as a gcc bug.
Mon, 28 Apr 2008
OpenSolaris, try 1
Given the recent uproar between the OpenSolaris community and Sun corporate overlords (insightfully commented by Ted Ts'o), I have decided to give OpenSolaris a try.
It was a failure: I did not found what version should I download:
- The Developer preview (aka Indiana) does not boot on my virtual machine: after booting from GRUB, it just prints the three lines of a copyright message, and locks up. Not speaking about their license which prohibits even modifying the software on my own machine.
- The Solaris Express {Developer,Community} Edition requires me to register, and probably to use their proprietary "download manager", whatever it is. Moreover, the license explicitly states that the software is not for production use, and that any evaluation of OpenSolaris one may do is a confidental information of Sun, and as such, it is forbidden to publish it. Talk about an Open Source.
- I do not want to use the Live CD distros (there are several of them available). I want to create a ready-to-use virtual machine, just in case I want to test anything later.
- I do not want to use NexentaOS, as I would like to test also the Solaris userland, not only the kernel.
So, my dear lazyweb, where would you start if you wanted to try OpenSolaris without registering, and with access to all the source in the Open Source(tm) manner, including the rights to modify the software and publish benchmarks? And, more importantly, have you ever kissed a girl?
Fri, 11 Apr 2008
Gentoo Linux - the next try
Since I have got a new workstation which supports hardware virtualization, I have installed several different operating systems to my virtual machines. I have already tried Gentoo Linux, so I gave it another try. Again, it was a bit frustrating - few examples:
- When the Gentoo Handbook writes about the default
grub.conf
, why this is not already included in that file itself as a default configuration? For a newbie who wants to learn it is probably good as is, but for me it just costs more unnecessary time. - I needed to test something under GNOME, but "
emerge gnome
" did not work - it said something like "required EAPI 1, supported EAPI 0". Fortunately, "emerge gnome-termianl
" worked. - Why adding GTK+ and GNOME as the default
USE
flags does not imply theX
use flag? In comments to my previously mentioned blog post there is a suggestion to disable theUSE=X
when I do not want the X server to be built. Well, it seems GTK+ client side requires X. - What is the equivalent of "
yum update
" for Gentoo?
I think Gentoo can be excellent for newbie geeks who want to discover what this Linux thing is about, but even that has its limitations. For example, when I upgrade Fedora on my workstation, often many packages which I would normally refuse to install as a superfluous garbage get installed by the distribution. Which is good, because I have an opportunity to look at them later, in already working preconfigured state (in the past it included D-Bus, HAL, SELinux, and many others).
I also cannot imagine how would
I maintain tens of differently configured machines running Gentoo.
Having fixed release points with security upgrades designed and tested
on them is a big bonus, as are the precompiled packages with automatic
dependencies. yum update
and you are done with minimal risk
of breaking something.
Fri, 04 Apr 2008
Fedora Bugzilla
Half a year ago, I have ranted about Fedora maintainers ignoring my bug-report #240070 for several months, and then just asking to verify that the problem still exists in the current version, without any attempt to reproduce the bug (do not even think about attempting to solve it). Well, here is the summary of the development since then (you can also read the comments to this bug yourself):
The bug has been originally filled against Fedora Core 6. Since then,
I have reproduced it on Fedora 7, and also Fedora maintainer
Matěj Cepl
has verified it on his workstation. He subsequently changed the
"distribution
" attribute to "devel
",
so that the bug did not get lost when FC6 reached its end of life.
Well, it did not help.
Without any other maintainer attempting to look at it, today I have got another automatic response:
Based on the date this bug was created, it appears to have been reported against rawhide during the development of a Fedora release that is no longer maintained [...]
If you can reproduce this bug in a maintained Fedora version (7, 8, or rawhide), please change this bug to the respective version and change the status to ASSIGNED.
Just to be cooperative, I have verified that the bug still exists in F7, F8 _and_ the current rawhide. Can anybody tell me how should I report Fedora bugs in so they do not get lost? The bug #201436 is another similar case - read its comments if you need a sad reading for the weekend ...
Thu, 03 Apr 2008
EXIF Comment
For an internal project, we need to store comments inside the JPEG images.
I think the EXIF tag UserComment
is suitable for our purpose (we need texts also in the Czech language, and
the alternative tag, ImageDescription
, is strictly US-ASCII only).
Nevertheless, the problem still lies in the character set area.
The EXIF standard (PDF warning,
look at 34th page, numbered "page 28" near the bottom) defines the UserComment
data such that the first 8 bytes contain the charset info (strings
"ASCII", "JIS", or "UNICODE" padded to 8 bytes with null bytes), and then
the comment data. The problem is what "UNICODE" means. Is it UTF-8, UTF-16, or what?
I have tried to set the comment using Exiv2 utility, and tried to read it with Image::ExifTool
Perl library.
The following code prints the raw UserComment
value (i.e.
the string "UNICODE\0
my_own_comment_as_utf8_bytes"):
#!/usr/bin/perl -w use Image::ExifTool my $info = Image::ExifTool::ImageInfo("exif_comment.jpg", { Charset=> "UTF8",PrintConv=>0 }); print $info->{UserComment}, "\n";
However, with PrintConv=>1
it prints garbage, so probably
the UNICODE charset in EXIF means something different than UTF-8.
So, what does your favourite image handling program display as the
EXIF UserComment for the above image? It should read: "Příliš
žluťoučký kůň. こんにちは。
".