Diary of the beer bottle fairy

Web 2.0 blog of Spirituality, Romance, National values, Apple computers, Pop music and Python programming.

So I have a journal again. Please pardon me if I don't update it regularly -- I decided not to go with wordpress or bloxspot and did a really bad job replacing them, so it's a big pain to write journal entries for me. I prayed for help, no answer so far. Maybe my prayer got stuck in spam filter.

Source code of the entries and scripts that format this site are available on github. Text of journal entries is licensed under CC-BY-SA license.


Tue 16 Feb 2010 09:24:21 PM CET

Analyzing GIT commit data

Given distributed version control systems store all the history in a local storage an access to commit metadata as well as commits themselves is usually a lot faster compared to conventional version control systems. Additionally, GIT provides clever tooling that exposes information about the commits, that can be nicely visualized via the means of diffstat and such, or exported for further analysis with other tools.

I'll describe the process of getting the data into GoodData, a web-based data analysis tool with collaboration features somewhat resembling those of social networking web sites. What can you do with your GIT commit data is to create reports similar to LWN's Who wrote... articles for Linux kernel releases, or maybe employ analysis similar to what Ohloh does for your project.

Upload

Perl has a rather stable and active developer community and its source code is publicly available, therefore its commit history will serve our purpose perfectly. Let's obtain the code from the GIT repository first.

  $ git clone git://perl5.git.perl.org/perl.git
  $ cd perl

For illustrational purposes we'll just use the tail of the development history, since 5.10.0 release which was tagged in December 2007.

  $ git log --date=short --format="format:%h:%aN:%aE:%cd:%ct" --shortstat perl-5.10.0 |
          awk 'BEGIN {print "Commit SHA1 Hash:" \
                  "Author Name:" "Author e-mail:" "Date:" "Timestamp:" \
                  "Files touched:" "Lines added:" "Lines deleted"}
                  /^ / {n=0; print ":"$1":"$4":"$6; next}
                  /^[^ ]/ {if (n) {print ":0:0:0"}; n=1; printf $0}' >history.csv

Most likely there is a better way of obtaining the line changes than piping a shortstat through awk, but this is the fastest one I could come up with. It would probably have been a better idea to use a --numstat flag and preserve the per-file change information.

Note that we stick a header line there. That's not strictly required -- we could add it in the UI instead as well.

(Available in theora, h264, youtube)

During the upload, we mapped the dates to date dimension.

Now let's see create some reports.

Read more...

Thu 11 Feb 2010 10:15:50 PM CET

Testing your web application programmatically

For every application whose code base grows beyond what can be maintained by a single person a good test suite can save a lot of time and pain. It can even be a lot of fun; and web applications are no exception.

This journal entry describes the tools and basics of automation of user actions. Enough to construct a synthetic test for a simple calculator application:

http://v3.sk/~lkundrak/blog/images/jsapp.png

Ingredients

Read more...

Mon 30 Nov 2009 10:08:27 AM CET

VCS hell

About the biggest productivity boost I've done in long time was putting this into my ~/.bashrc:

  vcs ()
  {
          TOOL=
          [ -d CVS ] && TOOL=cvs
          [ -d .svn ] && TOOL=svn
          [ -d .osc ] && TOOL=osc
          echo "$@" |grep :// && TOOL=$1
          [ "$TOOL" ] || TOOL=$(D=; for C in $(echo $PWD |sed 's,/, ,g')
          do
                  D="$D/$C"
                  echo $D
          done | sort -r |while read DIR
          do
                  [ -d $DIR/.hg ] && TOOL=hg
                  [ -d $DIR/.git ] && TOOL=git
                  [ "$TOOL" ] && echo $TOOL && break
          done)
          [ "$TOOL" ] || TOOL=$1
          shift
          $TOOL "$@"
  }
  alias git="vcs git"
  alias cvs="vcs cvs"
  alias svn="vcs svn"
  alias osc="vcs osc"
  alias hg="vcs hg"
Read more...

Mon 09 Nov 2009 04:14:40 PM CET

openSUSE 11.2 on Dell Inspiron Mini 12

Bought a new toy lately, a small Atom-based laptop and took an oportiunity to experiment with a platform different from what would you expect from a Fedora enthusiast. Grabbed a fresh new installation of openSUSE 11.2 and gave it a try.

Hardware

The toy looks rather appealing. One can't overlook similarity with another thin laptop by a hardware vendor best known for being a notoric winner in the vendor-lock in paralympics. Compared to that one, this one is smaller and lighter, which is paid for with a rather small battery life (around 2 hours). If you ever used a MacBook Air you'd probably be disappointed that unlike Air, you can't iron your clothes with Inspiron Mini. For a fraction of price, the engineers obviously could not affort putting a fan inside, nor have a reason to do so. Wasn't it for the moving-head 1.8" hard drive, there wouldn't be any moving parts there. Unfortunatelly, I could not find a model with a solid state one.

