Search Results: "ag"

4 July 2008

Daniel Burrows: CWidget tutoral 1: 'Hello, world!'

Late last year, I spent some time disentangling aptitude's internal UI library and packaging it as a separate library, which I named cwidget. This article is the first in what will hopefully become a series describing the basic concepts and APIs of cwidget. It applies to the versions of cwidget currently available in Debian sid and lenny, 0.5.11-1 and 0.5.12-1. Autogenerated documentation of cwidget can be found here (but beware that as of this writing it is somewhat incomplete).
In this tutorial, I will walk through a simple program (hello.cc) that initializes cwidget, displays a simple message box, and then terminates the program when the user confirms the message. I assume a basic familiarity with C++. Screenshot of the 'Hello, World' program The first thing to do is to include the portions of cwidget that our program will use. Most importantly, we need the top level cwidget routines. These are the global routines that initialize cwidget, shut it down, and control its main loop (among other things).
#include <cwidget/toplevel.h>
cwidget comes with a collection of stock dialog boxes for things like displaying messages to the user. To access the routines that build these dialogs, we write:
#include <cwidget/dialogs.h>
All the symbols provided by the cwidget library are in the cwidget namespace. Using the full library name means that there's a reasonable chance that its names will not conflict with the names provided by other libraries; however, it's a real pain to type cwidget over and over. Since this is the only namespaced library we are using in this program, it's handy to define cw as an alias for cwidget:
namespace cw = cwidget;
Now we're ready to write the main routine. The first interaction of client code with the cwidget library is to initialize it. This will initialize the ncurses library and put the terminal into a mode suitable for a full-screen curses program.
cw::toplevel::init();
Next, we create a dialog box that will be displayed to the user. There are two things to note about this code:
  1. cwidget is Unicode-aware and the ok() routine expects the message string to be a wide-character string. In this case, that means that we need to pass in a wide-character string (indicated by typing L in front of the string).
  2. The second argument tells cwidget what to do when the ok button is pressed. The expression
      sigc::ptr_fun(cw::toplevel::exitmain);
    
    creates a slot using libsigc++. Briefly, a slot is a reference to a function or to a method of a class instance. When invoked, this particular slot will call cwidget::toplevel::exitmain(), which causes the main cwidget loop to exit. The slot is wrapped in cwidget::util::arg, a utility function that handles passing slots as optional arguments.
cw::widgets::widget_ref dialog =
    cw::dialogs::ok(L"Hello, world!",
                    cw::util::arg(sigc::ptr_fun(cw::toplevel::exitmain)));
Now that we have a widget, the next step is to arrange for it to appear on the terminal. In cwidget, control of the terminal is assigned to a single top-level widget: whatever it displays is what gets displayed on the terminal, and all user input is passed directly to it. In a real program this widget will typically manage a collection of sub-widgets and assign each one a screen region, but for now let's just display the dialog box we created:
cw::toplevel::settoplevel(dialog);
With everything initialized, we're ready to start the main loop. mainloop() will keep the display up-to-date and dispatch incoming events (for instance, keystrokes and mouse presses) until exitmain() is invoked.
cw::toplevel::mainloop();
When the user presses Enter or clicks on the Ok button in the dialog, exitmain() will be invoked by the binding that we set up earlier. Once this happens, we need to shut down cwidget in order to restore the terminal to its original state. If you skip this step, the terminal will be garbled and will not work properly when your program exits.
cw::toplevel::shutdown();
And that's it! To compile the program, change to the directory containing hello.cc and run:
$ g++ -o hello hello.cc $(pkg-config --cflags --libs cwidget)
Of course, you'll need to have the g++ and libcwidget-dev packages installed for this to work!

Jordi Mallach: Marc Belzunces' conscience objection fight