Upgradability of the machine is virtually none. You can't even replace upgrade the humble 1G of RAM memory. You know, the RAM chips never go bad, or do they? Dell no longer sells these machines; makes one think if the users didn't appreciate not being able to stick in more RAM -- something that can be done even with smaller 10" and 9" models. The RAM's soldered on the same board with dual-core 1.3 GHz CPU. Definitely not a miracle, performance-wise. Apart from three times the amount of USB ports of what Air has, you'd be probably surprised to find an SD card reader built in. Just for semi-completeness, the display's resolution is 1280x800 and there's a VGA port for external display.

You can have a look at the innards here: http://ravicblog.blogspot.com/2009/01/dell-mini-12-dissected.html

http://www.blogcdn.com/www.engadget.com/media/2009/02/2-1-09-dell-mini-12-splayed.jpg

Software

This is the most poorly supported machine by Linux that I've touched in ages. A complete sucker. Which is good, since with a little effort mostly each piece of its hardware is usable.

Installing

So I copied the Gnome flavour of live openSUSE live media to an USB flash memory stick and booted it. It booted up a lot faster than I expect it to and what I immediately found out was that the display resolution was rather exotic and I could not connect to wireless (more about those later). Honestly, the really first thought was "wow, the artwork is beautiful." So much for the first impression, I rebooted it into installer and started installing. It went pretty smoothly, no surprises apart from the disk partitioning.

No idea why is that so hard to get it right, but the partitioner in yast2-based installer sucked nearly as much as Debian's one. Personally, I like how does Fedora do that, but every other installer I saw would do a better job if it just launched fdisk. No matter how much I tried, I could not convince it to use all disk's free space and not just 14G. I ended up running an "expert" mode where I could not do anything at all, since the device was "busy". "Probably confused by existing partitioning," I thought, it contained a NT partition and some service dell stuff. Wiped it away, created and empty partition table. This time the installer looked a lot nicer, allowed me to create a big partition that spans the whole disk and LVM on it. Installation finished. Result? One 14G partition. FFFFFFFFFFUUUUUUUU-, single user mode, fdisk, pvresize, lvresize, e2resize...

Graphics Blues

A lot has been writted about the gigantic suckage the Poulsbo GPU is. More-or-less good news is that at http://v3.sk/~lkundrak/psb-opensuse-11.2/ you can find packages I've ported over from RPM Fusion that can be used. Bad news is that the drivers are (who'd think that for a closed blob) rather limited. Can't help thinking this must have been a winner of this year's hate-your-user competition.

Making it Sing

Sound not work out of box. Fortunatelly, it worked with sound-2.6 and as I later discovered, Takashi Iwai commited a fix just two days ago. This is not the first time he was found guilty of commiting exactly the fix I needed. He's a SUSE developer as well, therefore I'd expect openSUSE audio stack to be generally in a decent state, it was probably just me picking the wrong piece of hardware this time. Oh, and here's that fix:

http://git.kernel.org/?p=linux/kernel/git/tiwai/sound-2.6.git;a=commit;h=1a6969788ef2d5bc3169eee59def6b267182f136

Despite this fix, you get horrible sound dissorts with PulseAudio. As far as I'm concerned it's a known bug and being worked on. Not being anything that would even remotely resemble anyone thet would be familiar with the audio stack, a quick fix for me would be to configure gstreamer to bypass Pulse with gstreamer-preferences.

Wireless

Did not get that to work yet. Broadcom. Not looked into that much, but I'd not be surprised if there was a LP PHY. If I'm right, I'm lucky, since some time ago I've seen Gábor Stefanik commit some bits that could make it work into wireless-testing (though they seem to have been reverted since):

http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Flinville%2Fwireless-testing.git&a=search&h=HEAD&st=commit&s=LP-PHY

In worst case, the MiniPCI-E network adapter is replaceable.

Software Load

As I've said, I've chosen the GNOME flavour (most openSUSE users seem to prefer KDE). The distro feels very polished, from the bootup procedure to the Desktop itself. They replaced the GNOME menu with their own version, and I'd say it could use some improvement (found it hard to launch terminal :). It does only offer a couple of most used applications, it uses a separate dialog to find and run some other application. You can't search for an application from the menu. Probably needless to add, this is just a matter of taste, not a technical barier. The standard GNOME menu is offered as Panel applet, you can replace the openSUSE menu with it, or even use both if you like.

When it comes to applications, openSUSE tends to use Mono-base tools. Looking both at the performance and the memory consumption I couldn't help thinking it feels pre-production. Having said the machine has humble techincal parameters one can't blame me for not using Tomboy, Banshee or F-Spot. (Tried to actually use the latter and would definitely advise my friends to do so. If not memory and CPU, I could probably at least use more battery life.)

For package management a tool called zypper is used. With command-line interface similar to yum it's rather easy to grasp. I appreciated that it searches rather quickly compared to yum, didn't care much enough to research why. The repositories can be added and removed without editing the configuration file. A nice detail, but openSUSE seems to rely on custom repositories heavily so it's rather important there. What I did not like is that it by default refreshes the repository metadata on each run and installs packages right after downloading. The latter may be an advantage if you are disk-space constrained, though it might have been nice if they parallelized it (not that yum would do that).

What's unhappy is how openSUSE decentralizes repositories. It might be useful in some specific use-cases, but think of the poor user who just wants to install a package... I needed Rhythmbox. Took me some time to learn about Contrib repository (shame on me for not reading documentation). Why on earth isn't it present by default? It could be disabled or something. Needed another package (synergy), not present in contrib, but managed to find it in someone's collection (or how is it called) in Build Service. I wish I could just zypper in synergy.

Time to get some real work done. What I do for Fedora is package development; why not package stuff I needed? Started with psb kernel module. What I need to note now, this is the time I encountered the first bug (with git config color.ui set to auto, the pager didn't let the escape sequences pass through like less -R does). Everything else worked flawlessly so far, I'm not used to that :) Another thing worth noting is that anyone who drives the kernel module packaging infrastructure for openSUSE did not do a proper research, otherwise he could have delivered more for smaller price resuing what's already been done.

This is where I started to think that openSUSE must just hate packagers. Having my tiny RPM done, I had no way to ensure it's buildable reproducibly (its BuildRequires are correct). Fedora engineers are familiar with mock tool -- for openSUSE I was told that I need a Build Service account. For a local build. And I need a "Build Service checkout" to build from. If a Novell engineer happens to read this, surprised why you have so little community contributors? They don't feel welcome. They feel that your tooling is a medieval torture device.

Overally -- not bad. I'm going to use this for my desktop work and will attempt to do some Fedora development from it ;)

Update: A in rather informative thread spinned off at opensuse-buildservice list: http://lists.opensuse.org/opensuse-buildservice/2009-11/msg00077.html Obviously openSUSE has a local build tool and with osc build I just picked up a wrong tool. It has some glitches though, apparently apart from not working at all (#553880) it is not designed around zypper and does not fetch packages from remote repositories. I find it odd that the developers don't lack the functionality -- mock proved to be a really useful tool greatly helpful for lot of stuff ranging from building the packages in the build system, to QA-ing them locally and even creating chroots of other distribution releases to reproduce and fix bugs.

Read more...

Wed 04 Nov 2009 01:34:24 PM CET

See you at LinuxAlt 2009

LinuxAlt 2009 takes place this weekend in Brno. The talks seem pretty interesting, see details at web site http://www.linuxalt.cz/ (czech).

http://lkundrak.fedorapeople.org/linuxalt2009brno.jpeg