Yesterday, my friend Marc had to visit a court in Barcelona, after being accussed for an electoral penalty. Marc has always had a strong Catalan sentiment, and fights for the independence of his country from the French and Spanish states in as many ways he finds convenient. In this direction, he's been involved in countless activities promoting independence, in the Internet and in the streets. For now, he has to deal with living in the Spanish state, and recently this became a legal problem. Spain held parlamentary elections in March, and Marc was appointed to serve at one of the polling stations in Barcelona. Believing he had nothing to do with an election process to elect the Spanish parliament, he conciously refused to take his seat during that Sunday, infringing the Spanish electoral law. He presented his allegations to the officer, and refused to declare anything else. He now faces a fine ranging from 180 to 1800 or community work (which he would, again, object to perform). The officer told him that he's apparently the first Catalan to object like this, so what will happen next (besides he'll have to sit in court and see how it goes) is unprecedented. While Marc and I don't share many of our political views, I admire his dedication and his solid defence of his ideals. If I had been called to serve in a polling station last March, I would most probably have had my own personal debate on what to do, but suspect I would have ended going there to avoid creating these kind of situations, and would have had to participate in a process that I consider broken, unfair and undemocratic. I admire and support Marc for being stubborn enough to get this far. His case has had quite some echo in the Catalan blogsphere and some Catalan media like VilaWeb. Some people have started a campaign to collect money to help Marc pay the fine. The response so far has been surprisingly positive. Marc, molta sort i una abra ada!

Christian Perrier: postfix, quota, gridengine, smbind...

...are the last remaining packages before I am happy (or before someone adds a package with templates or adds templates to a package) udev, nut, flash-kernel, dtc, root-system are the additional missing ones before my German friends are happy. Your package is listed there? Make us happy, upload with translation fixes and win a beer at Debconf8 (or 9, or 10...). Your package is not listed there? Make us happy by NOT uploading with new or changed debconf templates without sending a call for translation update (hint: "man podebconf-report-po"). Anyway, this rush to 100% is much much more peaceful and easy than the same rush for Etch (where I think that French sustained 100% for about one week).

Robert Collins: 4 Jul 2008

Well, the gauntlet is down (BTW - desktop power integration. Cool!). The use case Ted talks about is actually quite interesting - we were at UDS last month, waiting on a SVN server that was apparently so slow we could have walked to it and copied stuff onto harddisk more quickly. (Really. No kidding). bzr was idling and blocked on network IO the whole time... kudos for the plugin Ted! For my response, may I present a new index format, (branch url) 70% smaller than bzr's current default, equally fast at most workloads, up to 20 times faster at others. I started this this week, and John jumped in in overlapping time periods, but I think it counts! Note that the perfromance wins are a component improvement - other things we haven't addressed yet can make the index improvements less visible. But several early adopters have told me that they see a 25-30% reduction in 'time bzr log > /dev/null' or other commands. To install: bzr branch http://bazaar.launchpad.net/~lifeless/+junk/bzr-index2 ~/.bazaar/plugins/index2 bzr branch https://bazaar.launchpad.net/~jameinel/+junk/pybloom ~/.bazaar/plugins/pybloom To use: cd <repository you want to experiment on> bzr upgrade --btree-plain (or --btree-rich-root for bzr-svn users). A version of this will be going to trunk soon, and it will be able to upgrade from any repository that you have that uses the plugin as long as you keep the plugin installed.

Alexis Sukrieh: One week of holydays

It’s been a looong time since I blogged here. Perhaps I should write more frequently so you won’t start thinking I died silently ;). I’m not dead. It’s just that I’ve started a company a couple of months ago and that does take a lot of my time. It’s pretty exciting, - as you can imagine - we’re using Debian everywhere and the team is great. I’ll write another blog-entry about that later. In the meanwhile, I’m on holydays for a week, and I plan to squash my TODO list:

Andrew Pollock: [life] It's official: I am married to the crazy cat lady

We currently have fifteen cats in the house. Only three of them are ours. When Sarah was contracting at Google, she started an informal, but company-endorsed trap/neuter/release program, because the basement of buildings 40-43 had a bit of a stray/feral cat infestation. Since she left Google, she's continued doing trappings on an on and off basis. She got a call a couple of days ago about a litter of kittens behind one of the other buildings, so she headed off last night with one of her crazy cat lady friends, and they proceeded to catch one of the kittens. She brought that home, and I went back with her, and the mother, which seems fairly feral, had been caught in a trap. The rest of the kittens seemed to have managed to secrete themselves away inside a generator behind the building. This morning, with some help from various facilities types, she managed to extract the other four kittens from the generator. So that put the mother plus five kittens in the spare room (in a large cage). At more or less the same time, Sarah got news of a litter of six kittens that need rescuing from down Gilroy way (some woman in a trailer park didn't seem to realise that boy cat + girl cat = kittens), so after grabbing the other four kittens this morning, she headed off to Gilroy to grab them. So the current plan is to get the mother cat of what we'll call the Google litter desexed on Tuesday and then release her back where she came from. Her five kittens are young enough (~8 weeks) that they can be socialised and won't be feral. The six Gilroy kittens are from non-feral parents, and are about 11 weeks old. All of the kittens are old enough to be desexed as well, but Sarah can't get them into Palo Alto Animal Services for desexing for a couple of weeks, so I suspect we're stuck with them in the interim, unless Sarah can find foster homes for them. To cap it off, we're going to Sacramento for the weekend, so we have to get one of our friends in the complex to take care of them all. The sad thing is the Gilroy Six seem to be in worse condition than the Google Five. They've got pretty poor coats, and seem to have some diarrhoea. Hopefully with a better diet they'll pick up. They're all very cute. The first one of the Google Five that Sarah caught last night is particularly cute. I expect Sarah will get some photos of them all up soon. If anyone is in the Bay Area is interested in a kitten, we've got them by the near-dozen.