(There's no good blog without a picture. Hopefully god will forgive me for reusing older artwork, and noone will notice either.)

Read more...

Tue 03 Nov 2009 11:48:46 AM CET

Review Swappies

Need someone to review your package?

As my need-to-have-reviewed queue grows, I'm willing to swap reviews with you! Just check these out, http://tinyurl.com/review-queue most are failry simple, pick some and let me know which package you want me to review.

If you've never made a package or newer done a review and would like to join maintainers of Fedora package collection, this is a good way to start! Do not hesitate to let me know if you need any help then!

Read more...

Wed 26 Aug 2009 12:44:49 PM CEST

Announcing the new Fedora Project Logo

http://v3.sk/~lkundrak/blog/images/fedora-new-logo.png

Read more...

Fri 14 Aug 2009 02:36:35 PM CEST

Logo-shaped collage of Fedora users

Pavol Rusnak of OpenSUSE made a beautiful collage of their user avatars. I tried to do the same with Fedora users. See how it looks:

http://v3.sk/~lkundrak/blog/images/fedora-users-tn.png

See Full size picture.

Read more...

Thu 16 Jul 2009 03:04:13 PM CEST

Still wondering why File System Capabilities are just Awesome?

If File System Capabilities were in use now, today's local root privilege escalation flaw in Pulseaudio just wouldn't happen. Happily, they have been finally enabled in RPM for Fedora 12!.

Read more...

Fri 10 Jul 2009 03:40:24 PM CEST

VirtualBox 3.0.0 in RPM Fusion

VirtualBox 3.0.0 Open Source Edition (OSE) will hit RPM Fusion Free repository for Fedora 11 soon unless something breaks horribly. That means now it's the best time to test it!

http://v3.sk/~lkundrak/blog/images/virtualbox3.png

Apart from rebase to newest, freshest, coolest upstream code, the guest additions for Fedora were reworked (which means they actually should work now). To get them, install the VirtualBox-OSE-guest package in your Fedora 11 Virtual Machine.

For the X11 display resize functionality to work, you need a recent xorg-x11-server-Xorg package, which is currently waiting to be pushed to the testing repository.

Credits

The RPM Fusion community had been doing fantastic job reporting issues and providing fixes for the package, so I feel obliged to send a big thank you to them especially to Kevin Pouget, Gabriel Ramirez, Valent Turkovic and Jonathan Dieter (in no particular order). Kudos to the upstream developers as well, especially for fixing the irritiating network-related hang bug very promptly.

Read more...

Sun 28 Jun 2009 11:25:28 AM CEST

Two more FUDcon photo patches

Michal Ingeli (<ksyz>)

http://farm3.static.flickr.com/2455/3668030526_955bc8cb94.jpg

Lubomir Rintel (<lkundrak>)

http://farm4.static.flickr.com/3372/3668030540_f48a399be8.jpg

Read more...

Sat 27 Jun 2009 07:01:33 AM CEST

A few observations about Berlin

Read more...

Sun 07 Jun 2009 12:40:36 PM CEST

Review Swappies

Need someone to review your package?

I'm in a desperate need of having load of Ruby stuff in and willing to swap reviews with you! Just check these out, http://tinyurl.com/gdc-ruby-stack most are failry simple, pick some and let me know which package you want me to review.

Please help a brotha out!

NB: This may come handy to you when reviewing those: https://fedoraproject.org/wiki/Packaging:Ruby

Read more...

Tue 02 Jun 2009 04:20:45 PM CEST

How to get a feature into Gnome

http://bugzilla.gnome.org/show_bug.cgi?id=566546

Read more...

Tue 19 May 2009 03:52:40 PM CEST

Fedora 11 and Inkscape 0.47

Dearest Fedora and Inkscape users,

As you may have noticed, Fedora 11 (Leonidas) will ship with SVN snapshot of Inkscape that targets 0.47 release. As such it may have bugs that will not be present in the release and even incomplete feature set since it is from few days before the feature freeze.

This was done due to demand from user base and to help shape the final 0.47.

Once Inkscape 0.47 is released, which is planned for mid-July, it will be pushed to the stable updates repository. Until then, testing repository will be regularly updates with beta and release candidate packages starting with a snapshot from May 18th. See Fedora Wiki for details on how to get the package from the testing repository.

Any feedback is, of course welcome. Please report issues you'll find at Inkscape's bug tracker or our Bugzilla instance. Please ensure you're running latest inkscape package from the testing repository before reporting a bug.

Have fun with brand new Fedora and Inkscape!

Read more...

Sun 03 May 2009 03:53:48 PM CEST

VirtualBox OSE in RPM Fusion

Open Source edition of VirtualBox had recently finally been imported into RPM Fusion.

While the Fedora 10 Branch carries the 2.1.4 version, and is not likely to be updated to a newer release, a brand new 2.2.2 version had been imported into development branch targetting Fedora 11 today and will hit the devel repository soonish.

Grab it while it's hot unless you already have done so -- download the Fedora 11 Preview release, enable RPM Fusion free repository and add VirtualBox-OSE package. All feedback (either bugs in bugzilla or success reports) is of course welcome.

And finally the screenshot, which probably grabbed your attention to this post ;)

http://v3.sk/~lkundrak/blog/images/vbox-2.2.2-tn.png

Read more...

Wed 29 Apr 2009 10:24:47 AM CEST

Short circuitting binary RPM builds with shortrpm

Ever wonderred why can't you do a rpmbuild -bb --short-circuit just after you found out that you forgot to add something in %files or made a typo in %install, having waited three hours for a package to compile? Being able to quickly fix your problem could easily save you many hours of compiling. You could check whether the package is able to install, check whether dependencies are fine, the program runs, scriptlets behave fine or just rpmlint the resulting package.

There are lot of packages that take >1 hour to build, and for certain packages, say java-1.6.0-openjdk on PowerPC, an extra compilation effectively means one more day to get the package done.

If you don't like having to rebuild your package every time you make a small mistake just because of a religious issue with RPM you may have a look at shormtrpm package. It transparently wraps rpmbuild, causing it to think most sections contain exit 0 as first command intercepting open(3) call via LD_PRELOAD.

Workflow

Once you install the shortrpm package (and eventually restart your shell), you may follow the same procedure when building the package as before, while gainging the ability to short-circuit the binary package build:

  rpmbuild -ba gnomovision.spec

Oh my! Install failed on EL-5 since I forgot to add --vendor parameter to desktop-file-install. Fix it.

  rpmbuild -bi --short-circuit gnomovision.spec

Succeeded. Fine. You'd have to do an extra rebuild here without shortrpm.

  rpmbuild -bb --short-circuit gnomovision.spec

rpmlint says you're missing %defattr and that your permissions are generally insane. Fix it. Again one more rebuild without shortrpm.

  rpmbuild -bb --short-circuit gnomovision.spec

Looks fine. I'm gonna do a final build to ensure everything builds fine as it is.

  rpmbuild -ba gnomovision.spec
Read more...

Fri 24 Apr 2009 09:46:37 AM CEST

Taking advantage of tab titles

If you're using many terminal tabs, you may have noticed that the default tab title does not particularly contribute to easy identification of the tab. user@hostname. It may make sense if your work mainly consists of administering systems remotely, which is frequently not the case.

This led me to adding this little snippet to my .bashrc files, resulting in nicer tab names:

  _set_xterm () { echo -ne "\e]0;$@\007"; }
  _clear_title () { _set_xterm shell; }
  _set_title ()
  {
          TITLE="$@"
          # Ignore ourselves
          [ "$1" = _clear_title ] && return
          # Deal with job control
          if [ "$1" = fg ]
          then
                  MATCH='^\[.*\]\+'
                  [ -n "$2" ] && MATCH="$(echo $2 |sed 's/^%\([0-9]*\)/^\\[\1\\]/')"
                  TITLE="$(jobs |grep "$MATCH" |sed 's/^[^ ]* *[^ ]* *//')"
          fi
          _set_xterm "$TITLE"
  }
  PROMPT_COMMAND="_clear_title"
  trap 'set +o functrace; _set_title $BASH_COMMAND' DEBUG

http://v3.sk/~lkundrak/blog/images/bashrc.png

Read more...

Thu 23 Apr 2009 12:34:28 PM CEST

Good user interface

...knows what to do better than the user.

http://v3.sk/~lkundrak/blog/images/ebay.png

Read more...

Sun 29 Mar 2009 05:20:07 PM CEST

Trouble running crash against live system?

If you've attempted to run crash against live system with recent Rawhide kernel that doesn't ship the crash driver, but uses /dev/mem to access memory, you've probably failed, getting an error message similar to this:

  crash: read error: kernel virtual address: c0abb600  type: "xtime"

That's because for some unknown reason /dev/mem is limited to first 256 pages. Until this is fixed upstream, here's a simple SystemTap script that tricks the range-checking routine into thinking that our access is not beyond the 256-page boundary:

  probe kernel.function("devmem_is_allowed")
  {
        $pagenr = 0;
  }

It modifies a local variable, so it has to be run in Guru mode:

  [root@bimbo stap]# stap -g devmem.stp 

Voila, crash works.

Read more...

Tue 17 Mar 2009 08:36:55 AM CET

Getting rid of crop marks

The quickest way I've found for getting rid of crop marks before printing out pages from Linux Device Drivers (you would not believe how annoying they could be :)

  pstops -pa4 '0@1.3(-3.5cm,-4cm)' ch10.ps ch10-cropped.ps

I'm wondering whether there's a GUI tool that could save me from trial-and-error while finding the right shift and scale.

Read more...

Wed 11 Mar 2009 12:32:32 PM CET

Anyone to review Yo Frankie (BGE) package?

No? Fine, I'm closing it WONTFIX. I just thought it might be a good idea to have a game that showcases Open Source 3D graphics capabilities in distro.

Seriously, if there's any package who likes the game, I'd even swap reviews. Not a packager and want to be? Doing a good review may help you get sponsored. I'd be thankful for a good unofficial review as well.

The package itself is quite simple, just a bunch of static files in /usr/share, I can't understand why noone picked in up in almost three weeks.

Here's the review request, and here are couple of screen shots to convince you. The game is actually much better than these:

http://v3.sk/~lkundrak/blog/images/yo-frankie/level1.png

http://v3.sk/~lkundrak/blog/images/yo-frankie/log.png

http://v3.sk/~lkundrak/blog/images/yo-frankie/goat.png

http://v3.sk/~lkundrak/blog/images/yo-frankie/water.png

http://v3.sk/~lkundrak/blog/images/yo-frankie/sheep.png

Read more...

Sat 07 Mar 2009 01:07:19 PM CET

DOS Games in Linux

I've made RPM packages of some DOS Abandonware Games. Check it out if you want if you want to relive your old memories, before software lawyers knock on my door :)

http://v3.sk/~lkundrak/dosgames/img/imapc.png

Read more...

Tue 03 Mar 2009 06:32:50 PM CET

Inkscape snapshot in Rawhide

SVN snapshot that will eventually lead to 0.47 release landed in Rawhide. It took some time to get it compile with GCC 4.4, and even more to get it run. Now that it runs, I'm sure you know that (like everything in Rawhide), it can burn your house, kill your cat and make the whole world implode.

http://v3.sk/~lkundrak/blog/images/inkscape.png

What's new

The package has been refactored, it doesn't drag each possible dependency for each extension. However, you may lack some extensions (Inkscape hides most of them if their dependencies are unsatisfied). I yet have to figure out what to do about this; mention it in Release Notes, split the core into a subpackage and let the main package depend on all possible dependencies or install dependencies on-demand via PackageKit (ideas? mail me)

Apart from that, upstream added a whole lot of new features: http://wiki.inkscape.org/wiki/index.php/ReleaseNotes047

Feedback?

Does it suck? Tell me. If 0.47 doesn't come close enough to Fedora 11 release, we can still revert to 0.46 code base.

Read more...

Wed 25 Feb 2009 11:27:45 AM CET

Congratulations

...to Martin Nagy.