3 July 2008

Russell Coker: New Dell Server

My Dell PowerEdge T105 server (as referenced in my previous post [1]) is now working. It has new memory (why replace just the broken DIMM when you can replace both) and a new BIOS (Dell released an “Urgent” update yesterday that fixes a problem with memory timing and Opteron CPUs). The BIOS update can be installed from a DOS executable (traditionally done from a floppy disk) or an i386 Linux executable. As I didn’t have a floppy drive in my new server I had to use Linux (not that I object to using Linux, but I’d rather have had the technician do it all for me). I used rescue mode from a Fedora 9 CD that was convenient, mounted a USB stick that I had used to store the BIOS update, and then ran it. The Dell service was quite good, on-site service and the problem was fixed approximately 27 hours after I called them. Replacing a couple of DIMMs is hardly a test of skill for the repair-man (unlike the time in Amsterdam when a Dell repair-man swapped a motherboard in a server with only 20 minutes of down-time). So I haven’t seen evidence of them doing anything really great, but getting someone on-site close to 24 hours after the report is quite decent, especially considering that I paid for the cheapest support that they offer. When I got it working I was a little surprised by the memory speed, I had hoped that a new 2GHz Opteron would perform similarly to an Intel E2160 and better than an old Pentium-D (see the results here [2]). Also the memtest86+ run took ages on the step of writing random numbers (I don’t recall ever seeing that step on previous runs, let alone having a system spend half an hour doing it). It seems that the CPU (Opteron 1212) doesn’t perform well for random number generation. In terms of actual operation all I’ve done so far is to install Debian. The process of installing Debian packages was quite fast (even with a RAID-1 reconstruction occurring at the same time) and the boot time is also very quick. The hard drive “rails” seemed a little flimsy. The way they attach to the drive is that they have screws that end in pins, so you screw them into plastic and the pins just sit in the holes in the drive where screws normally attach. I think that it would make more sense to have them not screw onto the plastic and instead screw onto the disk. Then if the plastic part that connects the two sides was to break it would still be usable. In fact they could just make the “rails” be separate rails as most other manufacturers do. One thing that surprised me was the lack of PS/2 keyboard and mouse ports. I had expected that such ports would last longer than serial ports and floppy drives. However my Dell has a power connector for a floppy drive and has a built-in serial port (with some BIOS support for management via a serial port - I have not investigated this because I always plan to use a keyboard and monitor). Of course I expect that most other machines will start shipping without PS/2 ports now and I will have to dispose of my stockpile of PS/2 keyboards and mouses. I generally like to keep a few on hand so that I can give friends and relatives a chance to try a selection and discover which type suits them the best. But I probably don’t need a dozen of them for that purpose. While a comment on my previous post noted that the floppy drive bay can be used for another disk, it seems that a disk is not going to fit in there easily. It looks like I might be able to install a disk there from the front if I unscrew the face-plate - but that’s more effort than I’m prepared to exert for testing the system (for production I will only have two disks). In terms of noise, the Dell seems considerably better than a NEC machine which was designed for desktop use. Of course it’s difficult to be certain as part of the noise is from hard disks and one of the disks I’ve installed in the Dell is a WD “Green” disk and the other may have newer technology to minimise noise. Also the mounting brackets for disks in a server may be better at damping vibrations than screwing a disk to the chassis of a desktop machine. Finally the NEC machine does seem to make more noise now than it used to, so maybe it would be best to compare after a few months use to allow for minor wear on the moving parts. One interesting feature is the Broadcom Gig-E port on the motherboard, it supports iSCSI as a boot protocol which is an interesting alternative to PXE, so if you have a server attached to a SAN via iSCSI you can use the same protocol for booting. There is a USB port inside the case (for permanently attached USB devices), however the USB boot option states that it is offering the option to boot from front USB ports - and it claims that no operating system is found on the USB stick that I use to boot my Thinkpad. The down-side is that the bnx2 module in the Debian/Etch kernel doesn’t seem to work with it. I want the machine to have three Ethernet ports, I have a two-port PCI card and if I can get the port on the motherboard to work then I’ll have enough. Otherwise I need to buy a PCIe Ethernet card (the machine only has one PCI slot). I ended up installing CentOS on the machine after the Debian/Etch Xen kernel started falling over on disk IO load (a problem I had seen on another Debian/Etch 64bit Xen machine). CentOS 5.1 supports the built-in Ethernet device, but didn’t work correctly with Xen (my DomU’s would just hang or abort). CentOS 5.2 is now working correctly.

Russell Coker: Shared Context and Blogging

One interesting aspect of the TED conference [1] is the fact that they only run one stream. There is one lecture hall with one presentation and everyone sees the same thing. This is considerably different to what seems to be the standard practice for Linux conferences (as implemented by LCA, OLS, and Linux Kongress) where there are three or more lecture halls with talks in progress at any time. At a Linux conference you might meet someone for lunch and start a conversation by asking “did you attend the lecture on X“, as there are more than two lecture halls the answer is most likely to be “no“, which then means that you have to describe the talk in question before talking about what you might really want to discuss (such as how a point made in the lecture in question might impact the work of the people you are talking two). In the not uncommon situation where there is an interesting implication of combining the work described in two lectures it might be necessary to summarise both lectures before describing the implication of combining the work. Now there are very good reasons for running multiple lecture rooms at Linux conferences. The range of topics is quite large and probably very few delegates will be interested in the majority of the talks. Usually the conference organisers attempt to schedule things to minimise the incidence of people missing talks that interest them, one common way of doing so is to have conference “streams”. Of course when you have for example a “networking” stream, a “security” stream, and a “virtualisation” stream then you will have problems when people are interested in the intersection of some of those areas (virtual servers do change things when you are working on network security). There seem some obvious comparisons between Planet installations (as aggregates of RSS feeds) and conferences (as aggregates of lectures). On Planet Debian [2] there has traditionally been a strong shared context with many blog posts referring to the same topics - where one person’s post has inspired others to write about similar topics. After some discussion (on blogs and by email) it was determined that there would be no policy for Planet Debian and that anyone who doesn’t want to read some of the content should filter the feed. Of course this means that the number of people who read (or at least skim) the entire feed will drop and therefore we lose the shared context. Planet Linux Australia [3] currently has a discussion about the issue of what types of content to aggregate. Michael Davies has just blogged a survey about what types of content to include [4]. I think it’s unfortunate that he decided to name the post after one blogger who’s feed is aggregated on that Planet as that will encourage votes on the specific posts written by that person rather than the general issue. But I think it’s much better to tailor a Planet to the interests of the people who read it than to include everything and encourage readers to read a sub-set. When similar issues were in discussion about Planet Debian I wrote about my ideas on the topic [5]. In summary I think that the Gentoo idea of having two Planet installations (one for the content which is most relevant and one for everything that is written by members) is a really good one. It’s also a good thing to have a semi-formal document about the type of content that is expected - this would be useful both for using a limited feed for people who go significantly off-topic and as a guideline for people who want to write posts that will be appreciated by the majority of the readers. Planet Ubuntu has a guideline, but it was not very formal last time I checked. Finally in regard to short posts, they generally don’t interest me much. If I want to get a list of hot URLs then I could go to any social media site to find some. I write a list post at most once a month, and I generally don’t include a URL in the list unless I have a comment to make about it. I always try to describe each page that I link to in enough detail that if the reader can’t view it then they at least have some idea of what it is about (no “this is cool” or “this sucks” links).

Christine Spang: Summer Conferences

The usual suspects apply: too expensive for me especially without a guarantee of sponsorship, etc. Maybe next year! It turns out that due to a weird collision of circumstances I am going to GUADEC, however. I will probably be doing more Istanbul-exploring than talk-attending, but I will certainly be around for evening socialization. I am also currently in Cambridge, UK, and will be here until mid-August. This is the summer of last-minute plans, apparently.