http://v3.sk/~lkundrak/blog/images/sparta.png

Read more...

Wed 11 Feb 2009 10:05:30 PM CET

Getting rid of autoreconnect

Do not read this unless you have to. I in fact wrote this just to see if my new hackergotchi shows in Fedora Planet.

Having said that, switching to Apache::DBI::Cache and thus heavy use of MySQL's USE statement it was clear we couldn't use MySQL's autoreconnect feature. Though it's very seldom useful, there here are the drawbacks. Apart from continuing outside of transaction when it breaks discarding what was done so far, which doesn't generally happen in active connections unless a server bug exists, the major problem is autoreconnection to the database the handle was originally created for, not the one that was switched to.

Not a big problems, unless your connections are idle for too long, you'd say. Apache::DBI::Cache pings a connection before giving it to you, so you'll get a fresh connection everytime you request a DBI handle. There are still creative ways how to circumvent that. What our programmers did was to keep a structure containing a DBH reference in a global, even when in mod_perl worker:

  package Package;
  my $Cache;
  # Package cache
  sub getPackage
  {
      $Cache ? $Cache : $Cache = { db => DBI->connect ($dsn) };
  }

Guess how long were these left being opened for workers after the load peak. Hint: default wait_timeout of MySQL is eight hours. Neat. Ever heard of the Morning Bug?

Another problem being hit was if fact in a test. Point of the test was to access the database concurrently, possibly creating a deadlock that is detected by mysql an test that transactions are restarted correctly;

  $db = DBI->connect ($dsn);
  $db->do ($prepare_the_data_model);
  # Ensure problematic transactions are being restarted
  if (fork ()) {
      my $db2 = DBI_WRAPPER_THAT_RESTARTS_TRANSACTIONS->connect ($dsn);
      $db2->do_stuff;
  } else {
      my $db2 = DBI_WRAPPER_THAT_RESTARTS_TRANSACTIONS->connect ($dsn);
      $db2->do_stuff;
      exit ();
  }
  wait;
  $db->do ($check_that_result_makes_sense);

Seems correct? This works perfectly with reconnects, but MySQL server goes away before the last line can be executed? Why? The $db handle is inherited by the child and it closes it upon exit. A correct solution is to either with _exit call from POSIX module, initialize another database handle, or reconnect the existing one.

Read more...

Mon 09 Feb 2009 08:43:37 PM CET

Fedora 11 Alpha

First alpha of Leonidas ships! Yay!

http://v3.sk/~lkundrak/blog/images/floppy.jpeg

Some users have reportedly had some minor problems starting it from the live media though :(

Read more...

Tue 03 Feb 2009 06:17:29 PM CET

Stuck in Perl? (Part 2)

Your perl code being stuck again, still alive and you need a backtrace? Here's how to get it, in case you have Carp loaded:

  [lkundrak@trurl ~]$ cat lala.pl 
  sub a { <>; }
  sub b { a (); }
  sub c { b (); }
  c ();
  [lkundrak@trurl ~]$ perl5.11.0 -MCarp lala.pl &
  [1] 31236
  [lkundrak@trurl ~]$ gdb -p $!
  GNU gdb Fedora (6.8-27.el5)
  ...
  0x00110402 in __kernel_vsyscall ()
  (gdb) call Perl_call_pv(my_perl, "carp", 0)
   at lala.pl line 1
          main::a() called at lala.pl line 2
          main::b() called at lala.pl line 3
          main::c() called at lala.pl line 4
  $1 = 1
  (gdb) 

You'll need perl-debuginfo installed for this. In case you're running in mod_perl or some other embedded interpreter, replace my_perl with your perl interpreter instance.

Read more...

Tue 03 Feb 2009 04:16:40 PM CET

Stuck in Perl?

Just in case there's anyone else who's often in situation where he needs to fund out what is his (in better case) perl code doing, or has a core dump and has always been lazy to look into perl internals a bit -- you can get the file, line number and subroutine name from interpreter's Tcurcop structure (in 5.8.8, in 5.11 it seems to be Icurcop):

  (gdb) set print pretty on 
  (gdb) print *my_perl->Tcurcop
  $1 = {
    op_next = 0x9d8d8d8, 
    op_sibling = 0x9d8d9c0, 
    op_ppaddr = 0x5956d20 <Perl_pp_nextstate>, 
    op_targ = 0, 
    op_type = 174, 
    op_seq = 597, 
    op_flags = 1 '\001', 
    op_private = 0 '\0', 
    cop_label = 0x0, 
    cop_stashpv = 0x9d77020 "idle", 
    cop_file = 0x9d76ff0 "world-domination-script.pl", 
    cop_seq = 59, 
    cop_arybase = 0, 
    cop_line = 616, 
    cop_warnings = 0x0, 
    cop_io = 0x0
  }
  (gdb) 

See, we're on line 616 of world-domination-script.pl doing idle(). In case you've not been scared away by pp_caller() and you've found out how to get full stack trace as Carp does, please let me know :)

Read more...

Thu 29 Jan 2009 08:50:06 PM CET

Webcomic

A direct competition to today's nicu's webcomic strip.

Please note that I finally made some changes to the figures, so there's finally some originality. Also, please note that my drawing skills vastly improved.

http://v3.sk/~lkundrak/blog/images/rms.png

Read more...

Thu 29 Jan 2009 03:20:17 PM CET

Find largest tables in a SQL dump

Anyone comes up with an easier way to locate big tables in a SQL dump w/o loading it? Ouch, if only it was possible to add comments here. Anyways, here's the poor man's oneliner:

  $ (fold metadata.dump; echo 'CREATE TABLE') |cat -n |grep 'CREATE TABLE' |awk '{if (line) print 80*($1-line)"\t"table; line=$1; table=$4;}' |sort -rn |head
  3730560 `rr_xch_aaadst3nrgax96c`
  2418640 `rr_xcl_aaabsx1cobabj4b`
  1834560 `rr_xch_aaabsx1cobabj4b`
  1834480 `rr_xch_aaavsibqetaefyl`
  1834480 `rr_xch_aaausibqetaefyl`
  1834480 `rr_xch_aaarsibqetaefyl`
  1834480 `rr_xch_aaaqsibqetaefyl`
  1834480 `rr_xch_aaapsibqetaefyl`
  1834480 `rr_xch_aaakst3ocaax942`
  1834480 `rr_xch_aaakst3nrgax96c`
Read more...

Tue 20 Jan 2009 01:20:47 PM CET

Tunneler for Linux

Did you know a free SDL-based clone of Tunneler exists?

http://v3.sk/~lkundrak/blog/images/tunneler.png

Anyone wants to swap reviews? :)