Wouter Verhelst: Review: Samsung YP-T10

About a month ago, I bought me a Samsung YP-T10 media player. I didn't want a device for which the Linux and/or Ogg Vorbis support was against the explicit wishes of the device's manufacturer, such as in the case of the iPod; because the more devices such manufacturers sell, the more they're encouraged to keep their systems closed. Definately not something I'd like to see. In that regard, the YP-T10 is pretty okayish. It supports Ogg Vorbis out of the box, and it has a reasonable set of features for a portable media player. It's not perfect, but it goes a long way. The set of features on the device is simply astonishing; apart from the obvious music playback stuff, it sports an FM radio, a text file reader, a voice recorder, a picture viewer, and a movie player. Given the size and clarity of the screen, this is actually a useful way to view a movie clip, too, although not a very comfortable one. Apart from the obvious USB cable, the device also has bluetooth connectivity which can be used to send and receive files, or to connect a bluetooth headset—especially interesting if you consider the modern stereo headphones that sound just like 'normal' headphones. Once you upgrade the firmware, the device gains the ability to play a few games, and to store vCard files. Very impressive, for such a small device. Unfortunately, not all is well. There's an RSS reader thingy on the device, which could be interesting; but it only works in companion with a Windows program, which obviously doesn't run on my (powerpc) laptop. There's only one way to charge the battery, and that's by connecting the device to a USB port. Unfortunately, that also means you cannot use the device while it's charging, since it switches to the MTP mode in which to receive files. That also goes for bluetooth, BTW -- if you're playing something, and the device receives bluetooth data, the playback is paused until receiving that data is finished. The USB cable is a nonstandard one. Given my track record of losing cables and stuff, I'm sure I'll get in trouble at some point. Hopefully Samsung will still sell those at that point. If not, well, I guess I'll see what happens then. Another point of this cable is that it's impossible to remove it from the device while the headphones are connected; you have to push a button which is physically placed in the direction of the headphone connector, about a millimeter away from it—not very interesting if I just want to connect the device to store one or two media files on there... The headphones that came with the device were not too bad, but the protective sleeves that came with it were too loose; after about a week or so, I'd lost both of them and had to buy me a new set of headphones. Luckily, that involves a simple standard headphone connector, so no problem there. All these are just minor annoyances, however. I don't really need an RSS reader, anyway. What really is a problem is the lack of tag support in Ogg files; while I can at least play them, the display will show 'Unknown' for artist, album, or title for any Ogg file—which is a real PITA. Altogether, however, I don't think the disadvantages of the device outweigh the advantages, and I've had quite some fun with it already. Having said that, given the lack of tag support in Ogg files, I don't feel I can really recommend it, at least not if you want to use it to play your Ogg Vorbis collection.

Ingo Juergensmann: UPS - it's always nice to have one!

After I arrived at home after work today I noticed that the machines at my parents home network were all down and just recovering from the outage. Two of my m68k autobuilders are located there. Nothing serious, I thought, because the machines are located behind DSL and maybe there was a short DSL outage.
Some minutes later I received two mails from my UPS that there was a power outage. Well, this explains the DSL outage as well, because the DSL is not attached to the USV (located in a different room).

Thu Jul 03 17:56:19 CEST 2008 Power is back. UPS running on mains.
Thu Jul 03 17:56:19 CEST 2008 Mains returned. No longer on UPS batteries.
Thu Jul 03 17:46:49 CEST 2008 Running on UPS batteries.
Thu Jul 03 17:46:43 CEST 2008 Power failure.


Ten minutes of power outage without machines being shutdown. It's a APC UPS BR800I with 3 machines (2x m68ks, 1x PIII@550), a SCSI hardware RAID with 7 disks and a 8 port switch hooked up to it. I'm really glad that I bought the UPS earlier this year - exactly for this purpose and to prevent filesystem errors on the buildds when there is a power outage. :-)

MJ Ray: End of LugRadio!

Just read on Farewell LUGRadio? [theangryangel] and Ashes to ashes, dust to dust... Lugradio is at an end [sungate] that the most famous UK Free Software podcast is ending at the end of this year. I don't know the reasons yet, but it seems a shame. I've been listening again since they proved me wrong and sorted out the dumb licensing terms so it's clearly legal to cut the shows up and only copy the bits that interest me, and Season 5 seems more interesting than previous ones. Then again, I enjoyed Red Dwarf VIII, so what do I know? (but VI and VII did drag a lot) Maybe I will go to Lugradio Live 2008 in Wolverhampton on 19-20 July now I know when it is! (Why is the date only as a large slow graphic on the event page? D'oh! (Yeah I know I should have emailed them, but I had an unfun experience with the show, so I'd rather shout this in public. Wow. I guess I'm still unhappy about them regressing to school playground name-calling.)) There are some suggested alternatives on theangryangel, but most are more Ubuntu-centric (which wasn't a good thing about LR), non-Ogg and/or non-European, so it looks like I'll give LinuxOutlaws a try. Any other recommendations?

Sami Haahtinen: Overcommit, your personal friendly salesperson

I just have to say it, memory management is utterly broken in Linux. Luckily it's not as broken as it used to be. Without going in to too much detail, there is a feature called overcommit in Linux. What this means is that it will over allocate memory to applications. At first thought it sounds insane. Why would one want to over allocate memory. It's like eating a cake and having it too. Well, there is a reason why this is done. If you think about resource allocation in general, there are a lot of places where this is being done successfully. For example ISPs always over sell their capacity because most of the users use a fraction of the resources allocated to them. That is why guaranteed capacity is so much more expensive, they literally allocate it for you (most of the times). So in a way memory management is like your friendly sales person from Linux corp. who is happy to sell what over you want because he needs the deal for his own bonus. So it is in fact reasonable to overcommit memory? Bzzt! Wrong! There are always problems with over allocating. ISPs, for example, monitor the usage of their resources and when certain limit is reached they get more resources. With memory it's not so easy, you have a finite amount of memory in your computer. Swap comes to the rescue to a certain degree, but it is critical for the applications to know their limits. If you have 1 MB of RAM available for the application let the application know. In most of the cases the application will crash because it doesn't know how to deal with the out of memory situation, but this is a side effect of the overcommit. Programmers don't run in to this kind of problems and they don't have to deal with them. So what happens when you hit the limit? In Linux there is this thing called oom-killer. oom-killer has just one purpose, to kill processes. While oom-killer has some clever heuristics built in to it, it will most likely end up killing the wrong program. So it's like a big game of core wars on your computer.
Generating locales...
  en_AU.UTF-8... done
  en_BW.UTF-8... done
  en_CA.UTF-8... done
  en_DK.UTF-8... /usr/sbin/locale-gen: line 238:  1971 Killed                  localedef $no_archive --magic=$GLIBC_MAGIC -i $input -c -f $charset $locale_alias $locale
failed
  en_GB.UTF-8... done
  en_HK.UTF-8... done
  ...
This is what happens on one of my hosts, there are not that many services running on this host and for some reason the right process gets killed. After turning overcommit off:
Generating locales...
  en_AU.UTF-8... up-to-date
  en_BW.UTF-8... up-to-date
  en_CA.UTF-8... up-to-date
  en_DK.UTF-8... done
  en_GB.UTF-8... done
  en_HK.UTF-8... done
  ...
Apparently locale generation is one of the things that is capable handling memory as it's supposed to be handled. So how do you turn off overcommit? Sysctl is the way! Easiest way is to add the following to /etc/sysctl.conf and running "/etc/init.d/procps.sh force-reload":
vm.overcommit_ratio = 100
vm.overcommit_memory = 2
The second line is the magic line which turns off overcommit. Insanely enough the other options are 0 (Default) and 1 (Always overcommit), which just doesn't make any sense. If the default is to do overcommit why would I want to set it to always overcommit. The first line defines the maximum amount of memory a program can allocate. This is explained better on a post on fedora-devel. Even with these changes, overcommit isn't completely disabled, but things are a lot better. While overcommit is built because it makes sense, it doesn't work. Lets hope things get even better in the future. Update: Arthur de Jong pointed out that in certain situations overcommit is needed, like when there is a large application running on a server that prevents further memory allocations (thus disabling remote access and so on). That is true, I'm not trying to say that overcommit isn't useful in some cases. I'm just saying that it's just a disaster waiting to happen, unless you have finetuned the environment just right.

Craig Sanders: Introduction to Linux Signals 101

or ^C doesn’t kill processes, SIGINT does On the LUV mailing list recently, the perils of tty handling when booting with “init=/bin/bash” came up, and somebody asked why running ‘ping’ (without remembering to run stty or openvt first) will result in you having to reboot. i.e. “why doesn’t ^C work in emergency mode”? I wrote a fairly detailed, but comprehensible to a novice, answer and a friend suggested i should have written it as a blog post - which was the point of me setting up a blog in the first place. So here’s a slightly edited version of it: > Couldn’t you just open another console, run “top” and find the PID for
> ping and kill it? Or ps aux grep ping and kill it? Is a reboot the
> only way to kill a ping where ^C is not available? there’s nothing special about ^C except that by long convention it is mapped to the interrupt signal aka intr aka SIGINT. So, ^C itself doesn’t kill a program, the fact that it generates an interrupt signal does. If you’ve rebooted for emergency maintenance (e.g. “init=/bin/bash” on the LILO or GRUB command line) then all you get is ONE instance of /bin/bash. Nothing else is running and nothing else has been run (because you’ve overriden the usual init with /bin/bash). No setup has been done on the terminal, and no other virtual terminals have been opened. The emergency environment is minimal (and deliberately so - you asked for it, you got it). It’s up to you to do whatever is needed to set up the environment so that you can do the required maintenance/repair work. So if you run ping *before* remembering to set up the terminal (’stty sane’) then ^C doesn’t work because ^C doesn’t generate SIGINT so there’s no way of telling ping to quit, and if you haven’t opened another virtual terminal with openvt (aka “open” - it got renamed some time ago) then there is no other shell available to run top or ps or kill. BTW, it’s not just ping. You’ll see the same problem in the same environment with ANY program that runs continuously until it gets a signal to terminate it. ping’s just the most obvious and common example. Most programs, especially simple programs like ping, don’t have a ^C handler. They don’t need one. They have a signal handler which, amongst other things, handles SIGINT however it’s generated - it can be generated by pressing ^C in a normal tty environment, or by sending the program a SIGINT (e.g. “kill -2″). That, BTW, is a core difference between a SIGTERM (just plain ‘kill’ or ‘kill -15′) and SIGKILL (’kill -9′). SIGTERM is usually handled by the program by setting up a signal handler for it, and it voluntarily terminates when it receives the signal (usually cleaning up, closing files, etc before it does so). If the program hasn’t set up a handler for SIGTERM then the default action is to just terminate. A program can set up a handler which does nothing on SIGTERM, which effectively just ignores the signal. SIGKILL is handled by the kernel and it just kills the process immediately - it can not be blocked or intercepted by the program. (By common convention, SIGHUP or ‘kill -1′ tells a long running daemon process to just reload it’s config files. It’s also generated when the tty that the program is running on is terminated - e.g. you log out or the modem hangs up or the ssh session dies, hence the name “HUP” aka “HANGUP”. That’s why you need to use something like nohup or screen if you want a program to continue running after you log out) In a way, ‘kill’ is a bit of a misnomer. It’s actually a generic tool for sending signals to running processes, but the default action for most of those signals is to terminate the program. Here’s a list of the signals which can be sent.
$ kill -l
 1) SIGHUP	 2) SIGINT	 3) SIGQUIT	 4) SIGILL
 5) SIGTRAP	 6) SIGABRT	 7) SIGBUS	 8) SIGFPE
 9) SIGKILL	10) SIGUSR1	11) SIGSEGV	12) SIGUSR2