Read more...

Tue 06 Jan 2009 08:40:00 AM CET

We're not racists...

...whe just don't want Roma, foreigners and people of different races to be our neighbors! Religion does not matter, as long as it's no Muslim or Jew. And we want no homosexuals. We probably don't want you to be our neighbor, especially if you have a health trouble that would qualify you as disabled.

This is the result of a poll recently taken in Slovakia. What I find interesting is the far right line in the chart, how does that make sense? Do neo-fascist hate even themselves?

And you see -- it's not just words, the intensity of attacks motivated = Seems by = racial = or = ethnical = hatred = is = increasing. Given SNS, a party that would easily be banned in other countries for being supportive of racial and ethnical hatred while openly sympathizing with World Word II pro-fascist government is them most infuential political party in Slovakia, this doesn't seems to be just an attitude of small amount of people that would qualify as extremists, but rather a natoin-wide attitude.

So for now, I'll refrain from going back to that country, and advise you to think twice before going there.

Read more...

Thu 01 Jan 2009 08:21:31 PM CET

Rage Against the Virtual Machine

VirtualBox OSE 2.1.0 was released, bringing support for 64-bit guests. Apart from that, it adds a {{vmnet}}-style packet injection for unprivileged user via a dedicated kernel module and a whole handful of features to its closed source brother.

So why would anyone use that? VirtualBox OSE brings a high-performance full virtualization to desktops of people whose hardware doesn't support KVM. Furthermore it equips them with a mature, stable, and easy to use user interface, who is in many areas still superior to virt-manager. In other words -- it saves them from VMWare, replacing it with a lightweight and fast package which is hardly 20-th of size.

http://v3.sk/~lkundrak/blog/images/virtualbox-tn.png

It was undoubtly a very demanded package for many Fedora users, thogh its kernel modules of questionable quality prevented it from entering Fedora. Please note that the word questionable does not necessarily mean bad, understand it as undecided, since there was no attempt to merge it with mainline kernel and therefore comply with kernel quality standards.

Packages for RPM Fusion being reviewed

Fedora does not permit kernel modules built outside of mainline tree, but RPM Fusion does. And finally it seems it will leave RPM Fusion's wishlist soonish: [//bugzilla.rpmfusion.org/show_bug.cgi?id=285 A review] was already submitted and taken by Xavier (thanks to him)!

Read more...

Thu 01 Jan 2009 03:49:58 PM CET

Finally -- A competition to Fedora webcomic

Increasing the number of good comic strips by redefining the meaning of the phrase bad comic: This one is dedicated to nicu, who thinks competition is allways a good thing!

http://v3.sk/~lkundrak/blog/images/accel.png

Original pictures are Copyrighted by nicu, distributed by Creative Commons' Attribution+Share-alike license (CC-BY-SA).

Read more...

Wed 31 Dec 2008 11:13:26 AM CET

Run Mosaic on your Fedora!

Packages of NCSA Mosaic patched to run on modern Linux desktop are available for download.

http://v3.sk/~lkundrak/mosaic/screenshots/mosaic-mag.png

They are patched so that they behave at least somehow sensible with today's sick web sites.

Hope they'll run with lesstif. The license is bad enough not to permit it to go to Fedora (thanks God!). If you think this should go to RPM Fusion for some reason, feel free to grab the packages :)

Read more...

Mon 29 Dec 2008 08:24:19 PM CET

New Fedora Webcomic

Found this while cleaning up my ~. It is from Brno FUDCon and it would indeed be a real pity if it got lost.

http://v3.sk/~lkundrak/blog/images/good-one.png

Read more...

Mon 29 Dec 2008 11:52:52 AM CET

Widelife

I've stumbled across a truly interesting group of people lately. Calling themselves Widelife CLUB, they define themselves as people, who

  ... love God, good music, action, McDonalds,
  table football, Fridays, our leader Tomas etc.

What strikes there is the mention of McDonald's there. Hope their deity is ok with devastation of rainforests, otherwise they may burn in beef fat.

Read more...

Mon 07 Apr 2008 09:56:07 AM CEST

OpenJDK in EPEL

I managed to bootstrap and import OpenJDK into Fedora Enterprise Linux Extras for Red Hat Enterprise Linux 5, and hopefully it will hit the repo soonish.

Read more...

Thu 27 Mar 2008 10:13:44 PM CET

BuildRoot Race

Ever noticed that one of most exemplary cases of insecure temporary files is the way we treat installation root when building packages?

Gentoo solved something like this some time ago, if I recall correctly. On the other hand, their problem was a bit more serious, building packages is the daily routine of Gentoo Linux administrators, chance that they'll have an untrusted local user is much bigger.

Read more...

Mon 17 Mar 2008 08:18:23 AM CET

Correct use of FORTIFY_SOURCE

After I found out that Fedora's OpenJDK-based Java is not compiled with -fstack-protector or -O2 FORTIFY_SOURCE=2 I was thinking about automatic way to check whether right%{_optflags} were passed to the compiler at the build.

Apart from forgetting to pass %{optflags} upstreams do forget to include <stdio.h> and <string.h> when using the potentially dangerous string manioulation functions, and then they're not fortified by being replaced with macros that utilize argument size checking.

Read more...

Thu 13 Mar 2008 08:21:11 PM CET

OpenGrok for Fedora

I played a bit with Fedora theme for OpenGrok this evening.

http://v3.sk/~lkundrak/blog/images/fedora-opengrok-1-tn.png

Read more...

Thu 13 Mar 2008 10:13:30 AM CET

Nearly stable OpenJDK for RHEL

Have RHEL, want Java and abhor the summplemental disc? Lilian and Thomas (and Sun :) did some cool thing for you: https://bugzilla.redhat.com/show_bug.cgi?id=433070. Now we want you to mangle it for EPEL somehow and smuggle it in!

Binaries at http://netbsd.sk/~lkundrak/openjdk-el5/ since I am officially not loved enough to have a bigger quota at Red Hat :) When things change it will land at people.redhat.com.

Read more...

Tue 11 Mar 2008 08:43:51 PM CET

New Galleries

So I am officially owner of the coolest web gallery. The package that generated it was approved for Fedora today, https://bugzilla.redhat.com/show_bug.cgi?id=xyz-gallery-review See it in action at http://v3.sk/~lkundrak/gallery/.

http://v3.sk/~lkundrak/blog/images/xyz-gallery-tn.png

Read more...

Mon 03 Mar 2008 06:41:49 PM CET

Got OpenGrok running on RHEL5

I made packages that are needed for running my beloved source browser on RHEL5 today. Mostly backporting stuff from Rawhide actually.

Be sure to grab java-1.5.0-ibm from Supplemental disc to run it. It also runs nicely with java-1.5.0-sun and java-1.6.0-sun, that were shipped in some preview update I believe.

Read more...

Fri 29 Feb 2008 09:42:49 PM CET

Running Fedora on IBM NetVista Thin Client

Contrary to popular belief, IBM NetVista Thin Clients can run recent 2.6 kernels. Though it need some effort and, well binary blob bootstrap loader, it is possible. All the hardware they contain is fairly well supported and givent the belief mentioned, their reputation is fairly wrecked and they can be gotten for very good prices, which makes an ideal toy out of them, or maybe a LTSP terminal.

Read more...

Wed 27 Feb 2008 11:45:59 AM CET

Gifts from FOSDEM

Today I got a black NetBSD T-shirt, a beastie pin and a "Powered by NetBSD" sticker from ones who love me so much, that they give me gifts.

Read more...

Wed 27 Feb 2008 11:45:59 AM CET

Running diskless Fedora via iSCSI

If you have a diskless machine and want it to boot and run your favourite distro over network, you have several options how to achieve it.

In my case the machine was a rather small one, with slow CPU and little RAM, therefore I could not run anaconda on it. NFS can not be swapped on, therefore I used a iSCSI target to swap on, and also placed the root filestem image on iSCSI.

This article describes how to create a filesystem image that can be used for network booting painlessly and how to boot it.

Read more...

Mail questions, comments and pizza to lkundrak@v3.sk