13) SIGPIPE	14) SIGALRM	15) SIGTERM	16) SIGSTKFLT
17) SIGCHLD	18) SIGCONT	19) SIGSTOP	20) SIGTSTP
21) SIGTTIN	22) SIGTTOU	23) SIGURG	24) SIGXCPU
25) SIGXFSZ	26) SIGVTALRM	27) SIGPROF	28) SIGWINCH
29) SIGIO	30) SIGPWR	31) SIGSYS	34) SIGRTMIN
35) SIGRTMIN+1	36) SIGRTMIN+2	37) SIGRTMIN+3	38) SIGRTMIN+4
39) SIGRTMIN+5	40) SIGRTMIN+6	41) SIGRTMIN+7	42) SIGRTMIN+8
43) SIGRTMIN+9	44) SIGRTMIN+10	45) SIGRTMIN+11	46) SIGRTMIN+12
47) SIGRTMIN+13	48) SIGRTMIN+14	49) SIGRTMIN+15	50) SIGRTMAX-14
51) SIGRTMAX-13	52) SIGRTMAX-12	53) SIGRTMAX-11	54) SIGRTMAX-10
55) SIGRTMAX-9	56) SIGRTMAX-8	57) SIGRTMAX-7	58) SIGRTMAX-6
59) SIGRTMAX-5	60) SIGRTMAX-4	61) SIGRTMAX-3	62) SIGRTMAX-2
63) SIGRTMAX-1	64) SIGRTMAX
See the man pages for init(8), kill(1), and especially signal(7) for more info on this topic. Syndicated from Craig Sanders' Errata: Tech Notes and Miscellaneous Thoughts Introduction to Linux Signals 101

Biella Coleman: The Cultural Significance of Free Software

When it comes to research and writing, anthropologists are notorious for being slow as molasses. It takes, on average, 9 years to finish grad school and then another 3-6 years before you write and publish your first book. Such is the sometimes frustrating pace of academia. But sometimes it ...

Biella Coleman: Nerdson

A number of weeks ago, I asked for some help concerning good, geeky web comics and got some nice responses. While in Brazil, Pablo pointed me out to a home-grown strip, Nerdson. Makes me wonder about the other non-English geek comics out there.

Reinhard Tartler: ffmpeg-uploaded

Finally ffmpeg version 0.svn20080206-9 was uploaded to unstable and is currently waiting to get out of NEW . Special thanks go out to Fabian Greffrath, for testing, reviewing and pushing me, to L oc Minier, for his thoughts on the package renaming and handling of potential unstripped replacement packages and Darren Salt for his work on the debian/rules file. This upload is targeted lenny. Highlights of that upload include:
  • introduction of ffmpeg-doc 438369
  • build flavors (read more below)
  • renaming of the source package to ffmpeg-debian
  • DEB_BUILD_OPTIONS=noopt now compiles the package with -O0 (and works!)
  • ffmpeg-config has been removed. please port your packages to use pkg-config instead, cf. 487917 and 487922.
As for the build flavors: The debian/rules file was refactored so that flavors can easily be added. The flavors are architecture specific. All architectures support a static and a dynamic flavor. The following architectures support the following flavors:
  • i386: cmov (an i686 optimized flavor using the cmov instruction)
  • powerpc: altivec (requires G4 or better)
  • sparc: vis (uses v9 instructions)
If you are interested how we manage these build flavors, have a look at our debian/rules file. I remember that this was recently discussed on debian-devel at some point. Anyway, if you need/want additional flavors, please file wishlist bugs.

Andrew Pollock: [debian] Is autofs maintained upstream?

The current autofs package in Debian unstable has twenty-nine patches applied to it. The Ubuntu autofs package in Hardy Heron LTS has thirty patches applied to it (twenty-nine of them being the Debian ones). We discovered a bug today in Hardy's autofs, which will undoubtedly also affect Debian's autofs as well, which is apparently fixed in the likes of Red Hat Enterprise Linux for something like four years. So either Red Hat is doing a shoddy job of feeding patches back upstream, or upstream is doing a shoddy job of accepting them. The fact that Debian has to carry twenty-nine patches suggests something is similarly wrong in our camp. We've been finding various problems in autofs in our environment recently, and have accumulated maybe half a dozen patches or so in the last month. I'll have to make sure that they get fed back into Debian and Ubuntu at the very least. Given the nature of one of the bugs we found today, I have grave doubts about the code quality of autofs. I have to wonder if it's worth rewriting from scratch in Python or something.

2 July 2008

Romain Francoise: Musings on the FriendFeed API

I use the FriendFeed API (launched in March) to build the blog widget mentioned in my previous post, and I'm rather disappointed to see that the data it exports is not the same as the data FriendFeed shows on my profile page (which is collected from the various services linked to my account). The Flickr service data in particular has two problems:Annoying. Now, I can't think of a good technical reason that would prevent FriendFeed from exporting my data properly over their API. Are they doing this for anti-competitive purposes? It's weird. I'm a big fan of data aggregation, but not if it's lossy like that!

Jon Dowland: My site is (slowly) moving

I've decided to give my website a spring-clean. One of the things that is overdue a change is my domain name. You can find out more about the history of the "alcopop" name at /about/ if you are so inclined. I've been using it for a long time and haven't really thought about what people might presume about me from the name. Over the next few months, the site will be moving to the more neutral jmtd.net (my initials). From this point forward, any new content will go there only. This log will probably stay where it is for a while, however. I'm taking this opportunity to migrate to ikiwiki which is a really useful bit of software and has managed to scratch an itch that I thought nothing would quite manage.

Next.

Previous.