Search Results: "nate"

21 July 2011

Wouter Verhelst: On the beard, again...

It looks like I might actually lose it sooner than I was thinking in my previous blog post, a few days ago. On the 18th, Formateur Elio di Rupo had written a proposed document on which to start negotiations. Most parties agreed to that, except for N-VA and CD&V. Unfortunately, that was enough to make further negotiations useless, so di Rupo had offered his resignation as formateur to the King, who kept his response "under advisement". I thought I was going to end up like Andrew. Since he wasn't formally ex-formateur yet, however, he continued working. And today, merely a few days later, with an extra proposal and perhaps also partly due to the King's angry speech for today's national holiday CD&V has now been persuaded to join the negotiations. It's been over fourhundred days, and far too many weirdos, but they're actually sitting down to talk. Like, right now. I'll hold off on buying those razor blades for now, but we might yet get there.

Joachim Breitner: Copying HTML from gnome-terminal

One of the first things that I worked on here at DebConf11 is supporting the HTML target in gnome-terminal. This means that if you copy a part of the screen and paste it into some application that handles HTML (such as evolution or my blog s edit field), attributes such as color and boldness are preserved. Here are some examples: A man page
MAN(1)                           Manual pager utils                           MAN(1)
NAME
       man - an interface to the on-line reference manuals
SYNOPSIS
       man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m
       system[,...]] [-M path] [-S list] [-e extension] [-i -I] [--regex --wildcard]
       [--names-only]  [-a]  [-u]  [--no-subpages]  [-P  pager] [-r prompt] [-7] [-E
       encoding]   [--no-hyphenation]   [--no-justification]   [-p   string]    [-t]
       [-T[device]] [-H[browser]] [-X[dpi]] [-Z] [[section] page ...] ...
       man -k [apropos options] regexp ...
       man -K [-w -W] [-S list] [-i -I] [--regex] [section] term ...
       man -f [whatis options] page ...
       man  -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale]
       [-P pager] [-r prompt] [-7]  [-E  encoding]  [-p  string]  [-t]  [-T[device]]
       [-H[browser]] [-X[dpi]] [-Z] file ...
       man -w -W [-C file] [-d] [-D] page ...
       man -c [-C file] [-d] [-D] page ...
       man [-hV]
DESCRIPTION
       man is the system's manual pager. Each page argument given to man is normally
       the name of a program, utility or function.  The manual page associated  with
       each  of these arguments is then found and displayed. A section, if provided,
 Manual page man(1) line 1 (press h for help or q to quit)
A coloured diff from git
commit 55c514ae6a714abcfa818c33f00a2c051412c3d9
Author: Joachim Breitner <mail@joachim-breitner.de>
Date:   Thu Jul 21 12:08:56 2011 +0200
    Refactor vte_terminal_determine_colors_internal
    
    to work on VteCellAttr instead of VteCell, and use it in
    vte_terminal_cellattr_to_html.
diff --git a/src/vte.c b/src/vte.c
index 8bcc95d..7d4a6f1 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -6532,19 +6532,18 @@ swap (guint *a, guint *b)
 
 static void
 vte_terminal_determine_colors_internal(VteTerminal *terminal,
-                                      const VteCell *cell,
+                                      const VteCellAttr *attr,
                                       gboolean selected,
                                       gboolean cursor,
                                       guint *pfore, guint *pback)
  
        guint fore, back;
Midnight commander
  Links     Datei     Befehl     Optionen     Rechts
 <  ~/build/gnome-terminal/vte  .[^]> <  ~/build/gnome-terminal/vte  .[^]> 
 'n        Name            Gr e  Modifikations 'n         Name            Gr e  Modifikations 
 /..                      BERVZ. 20. Jul 18:23 /..                       BERVZ. 20. Jul 18:23 
 /.git                       4096 22. Jul 12:42 /.git                        4096 22. Jul 12:42 
 /autom4te.cache             4096 22. Jul 11:20 /autom4te.cache              4096 22. Jul 11:20 
 /doc                        4096 22. Jul 11:20 /doc                         4096 22. Jul 11:20 
 /glade                      4096 22. Jul 11:20 /glade                       4096 22. Jul 11:20 
 /gnome-pty-helper           4096 22. Jul 09:47 /gnome-pty-helper            4096 22. Jul 09:47 
 /perf                       4096 22. Jul 11:20 /perf                        4096 22. Jul 11:20 
 /po                         4096 22. Jul 11:20 /po                          4096 22. Jul 11:20 
 /src                       12288 22. Jul 12:41 /src                        12288 22. Jul 12:41 
 /termcaps                   4096 22. Jul 11:20 /termcaps                    4096 22. Jul 11:20 
  .gitignore                  935 22. Jul 11:20  .gitignore                   935 22. Jul 11:20 
  AUTHORS                      41 20. Jul 18:25  AUTHORS                       41 20. Jul 18:25 
  COPYING                   35068 22. Jul 11:11  COPYING                    35068 22. Jul 11:11 
  ChangeLog.pre-git        433051 20. Jul 18:25  ChangeLog.pre-git         433051 20. Jul 18:25 
  HACKING                     905 20. Jul 18:25  HACKING                      905 20. Jul 18:25 
  MAINTAINERS                 118 20. Jul 18:25  MAINTAINERS                  118 20. Jul 18:25 
  Makefile                  30512 22. Jul 11:20  Makefile                   30512 22. Jul 11:20 
  Makefile.am                1247 22. Jul 11:11  Makefile.am                 1247 22. Jul 11:11 
  Makefile.in               28812 22. Jul 11:20  Makefile.in                28812 22. Jul 11:20 
  NEWS                      43910 20. Jul 18:25  NEWS                       43910 20. Jul 18:25 
  README                      496 20. Jul 18:25  README                       496 20. Jul 18:25 
  aclocal.m4               377874 22. Jul 11:20  aclocal.m4                377874 22. Jul 11:20 
 *autogen.sh                  610 20. Jul 18:25 *autogen.sh                   610 20. Jul 18:25 
 
 BERVZ.                                        BERVZ.                                         
  10G/104G (9%)   10G/104G (9%)  
Hint: To look at the output of a command in the viewer, use M-!
~/build/gnome-terminal/vte $
 1Hilfe   2Men     3Ansicht  4Bear~ten 5Kopieren 6Ver~ben 7Mkdir    8L schen  9Men s   10Beenden
These changes are discussed in GNOME Bugzilla bug #365121 and can be downloaded in my git repository. Unfortunately, I later found out that I was not basing my work on the current development version, which has changed considerably, so we will see how and when my changes will actually make it into GNOME. Also note that my blog s HTML editor actually modifies the HTML code, so looking at the source of this page does not give you the code that I generate. Update: I ported my changes onto the vte-next branch, so they could be merged now. Please follow the bug report if you want to know more.

Flattr this post

Rapha&#235;l Hertzog: People behind Debian: Martin Michlmayr, former Debian Project Leader

Martin Michlmayr is a Debian developer since 2000 and I share quite a few things with him, starting with his age and involvement in the quality assurance team. He managed to be elected Debian Project Leader in 2003 and 2004. He s no longer as active as he used to be but his input is always very valuable and he continues to do very interesting things in particular concerning the support of NAS devices. Read on for the details. Raphael: Who are you? Martin: I m Martin Michlmayr. I m 32, originally from Austria, and currently living in the UK. I ve contributed to various free software projects over the years but Debian is without doubt the one I m most passionate about. I joined Debian in 2000 when I was a student. I worked on Debian more or less full time for a few years while I was pretending to study. Later I started a PhD to do research about quality and management aspects of volunteer free software projects. I investigated the release process in several free software projects, in particular looking at time-based releases. After finishing my PhD in 2007, I joined Hewlett-Packard. I m part of HP s Open Source Program Office and work on various free software and open source activities, both internally and within the community. Raphael: How did you start contributing to Debian? Martin: I first used Debian in the days of 0.93R6, some time around the end of 1995. The 0.93R6 release was still based on a.out but I needed an ELF-based system for some application, so I moved to Slackware. I then quickly moved to Red Hat Linux where I stayed for several years. I rediscovered Debian in 2000 and quickly decided to join the project. I cannot recall how I rediscovered Debian but when I did, it was clear to me that Debian was the ideal project for me: I could identify with its philosophy, I liked the volunteer nature of the project, and I found the size and diversity of Debian interesting since a large project offers a lot of different challenges and opportunities. I remember how many new things there were to learn and back then the documentation and other resources for new contributors were nowhere as good as they are today. My application manager, Julian Gilbey, was a great help he was incredibly friendly and passionate about Debian. I also remember meeting up with Peter Palfrader (weasel) for key signing when we were both in the New Maintainer queue. I was incredibly lucky with my New Maintainer process and soon became an official Debian Developer. Because there was a shortage of application managers, my first major contribution in Debian was to become an application manager myself and help other people join the project. Debian is a large project with a long history and a rich culture, so new contributors should expect that it will take some time to become familiar with everything. Fortunately, there are many resources, such as documentation and the debian-mentors list, for new contributors. Another great way to become familiar with the way things are done in Debian is to subscribe to various Debian mailing lists and ideally to read some mailing list archives. It s also a great idea to attend the Debian Conference or other conferences since meeting people in real life is a great way to integrate. I remember attending Debian Conference 1 in Bordeaux where I gave my first public talk. Finally, new contributors should find an area where they can make a unique contribution. Most people in Debian maintain packages but there are so many other ways to contribute. For example, most of my contributions were not technical but were about coordination and other organizational activities. Raphael: What s your biggest achievement within Debian? Martin: I m particularly proud of a number of achievements: Raphael: Speaking about NAS devices: what exactly are you doing on this topic and how can people help? Martin: There are plenty of instructions on the Internet to install Linux distributions on NAS or various embedded devices by connecting a serial console and then typing in hundreds of commands. What I found is that such instructions significantly limit the user base because they are way too complicated for most users. There are just too many steps that can go wrong. So instead, in Debian, we provide a solution that just works: usually, you download a firmware image for your NAS device from Debian and when you upgrade you get the Debian installer. You connect to the installer via SSH and perform a normal installation. The installer knows about the device and will prepare everything for you automatically for example, it knows if the device has requirements for the partition layout and it will install the kernel where the device expects to find it; unfortunately, NAS devices are not like PCs, so the requirements are different for almost every device and therefore you need special code to support a new device. Finally, there are detailed installation guides and we provide help on our mailing lists. There are a number of technical areas for improvement. The installation could be made even easier, and it would be nice to support new platforms and devices. A bigger problem is that while we ve implemented a great solution for NAS devices, we haven t really extended this work to support other classes of devices. For example, tablets and mobile phones are getting incredibly popular and we don t have a compelling solution for such devices, mostly because of the lack of an appropriate GUI. Raphael: What are your plans for Debian Wheezy? Martin: I ve recently been asked by Stefano Zacchiroli, our current Debian Project Leader, to coordinate the care-taking of Debian finances. Debian, as a volunteer project, relies on donations and in-kind gifts (e.g. hardware) to maintain its infrastructure and to support various development efforts, such as funding sprints and other developer gatherings. Debian s money and other assets are held by affiliate organizations around the world. My responsibility will be to keep track of money and other assets (e.g. hardware and trademarks), work with the DPL to establish procedures related to the use of Debian s assets, and make sure that the procedures are followed. Finally, we want to publish public statements so our donors know how we use their donations to further improve Debian. I just started working on this and this will be my main activity in Debian in the coming months. Raphael: Speaking of money, I plan to run a fundraising to get the Debian book I wrote with Roland Mas translated (cf. http://debian-handbook.info). Is this something Debian should support? Martin: First of all, I should make it clear that I don t decide how Debian spends its money. This is up to the DPL to decide together with the project at a whole. I ll just make sure that procedures are followed and expenses tracked and reported properly. Having said that, in my opinion, it s unlikely that Debian as a project will fund this effort. It would be inconsistent with the position of the project not to fund work directly (only some related expenses, such as travel costs to allow Debian teams to organize face-to-face meetings). Whether Debian should support the fundraising effort by helping to promote it is another question and that s probably not as clear cut. It looks like a worthwhile effort, but on the other hand it would be unfair for authors of other Debian books for Debian to put its weight behind one and there are many other efforts that are worth promoting if you promote one, where do you stop? So while it sounds worthwhile, it s probably better for Debian to stay out of it. But somehow related to this, I sometimes worry about the fact that there are so few paid opportunities around Debian. If you contribute to the Linux kernel for a while, you have an excellent chance to get hired by someone and to work on the kernel full time. The kernel may be an extreme example but there are a lot of projects that have more paid opportunities than Debian, e.g. Mono, GNOME, OpenOffice/LibreOffice and KDE. Obviously, there are some Debian Developers who can spend some time on Debian as part of their job. I know that some Canonical employees contribute to Debian, that support companies like credativ improve Debian as part of their work, and that system administrators fix bugs or package new software as they deploy Debian. But I think this is a minority of contributors and even they don t work full time on Debian. Instead what I see is that a lot of people leave university, get a job and then no longer have time for Debian or people start a family and no longer have time. I can take myself as an example since I don t have nearly as much time as I did in the past when I was a student. I guess there are different ways to deal with this problem one would be to create more paid opportunities around Debian outside the project, another one might be to make it easier for new volunteers to join the project. I don t have the answers to these questions but it s something I wonder about, and I also wonder whether pure volunteer projects can still keep up with projects with a lot of full time contributors. Raphael: What motivates you to continue to contribute year after year? Martin: Debian is a great project with a great mission, goals and people. I contribute to make Debian a better solution and to promote the free software philosophy. Finally, the community around Debian provides a lot of motivation. It s amazing how much I ve learned about other cultures because of my involvement in Debian and how many friends I ve made over the years all around the world. Raphael: Do you have wishes for Debian Wheezy? Martin: Not really. I m pretty happy with the way things are going at the moment. We have made a lot of organizational changes in the last few years from which the project has greatly benefited. I m particularly pleased about the plans to adopt a time-based freeze. Raphael: Is there someone in Debian that you admire for their contributions? Martin: There are many people I admire greatly. I d like to mention Joey Hess because he s a great example to follow. He doesn t get involved in politics, is easy to work with and does great technical work. In fact, he has made not one but several contributions that have completely changed Debian (debconf, debhelper, and debian-installer). Furthermore, Debian has a lot of contributors who have done great work over the years but who are not very vocal about it. People like Colin Watson or Peter Palfrader. Debian has many unique contributors and the list of people I admire is much longer than the few people I just mentioned.
Thank you to Martin for the time spent answering my questions. I hope you enjoyed reading his answers as I did. He raised some interesting questions. Subscribe to my newsletter to get my monthly summary of the Debian/Ubuntu news and to not miss further interviews. You can also follow along on Identi.ca, Twitter and Facebook.

No comment Liked this article? Click here. My blog is Flattr-enabled.

20 July 2011

Andrew Pollock: [life/americania] 4th of July in the Grand Canyon

Our adventurous friends Eric and Katie had invited us to join them on a hike in the Grand Canyon over the 4th of July weekend. As this struck us as something we'd never have considered doing otherwise, we thought we'd accept their kind offer. We're so glad we did. It was quite a bit of traveling just to get there. We flew out of San Jose on Thursday night, got into Las Vegas, rented a car, and then drove to Peach Springs, Arizona, where we stayed the night. We didn't get in at the Grand Canyon Caverns Inn until around midnight, and we had to get up again for a 5:00am departure (I think we actually got away by more like 5:30am), to drive to the Hualapai Hilltop, where the trail head was. Zoe handled all of this very well. She didn't end up falling asleep in the car until about 10:30pm I think, and dealt with the transfer out of the car at midnight very well and went back to sleep. The drive to the Hualapai Hilltop, along Indian Road 18, took about an hour. We had to dodge a bit of livestock on the road. The road itself was sealed and of good quality. We remarked on the way back out that as soon as you left the Havasupai Reservation and entered the Hualapai Reservation that there was a distinct degradation in the quality of the road. We parked at the Hilltop, and got ourselves organised, and commenced our descent by about 7:10am. The first 1.5 miles was very steep. There were a bunch of switchbacks and there was a fair few people coming up the other way already. There were also a few mule trains coming in the opposite direction that we had to dodge. The mule trains have right of way, so we had to stop and get out of the way to let them pass. Zoe thought they were pretty cool because they invariably had a few dogs with them as well, and she thinks dogs are awesome. The remaining 6.5 miles (it was an 8 mile/13 kilometre hike in total) were fairly easy. There was a lot of variety in terrain. Rocks, sand, dirt. It wasn't all in the sun, which was made it more comfortable. Heat wise, I think it was in the high 30's Celsius, with pretty much no humidity, so it didn't feel too uncomfortable. Towards the end, as we got near the water, there was a distinct change in the canyon. There was more greenery, and we started hearing insects and seeing bird life. When we first saw the water, it was hard not to just jump in, it looked so inviting. The total hiking time was about 4 hours 45 minutes, which included a reasonable stop to give Zoe some breakfast. We arrived in the village at around midday. Unfortunately the lodge wasn't ready for check ins until 1pm, so we had to twiddle our thumbs for a little bit. Zoe handled the hike incredibly well. We used a Macpac Possum child carrier that Nigel had passed down to us, and she didn't complain the whole time. She even took a nap in it. We were very relieved that it wasn't a problem for her. Sarah carried her, and I carried everything else. (I'm so glad I didn't see the photo of how I looked until well afterwards). In hindsight we probably brought too much stuff, but we didn't really know what to expect down there, so we'd rather have too much than too little. The village completely exceeded my expectations. I had this (silly) mental picture of it being just the lodge and not much else, but somewhere between 450 and 700 people live in the village. It had two general-type stores, a cafe that was pretty much like a fast food/takeaway place, an elementary school, and some sort of basic medical clinic. There was also a small general purpose community centre of some sort. The main store had pretty much everything you'd need in the food department. The cafe frequently ran out of various different things, but you weren't going to go hungry. For the remainder of Friday, we just stayed put in the village and let Zoe stretch her legs. Eric and Katie and their kids explored the first set of falls down from the village, unofficially named Rock Falls. On Saturday, we all hiked down to Havasu Falls. We met a couple of other families (amusingly both from the Bay Area) along the way, so we had some interesting conversations. I have no idea how long the hike was. Havasu Falls was impressive. Quite tall and narrow at the top, and quite loud. Zoe was impressed. We took her for a bit of a swim in the pools in the bottom. We had lunch there, and then Zoe and Sarah stayed there (Zoe took a nap in the KinderKot (also courtesy of Nigel) in the shade by the falls, and I took the Macpac with a water bladder in it to refill it at the spring in the campground, which was further down stream, and to check out Mooney Falls with Eric and Katie (and their kids), which was further downstream again from the campground. Mooney Falls was pretty insane. A lot taller than Havasu Falls, and a lot more treacherous to get to the bottom of. Parts of it were vertical. Chains and rickety ladders were involved. Caves were involved. I'm so glad I didn't have Zoe in the Macpac, because on multiple occasions, the top of it got bashed into rocks, so without having Sarah with me also to act as a guide, there's no way I could have safely descended with Zoe in the backpack. My favourite photo illustrating how crazy this was is this one that I took of Eric and Katie. This photo highlights some of the craziness involved to get down. I pretty much got to the bottom, had a quick look around and left Eric and Katie to it, because I figured Zoe would have woken up by now, and was probably bored. Turned out I had all of the sunscreen with me as well. So I climbed back up, and trekked back to the campground, refilled at the spring, and headed back up to Havasu Falls. After we reunited, we then hiked back up to the village, which to be honest, was the hardest bit of hiking we did. I was carrying Zoe in the Macpac, and it was hot, and it was mostly loose sand all the way. We were very glad to get back to the village. Zoe started showing signs of coming down with a cold and a cough, so we decided to cut short our stay in the village and leave on Sunday instead of Monday. We'd been tossing up between getting a helicopter or horses out. We ended up opting for the helicopter after learning that the horses still took about 3.5 hours, and you basically had no control over the animal. We were dubious as to how Zoe would go being bounced around on the back of a horse for that long. The helicopter ride also took all of about 5 minutes. The tribal members get first dibs on the helicopter, and there had been a death in the village, and I think a lot of people had come to the village for the viewing (the casket itself was flown out earlier on Sunday morning for a burial out of the village), so I suspect there was a higher number of tribal passengers than usual. We didn't get out until 2pm. Again, Zoe was incredibly good. She just hung out with us while we waiting for a flight out. There were plenty of dogs for her to be entertained by, and some other kids. She also took a pretty decent nap. So we finally got out, and got back to our car, and then the heavens opened. It absolutely poured down with rain. Sarah was keen to check out Hoover Dam, so we decided to stay near Boulder City in Nevada, and got a suite in the Hacienda Hotel and Casino for cheap. The next day was the Monday public holiday for Independence Day, and we were tossing up whether or not to take Zoe to a doctor to get her checked to see if she had bronchitis (we've been a bit gun-shy about bronchitis since the time she came down with it when we were in Australia). She ended up falling asleep in the car while we were hunting around for an Urgent Care facility that was open, so we decided to let her sleep and drove to Las Vegas. After she woke up, we took her to see the flamingos at Flamingo and the lions at MGM Grand. Zoe absolutely loved all the lights, sights and sounds of Las Vegas. In the afternoon, we took her to a doctor, and got the "first child, huh?" from the doctor (she didn't have bronchitis). After that, we went and briefly checked out Hoover Dam (just walked half way across the bridge in front of it and walked across the dam itself). The following day, we packed up and spent the morning on the Las Vegas strip again. This time we went to the Venetian (Zoe thought the gondolas were pretty cool) and then we flew out in the afternoon. So it was a lovely little family vacation. We ended up spending about as much time in Las Vegas as we did in the Grand Canyon, but that was okay. I'd really like to go back to Supai again, but I'm not sure if the stars will align themselves appropriately. If we did, knowing what I know now, I'd take a lot less food and put all of the luggage on a horse, and just hike in with the minimum of stuff. I'd probably be game to hike out as well if the bulk of the luggage was on a horse. Photos from the trip are here.

Lior Kaplan: Linux 20th anniversary T-shirts

I m organizing August Penguin, the yearly free software / open source conference in Israel for and by the community. We celebrate the 10th time we re holding this conference. I started going to these conferences just after high school, later I got more and more involved and now this is my 2nd year of being the main organizer (with a few others who provide great help). To celebrate the Linux 20th anniversary and August Penguins 10th anniversary, I thought to print copies of the Linux 20th anniversary T-shirts. I tired to contact the Linux Foundation to coordinate this, but got no response. I m writing this post to ask for help with finding the people who can approve this printing in behalf of the Linux Foundation. For those who can read Hebrew, the conference schedule is available at Hamakor s wiki. The rest are welcome to read the English version (provided by Google translate, so not totally accurate).
Filed under: Israeli Community

19 July 2011

Olivier Berger: Migrating mail from Evolution local storage to Evolution + local Imap (dovecot with Maildir) 1/X

I ve been fed up with Evolution being so buggy and slow, which was making managing my mail ever more painful as time passes. Still, one of the advantages of Evolution over other MUAs is the vfolders feature, which I ve been using intensively for years. Would there be some alternate way of managing my mail ? I ve been reading about notmuch s progress in becoming a very powerful mail management / retrieval tool (it could very well replace the vfolder feature of Evolution), but unfortunately, it is not (yet) integrated with Evolution. Others have documented their mail setup, and it seems that I could achieve a middle ground solution by migrating all my mail folders, currently stored inside Evolution s local storage, into Maildir folders managed by a local dovecot IMAP server. Evolution would still be my MUA, but it would store my mail inside Maildirs through dovecot. I ve been told that Evolution may be less buggy with IMAP than with local folders, which could solve my main annoyances. Also, it would make it possible to index mail with notmuch, as it supports the Maildir storage format. I ve then decided to take the opportunity of a holiday period to start the migration attempt. I ll document it in another post.

18 July 2011

Rapha&#235;l Hertzog: Deciphering one of dpkg s weirdest errors: unable to open /path/to/foo.dpkg-new

We already studied one weird error of dpkg, let s do another one:
Unpacking replacement libexo-common ...
dpkg: error processing /var/cache/apt/archives/libexo-common_0.6.1-1_all.deb (--unpack):
 unable to open '/usr/share/doc/exo/html/C/images/exo-preferred-applications-internet.png.dpkg-new': No such file or directory
Rather difficult to understand on the first look right? Let s see in detail what s usually happening when you get this error. The first hint comes from the file extension .dpkg-new . This extension is used by dpkg to unpack the updated files near the old files. When everything has been unpacked, they are renamed over the old files. The failure happens precisely when dpkg tries to rename the file (in fact when it tries to fsync() it before the rename) but why does it fail? Usually because there are unexpected symlinks (or bind mounts) involved that resulted in two different files being installed in the same directory. For example consider package that provides /dir1/a-file and /dir2/a-file. Now imagine that on the target system, /dir1 is a real directory but /dir2 is a symbolic link that points to /dir1. When dpkg processes /dir1/a-file.dpkg-new everything is fine, but when it tries to process /dir2/a-file.dpkg-new it will fail because that file is the same than /dir1/a-file.dpkg-new which has already been renamed. Diagnosing further the problem requires to understand why there s a symlink instead of a real directory. It might be two packages that were badly coordinated, or a problem in the package itself because it lacks some code that drops the symlink in the preinst (so that dpkg installs the real directory instead of keeping the symlink). There might be variations in the way two files end up sharing the same directory, but this simple example should have clarified the nature of the underlying problem.
Subscribe to this blog by RSS, by email or on Facebook.

No comment Liked this article? Click here. My blog is Flattr-enabled.

Benjamin Mako Hill: Die Technikmafia

Marcus Rohwetter has recently published a very detailed article about Antifeatures in the German monthly magazine Zeit Wissen. Although I've only read the article through automatic translation -- unfortunately, I don't read German -- I'm hugely honored that Rohwetter has taken the time to engage with the idea so deeply and to help translate the argument for a much broader community than the free software community I come from and am best able to speak to. A lot of what I've been trying to do in the last year or so is to figure out how to speak more effectively about the politics of technology control to audiences of non-technologists. Indeed, that's the whole point of the antifeatures concept. I deeply appreciate the help of Rohwetter, and others, in that project.

17 July 2011

Daniel Baumann: Debian Live Autobuilds

Right now I am sitting in the train to the airport for going to DebCamp/DebConf 11 in Banja Luka, Bosnia and Herzegovina. During DebCamp amongst other things I am going to work on finishing up the last bits on getting daily/weekly Debian Live autobuilds back for wheezy. This spring Jimmy Kaplowitz offered to help with the task of overseeing the debian-live autobuilder and to coordinate necessary bits with cdimage.debian.org. Having them on cdimage.d.o became recently possible as Steve McIntyre offered to make a VM available for us (live-build requires root privileges, and naturally, you would not want to let that run on the host system itself, that is why in the past it was not possible to build them on cdimage.d.o). The remaining issues are, and this is why the autobuilds are not yet back since spring, that live-build still needs two things: a couple of tweeks for wheezy, and the autobuild stuff need to be properly integrated into live-build itself. That will happen as an additional binary package live-build-cron with a bunch of debconf questions, so that everyone and his dog can setup a debian-live autobuild server on his own machine. The initial upload (which will not yet work, do not bother to try) was uploaded to experimental this week and cleared the new queue, now looking forward to get this all finished up and resulting in a live-build uploaded to unstable by the end of the week. In the second week, Jimmy arrives, I will be introducing him to live-build and the various little things to watch for and hopefully manage to persuade him to take over the autobuilds maintenance. Having all images that are based on packages solely from the stable/testing/unstable archives moved to cdimage.d.o is freeing up ressources on live.debian.net which did the job in the past since etch. Ben Armstrong volunteered to help with overseeing the live.d.n instance of live-build-cron that will build more then once per day images for si, with the only difference that they will not use live-* from the archive but the latest snapshots from our git snapshots repository. This will be a big help for the development as eventually we will be autotesting these images for various things. Last but not least, thanks to both Jimmy and Ben for all your kindness, patience and help with this during the last couple of months. We have interesting times ahead.

16 July 2011

Steve Kemp: There is a reason why I test sites

Recently I was at a pub and there was an advert for pub tokens displayed on the window. Seemed like a cute idea: Perfect for friends, family, remote hackers/developers & similar. When I got home I checked out their site. Seemed simple and nice enough, with good coverage (in terms of local drinking establishments that would accept their tokens). I decided to sign up, with the intention of gifting my sister with some delicious beer. Unfortunately that's where it all went wrong. I tend to act the same on all new sites. Partly to amuse myself, partly to get a feel for how safe/secure/good the site is, I'll try to login with a few different values. You know you're in trouble when you see responses like this:
SELECT * FROM cms_module_pubtokens_users where email = '"'' AND
   password =''"' LIMIT 1
Fatal error: Call to a member function FetchRow() on a non-object in
  /home/pubtokens/U79P18WQ/htdocs/includes/functions.php on line 291
Suffice it to say I sent them an email, then poked them on twitter, but to no avail. In conclusion they don't get my money, and I couldn't recommend them to anybody else at this point either. As I'm not a customer at least I can rest easy knowing my details haven't been compromised at any point over the past few months. ObQuote: "It can't rain all the time" - The Crow

14 July 2011

Asheesh Laroia: Open Source Bridge 2011: they love me (and gave me a scarf)!

On Friday, June 24, the last day of Open Source Bridge, I won a scarf! It says, "Open Source Citizen." I wasn't the only one. The attendees nominated people who "made an extra effort to help others and share their knowledge," and the conference committee chose the three people they felt exemplified this. The winners were Sumana Harihareswara, Igal Koshevoy, and me. In case you don't know Sumana, she's the new Wikimedia Volunteer Development Coordinator, a friend, and a commenter here at Asheeshworld. In the photo of her and her new scarf, you can also see Ward Cunningham. I suggest reading her wrap-up about the conference, and checking out the notes from her talk. I haven't met Igal, but I've learned he's a fixture of the Portland tech scene. He's user number one on opensourcebridge.org and one of the original contributors to calagator, the most important event calendar in the Portland tech world. That's just a brief summary; follow him on Twitter to keep in touch. I started the conference a little shy, not wanting to introduce myself to people, so I hung out with Sumana. She talked to everyone she could find, and there I was standing next to her. On the first day, it was only because of Sumana's outgoingness that people knew who I was. On the second and third days, I was involved in two sessions: a panel on open source communities and a talk about the OpenHatch training missions. I was extremely honored to be chosen. There were so many other spectacular people I met for the first time, like Valerie Aurora, Jacinta Richardson, Brian Aker, and Alex Linsker. These are all people with three crucial traits: they're extremely knowledgeable, friendly, and opinionated. I'm glad I had a chance to attend and meet them! Photo credits: Thanks to Noah Swartz for the photo of me. Sumana's photo comes from her post to wikitech-l. Igal's comes from his Open Source Bridge user profile.

12 July 2011

Bernd Zeimetz: re-indenting files with vim

Sometimes projects with a long history of committers tend to collect various styles of indentation. Unfortunately not for all programming languages exist specialized tools like indent for C/C++, so we need to find a different way to mass-indent files properly. Using vim is one of them. First you need to create a file (let's call it /tmp/indent.vim) including all the vim commands you want to run on your code. The following piece is a good start:

gg=G
:x!
Now run vim on your source code files, using the created vim script file. The following example reindents all .php files in the current folder and subfolders

find . -name '*.php' -exec vim -s /tmp/indent.vim   \;
If you don't like the result it might be that the indentation settings in you .vimrc don't suit your needs. Of course you are able to add other fancy vim commands to modify your files - like adding or modifying copyright headers.

Gunnar Wolf: Free Software must migrate to become Free Culture

Cineast and Free Culture activist Nina Paley wrote some days ago a rantifesto on why the FSF has a double standard: Why are the Freedoms guaranteed for Free Software not guaranteed for Free Culture?, by not following its own very strict rules on software when it comes to culture as a whole. Her post was widely circulated, and got (at least) one reply by fellow Debian Developer Wouter Verhelst, largely agreeing with her, and an anti-rantifesto by Joe Brockmeier Which was promptly answered again by Wouter with a very fun and inspired post, written from the right angle: From the viewpoint of a person who is both a programmer and a musician, and understands the concepts at hand. I'd love to write a longer, better thought post But I'm tired and frankly stressed by many things, so I am just echoing their very interesting discussion to other people who might want to read it. I have been thinking and writing bits on that subject over the last couple of months. An example of that was the talk I gave at the Senate ~6 weeks ago. Following that talk, I wrote a short article for Revista Z calo (a widely circulated magazine mainly dealing with Mexican politics and social issues) called simply Software libre, cultura libre (full text available, but in Spanish only You can try reading an automated translation if it suits you). I wrote the article, mind you, with very limited time, and I'll be the first to recognize the prose was quite poor this time :( Anyway My point is that our nature is to share culture, to build it in a collaborative fashion, and having the Internet as a practically zero-cost, zero loss medium with which we can interchange our creativity with other like-minded people will naturally boost creativity. Free Software emerged before other Free Culture groups just because programmers had privileged access to Internet in the 80s and early 90s; as network access and digital creation tools have got to more people, it's just natural for all kinds of free culture to grow. Software is just a form of knowledge. Code is just a notation for a certain kind of ideas, just as the mathematical or musical notations. I believe (and hope) it's just unavoidable for us all to eventually switch to a mainly free cultural creation system.

10 July 2011

Christian Perrier: 33094 spam posts removed from Debian mailing lists in two years

Debian mailing lists' standard policy is to allow posts from unsubscribed users. That of course fits our standards for opened development but has the drawback of allowing a lot of spam to reach our mailing lists. This spam also clutters the mailing lists archives. Since 2009, a working system allows removing spam from the mailing list archives. Today, I would like to put some light on the results of this system : Results are impressive for mailing lists where a coordinated effort is done over time: the debian-boot mailing list (first coorindated effort, initiated by regretted Frans Pop), the Italian and French mailing lists. You want to help? You can. Reporting spam is as easy as reading Debian mailing lists. When you see a mail that you consider being a spam mail, just bounce it to report-listspam at lists dot debian dotte org. Don't forward it, you need to bounce it ("b" keyboard shortcut in mutt). Alternatively, you can check for this message on Debian mailing lists archives and hit the "Report as spam" button. If you're a Debian developer, you can help in reviewing nominated spam. It takes me about 20 minutes every week. Go to the spam review home page and register for an account there. Then, you'll be able to process through nominated posts. Once a given post is confirmed as spam by at least 3 reviewers with nobody else reporting it as "ham", it is removed the next week from the archive. Feel free to join the game and be part of the Debian moppers team!

8 July 2011

Russell Coker: Multiple Filesystems for Security

There is always been an ongoing debate about how to assign disk space into multiple partitions. I think that nowadays the best thing to do is to assign about 10G for the root filesystem for every desktop and server system because 10G is a small fraction of the disk space available (even the smallest laptops seem to all have disks larger than 100G nowadays). Even if 10G turns out not to be enough using separate filesystems for /var or /usr provides little benefit now that it s easy to resize the root filesystem with LVM and a separate /usr is known to be broken [1]. In a discussion on a private mailing list there was a suggestion that multiple filesystems should be used for security. DoS Attacks There are some minor security benefits in having multiple filesystems. If a critical program will fail when there is no free disk space then allowing an unprivileged process to use up all the space on that filesystem is a minor security issue, so having unprivileged processes not being permitted to write to important filesystems is a benefit. But most failures of this type are merely DoS attacks which usually aren t a big deal if you can control a local process there are usually lots of other ways of DoSing a system. Links Links have been the cause of many security issues in Unix over the years. Using different filesystems for different tasks can prevent the use of hard links in attacks aimed at exploiting race conditions. But even if you prevent hard links there are similar issues with symbolic links. SE Linux is one of many security improvements for Linux which allow restrictions on the creation of hard links. SE Linux also allows restricting the ability of processes to follow symbolic links, so a privileged process can be denied access to follow a sym-link that was created by an unprivileged process. NFS The subtree_check option in /etc/exports causes the NFS server to verify that file access is in the correct subtree. So if you export only one subdirectory of a filesystem to a given server then hostile code on that server (or on a network device which impersonates that server) can t access other subdirectories. This option is documented as having performance implications and working best for filesystems that are mostly read-only, for this reason it s turned off by default in recent versions of the NFS utilities. So if you want to NFS export /home then it s probably a good idea to have /home be on a separate filesystem to prevent attacks on the root filesystem. But of the systems with significant use of /home (IE anything other than accounts used solely for su - ) most of them have a separate filesystem for /home anyway so this shouldn t be an issue. SE Linux When mounting filesystems with SE Linux there is a context= mount option that allows specifying the context for all files on the filesystem. This can save a small amount of storage space for XATTRs and theoretically improve performance (although the difference is unlikely to show up on benchmarks for anything other than fsck). Generally the context mount option is only used for a filesystem that has a huge number of files with the same context, such as a mail spool that uses Maildir, Cyrus, or any of the other formats that involve one file per message. But again such data is generally stored on a separate filesystem for other reasons anyway. I found one interesting corner case in regard to SE Linux systems mounting files from an NFS server. When an NFS server exports multiple subdirectories of a filesystem mounted on /foo then if one NFS client running SE Linux is to mount two subdirectories of /foo with different contexts then the second mount attempt will give the error an incorrect mount option was specified . This is because as of kernel 2.6.18 by default it s not permitted to mount parts of the same filesystem with different mount options. The option nosharecache allows you to use different mount options, but does apparently permit some undesirable behavior in the case of hard links that cross between the subtrees. Thanks to Eric Paris for the tip about nosharecache. The best example I can think of for which you might want context mount options that differ among files that are used for the same purpose on an NFS mount is a web server which has data files and CGI-BIN scripts. So it seems that a SE Linux web server that mounts it s data over NFS and is at risk of having hard links between the CGI-BIN directory and the data directory is a corner case in which multiple filesystems is required for security. This seems to be a very unlikely case. Conclusion Servers that are deployed in the real world are complex enough that there are always systems with some unusual corner cases demanding configuration choices that aren t expected. There are some real corner cases for SE Linux where multiple filesystems are compelled for security or for a combination of security and best performance. But I wouldn t make a generic recommendation of using lots of filesystems for security. I think that the people who encounter the strange corner cases can usually work out that they need to do something different. So a small number of filesystems seems like a good general aim that doesn t conflict with security.

4 July 2011

Lucas Nussbaum: Going to RMLL (LSM) and Debconf!

Next week, I ll head to Strasbourg for Rencontres Mondiales du Logiciel Libre 2011. On monday morning, I ll be giving my Debian Packaging Tutorial for the second time. Let s hope it goes well and I can recruit some future DDs! Then, at the end of July, I ll attend Debconf again. Unfortunately, I won t be able to participate in Debcamp this year, but I look forward to a full week of talks and exciting discussions. There, I ll be chairing two sessions about Ruby in Debian and Quality Assurance.

Lars Wirzenius: strncpy? just say no

This is a rant. I've made it in various forms in various places over the years, and I think it's time to put it somewhere so I can point people at it, and stop repeating myself. Here's the pebble in my shoe: people keep claiming that strncpy is a safer alternative to strcpy. It's not. It's a slower function that is not going to make you significantly safer. The problem with strcpy is that it's somewhat easy to overflow the target array:
char src[] = "hello, world";
char dst[5];
strcpy(dst, src); // Oops.
The suggested alternative with strncpy would be this:
strncpy(dst, src, sizeof(dst));
strncpy gets the size of the destination array as a parameter, and can therefore make sure the string will fit there. Problem solved? Not so much. Every time you do any string handling with C's native string types and functions, you need to make sure you have allocated enough memory for each string, you need to keep track of how much memory you've allocated, and you neet to make sure the zero byte ('NUL', '\0') is put there correctly. This is a lot of details to keep track of, and it's not surprising things sometimes go wrong. If your arrays are allocated statically, which is the simplest, but least useful case, you need to something like this with strcpy:
if (strlen(src) + 1 > sizeof(dst))
    panic(); // or however you want to handle your errors
strcpy(dst, src);
The +1 after strlen is to make room for the zero byte (NUL, '\0') that is used in C to indicate the end of a string. With strncpy, your code is slightly simpler. This is its attraction. Problem is, this only works if dst is an array defined within the scope of the code. If, as is common, you have received dst as an argument to a function, sizeof(dst) is the size of a pointer to an element of the array, not the size of the array. So now you need to track the size explicitly in a second variable:
strncpy(dst, src, dst_size);
Further, strncpy has an unfortunate error handling mode: it merely fills the destination array and stops. It does not indicate failure in any way. It does not terminate the target array with a zero byte. Since all C string processing assume the zero byte is there, as soon as you try to use dst as a string, you're in trouble. But luckily you can check for that before you call strncpy:
if (strlen(src) + 1 > dst_size)
    panic(); // or whatever
strncpy(dst, src, dst_size);
By this time, the code is equally hard whether you use strcpy or strncpy. With strncpy you often waste some extra time, though, filling the unused parts of the target array with zero bytes: they're almost never necessary. Alternatively, you can force the zero byte there yourself, silently truncating a string.
strncpy(dst, src, dst_size);
dst[dst_size - 1] = '\0'; // let's hope dst_size > 0
If your string handling is OK with strings being randomly shorter than they should be, possibly you could replace all of them with empty strings, and save yourself a world of pain. Instead of strncpy, use snprintf. It has sensible error behavior, and is much more versatile:
n = snprintf(dst, dst_size, "%s", src);
if (n >= dst_size)
    panic();
snprintf still isn't very nice to use. It still requires you to allocate memory yourself, and keep track of the size of each array manually. It's also slower for small destination buffers (but faster for large ones). The real solution is to abandon C's antiquated string handling, and use a more sensible helper library instead. There's a bunch of them around, though none have gained much popularity. I'm not going to name any of them, but just imagine how much nicer it would be to write code like this instead:
Dynstr *src = dynstr_new_from_cstring("hello, world\n");
Dynstr *cat = dynstr_cat_many(src, src, src, src, src, NULL);
Dynstr *dog = dynstr_substr(cat, 15, 5);
Let the library take care of memory allocations and related tracking, and concentrate on real problem solving instead. We did this in Kannel, back in 1999, and it wiped out all the buffer overflow problems (until a co-worker decided it was "more efficient" to use native C strings instead, promptly introducing a buffer overflow). All of this string handling is, of course, way nicer in higher level languages. In fact, whenever you need to deal with string handling in C, it is probably a sign that you should consider switching to a higher level language instead. But whatever you do, stop claiming that strncpy is safe or solves any real problems strcpy has. Update: Fixed "It does terminate" to say "It does not terminate". Thanks to Matthew Garrett for pointing that out. Update2: Fixed example call to snprintf. Update3: Fixed the test for snprintf example. Thanks, Redditor axylone. Also pointed out that snprintf is slower than the rest.

3 July 2011

Vincent Bernat: Dealing with missing locales on remote hosts

On my system, I happen to set LANG to fr_FR.utf8 and LC_MESSAGES to en_US.utf8. This means that applications should follow French cultural conventions for most things except for messages which should be displayed in US English. On my own system, /etc/locale.gen contains those two locales. However, when I connect to some random remote system, they may be unavailable. Most applications will fallback silently to C. However, Perl can be quite noisy:
$ perl -e 'print "Hello\n";'
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_MESSAGES = "en_US.utf8",
        LANG = "fr_FR.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Hello
This is an incredibly annoying message. I don t understand why we still need to bear it. Perl documentation explains how to get rid of this message. The simplest way is to set PERL_BADLANG environment variable to 0. Problem solved.
$ PERL_BADLANG=0 perl -e 'print "Hello\n";'
Hello
Well, no. Keep reading. When you connect to a remote host with ssh, all your environment variables are thrown away, except those defined in AcceptEnv directive in /etc/ssh/sshd_config file on the remote host. On Debian, this directive defaults to LANG LC_*. Since I cannot install my favourite locales on all hosts or fiddle environment variables on them, I use something like this in my .zshrc:
ssh()  
  [ -t 1 ] && echo -ne "\033]0;$@\007"
  LANG=C LC_MESSAGES=C =ssh "$@"
 
Unfortunately, on systems where my locales are present, I still fallback to the crappy C locale. I could just unset LANG and LC_MESSAGES to allow fallback to the proper default locale but if the remote system starts to speak Spanish, I will not be pleased. Moreover, the behaviour of C locale (also known as POSIX locale) is undefined with characters not in the portable character set. From IEEE Std 1003.1:
Conforming systems shall provide a POSIX locale, also known as the C locale. The behavior of standard utilities and functions in the POSIX locale shall be as if the locale was defined via the localedef utility with input data from the POSIX locale tables in Locale Definition. The tables in Locale Definition describe the characteristics and behavior of the POSIX locale for data consisting entirely of characters from the portable character set and the control character set. For other characters, the behavior is unspecified. For C-language programs, the POSIX locale shall be the default locale when the setlocale() function is not called. The POSIX locale can be specified by assigning to the appropriate environment variables the values C or POSIX.
There is no way to detect the locales installed on the remote system unless you connect to it. Starting a connection just to check the locale is too expensive. On my own systems, I use another snippet in .zshrc to reconfigure the locales to my favourite ones if they are available:
export LANG=C
export LC_MESSAGES=C
(( $+commands[locale] )) && function  
    local locales
    locales=( "LANG fr_FR.utf8 en_US.utf8 C.UTF-8 C" \
              "LC_MESSAGES en_US.utf8 fr_FR.utf8 C.UTF-8 C" )
    for locale in $locales; do
        for l in $=locale[(w)2,-1]; do
            if locale -a   grep -qx $l; then
                export $locale[(w)1]=$l
                break
            fi
        done
    done
  2> /dev/null
This is an interesting snippet which uses some ZSH features. Feel free to tell me if you have found a better way to handle this problem!

Dominique Dumont: Generate a configuration editor from a config template file with Perl: lcdproc example

Hello Creating a configuration model for Config::Model can be a boring task: When a configuration system has a lot of parameters, a lot of details need to be specified to have a complete configuration validation tool. So, all tricks are permitted to make this task more bearable. Let s see how this can be applied to lcdproc. This project requires a configuration file that supports more than 40 drivers. Each driver has it own set of parameters for a total of about 250 parameters. That s a lot to specify.. Fortunately, LCDd.conf template file is written in a way which makes it relatively easy to parse and get all required information to build a model. All drivers are listed in this template file, most parameters have default values and legal values are written in comments in a uniform way. Hence this file (and comments) can be parsed to retrieve information required for the model. This blog will describe how this task can be implemented in Perl using Config::Model modules. The code will be slightly trimmed down to keep this blog (relatively) short. All initialisation code and error checks are removed. You can get the whole script on sourceforge. The main steps are:
  1. prepare a parser for LCDd.conf template
  2. parse LCDd.conf template
  3. prepare a LCDd model skeleton
  4. translate LCDd.conf template information in a format suitable to create a model.
  5. Write the resulting LCDd model
First, here s the necessary incantation to start properly a Perl program:
use strict;
use warnings;
Then load all required libraries. Their use will be described later:
use Config::Model;
use Config::Model::Itself 1.225;
use Config::Model::Backend::IniFile;
use 5.10.0;
use IO::File;
use IO::String;
Perform some initialisation to avoid upsetting the logging system:
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($WARN);
Let s also initialize a model object that will be very useful later:
my $model = Config::Model->new();
Now we can really start the fun part. Step 1: Create a parser for LCDd.conf (INI file)
Problem: LCDd.conf comments must also be analysed to get more semantic information. The comments must be retrieved and associated with the INI classes and parameters found in this file. Fortunately, Config::Model::Backend::IniFile is able to associate comments with the relevant parameters. But Config::Model::Backend::IniFile must store its values in a configuration tree. So let s create a model suitable for LCDd.conf template that accepts any INI class and any INI parameter Dummy::Class is used to store any parameter found in an INI class. The accept keyword with .* regular expression means that any INI parameter will be accepted in each INI class.
$model->create_config_class(
  name   => 'Dummy::Class',
  accept => [
    '.*' =>  
       type => 'leaf',
       value_type => 'uniline'
        ,
    ],
);
Now the Dummy model must provide a configuration class to hold all INI classes:
$model->create_config_class(
    name   => 'Dummy',
    accept => [
       '.*' =>  
           type => 'node',
           config_class_name => 'Dummy::Class'
        ,
    ],
);
Note that an INI backend could be specified directly here. But, some useful parameters are commented out in LCD.conf. Some some processing is required to be able to create a model with these commented parameters. See below for this processing. Step 2: Parse LCDd.conf Now the dummy configuration class is created. Let s create a configuration tree from this dummy class to store the data from LCDd.conf
my $dummy = $model->instance(
    instance_name   => 'dummy',
    root_class_name => 'Dummy',
)-> config_root;
Now, read LCDd.conf:
my $lcd_file
  = IO::File->new('examples/lcdproc/LCDd.conf');
my @lines    = $lcd_file->getlines;
And perform the pre-processing on LCDd.conf mentioned above. Just un-commenting commented parameters is required:
foreach (@lines)   s/^#(\w+=)/$1/  
Store the pre-processed LCDd.conf in a IO::Handle usable by INI backend
my $ioh = IO::String->new( join( '', @lines ) );
Create an INI backend to read the data from pre-processed LCDd.conf and store it in the configuration tree:
my $ini_backend = Config::Model::Backend::IniFile
  ->new( node => $dummy );
$ini_backend->read( io_handle => $ioh );
Step 3: Prepare LCDd configuration model Your attention please. You may remember that we invoked instance on object to create the dummy configuration tree to hold LCDd.conf data. The instance method used the Dummy configuration class. Now, we must invoke instance again on object. But this time, instance will use Config::Model::Itself. This model is Config::Model s way of eating its own dog food. The configuration tree created there will be able to hold LCDd model. Hence the root of this special configuration tree will be called meta_root to avoid confusion with the other configuration root defined above (for the Dummy model). Still with me? Good, let s create this meta tree that will contain LCDd model:
my $meta_root = $model->instance(
    root_class_name => 'Itself::Model',
    instance_name   => 'meta_model',
) -> config_root;
Create the main LCDd configuration class and store the first comment from LCDd.conf as class description:
my $first_comment = $dummy->annotation ;
$meta_root
  ->grab("class:LCDd class_description")
  ->store( $first_comment );
Append my own text in this description:
my $extra_description =
    "Model information extracted from template /etc/LCDd.conf"
  . "\n\n=head1 BUGS\n\nThis model does not support to load "
  . "several drivers. Loading several drivers is probably a "
  . "marginal case. Please complain to the author if this "
  . "assumption is false";
$meta_root->load(
     qq!class:LCDd
        class_description.="\n\n$extra_description"!
);
Add legal stuff in the model:
$meta_root->load( qq!
  class:LCDd
    copyright:0="2011, Dominique Dumont"
    copyright:1="1999-2011, William Ferrell and others"
    license="GPL-2"
!
);
Add INI backend so configuration object created from LCDd model will be able to read user s INI files:
$meta_root->load( qq!
  class:LCDd
    read_config:0
      backend=ini_file
      config_dir="/etc"
      file="LCDd.conf"
!
);
Note that all the load calls above could be done as one call. They were split for better clarity. Step 4:Extracting LCDd.conf information Now that all information from LCDd.conf template file is stored in $dummy configuration tree, it s time to use this information to enhance the skeleton of LCDd model created above. Let s first find all the INI classes defined in LCDd.conf:
my @ini_classes = $dummy->get_element_name;
Now before actually mining LCDd.conf information, we must prepare several subs to handle them. This is done using a dispatch table:
my %dispatch;
First create the default entry which will be used for most parameters. This subs is passed: the INI class name, the INI parameter name, the comment attached to the parameter, the INI value, and an optional value type. It will return a string describing a model for simple elements. For instance: class:"LCDd::MD8800" element:Device type=leaf value_type=uniline default="/dev/ttyS1" description="device to use [default: /dev/ttyS1]" Here s the subroutine invoked by default. Let s create a an anonymous subroutine and store it in the dispatch table:
$dispatch _default_  = sub  
    my ( $ini_class, $ini_param, $ini_note,
         $ini_v, $value_type ) = @_;
    $value_type  = 'uniline';
Now, prepare a string that will be used later to create the ini_class model. This string uses Config::Model s serialisation format described in Config::Model::Loader:
    my $load = qq!class:"$ini_class"
                  element:$ini_param type=leaf !;
Get semantic information from LCDd.conf template comments (written between square brackets):
    my $info = $ini_note =~ /\[(.*)\]/ ? $1 : '';
    $info =~ s/\s+//g;
Use this semantic information to better specify the parameter:
    $load .=
        $info =~ /legal:(\d+)-(\d+)/
           ? " value_type=integer min=$1 max=$2"
      : $info =~ /legal:([\w\,]+)/
           ? " value_type=enum choice=$1"
      :    " value_type=$value_type";
    if ( $info =~ /default:(\w+)/ )  
        # specify upstream default value
        # if it was found in the comment
        $load .= qq! upstream_default="$1"!
           if length($1);
     
    else  
        # or use the value found in INI
        # file as default
        $ini_v =~ s/^"//g;
        $ini_v =~ s/"$//g;
        $load .= qq! default="$ini_v"!
           if length($ini_v);
     
The model (in serialised format) is ready, let s return it and exit the subroutine:
    return $load;
 ;
Now let s take care of the special cases. This one deals with Driver parameter found in INI [server] class. This sub will create a string for an enum element. The possible values of the enum are extracted from the comment found in the LCDd.conf file:
$dispatch "LCDd::server" Driver  = sub  
    my ( $class, $elt, $info, $ini_v ) = @_;
    my $load = qq!class:"$class"
                    element:$elt
                      type=leaf
                      value_type=enum
    !;
    my @drivers = split /\W+/, $info;
    while ( @drivers
            and ( shift @drivers ) !~ /supported/ )  
      # nothing, the work is done by shift operator
      # in loop test to skip all words in $info until
      # 'The following drivers are supported:'.
      # ok, that's a hack
     
    $load .= 'choice='
          . join( ',', @drivers ) . ' ';
    return $load;
 ;
This sub invokes the default sub and add a small feature to the model to ensure that DriverPath ends with / . This is ensured by the match="/$" snippet:
$dispatch "LCDd::server" DriverPath  = sub  
    my ( $class, $elt, $info, $ini_v ) = @_;
    return   $dispatch _default_ ->(@_)
           . q! match="/$" !;
 ;
Likewise, this sub invokes the default sub with the optional 4th parameter that forces the value_type of the element. In this case, we enforce an integer element:
 $dispatch "LCDd::server" WaitTime 
 = $dispatch "LCDd::server" ReportLevel 
 = $dispatch "LCDd::server" Port 
 = sub  
    my ( $class, $elt, $info, $ini_v ) = @_;
    return $dispatch _default_ ->( @_, 'integer' );
   ;
This sub returns a string for a list element with default values:
  $dispatch "LCDd::server" GoodBye 
= $dispatch "LCDd::server" Hello 
= sub  
    my ( $class, $elt, $info, $ini_v ) = @_;
    my $ret = qq( class:"$class"
                    element:$elt
                      type=list
                ) ;
    $ret .= 'cargo type=leaf
             value_type=uniline - ' ;
    $ret .= 'default_with_init:0="\" '.$elt.'\"" ' ;
    $ret .= 'default_with_init:1="\" LCDproc!\""';
    return $ret ;
 ;
Now that the dispatch table is ready, let s really mine LCDd.conf information. First handle all INI classes in the foreach loop:
foreach my $ini_class (@ini_classes)  
Let s retrieve parameters for this INI class from the LCDd.conf template:
  my $ini_obj = $dummy->grab($ini_class);
This will be the name of the lcdproc driver configuration class (e.g. LCDd::imonlcd):
  my $config_class   = "LCDd::$ini_class";
The configuration class will also be created in a serialised format. Let s create config class in case there s no parameter in INI file:
  $meta_root->load(qq!class:"LCDd::$ini_class"!);
Now, loop over all INI parameters and create LCDd::$ini_class elements:
  my @all_ini_params = $ini_obj->get_element_name ;
  foreach my $ini_param ( @all_ini_params )  
Retrieve the value provided in template LCDd.conf:
    my $ini_v = $ini_obj->grab_value($ini_param);
Retrieve the comment attached to the value provided in template LCDd.conf:
    my $ini_comment
      = $ini_obj->grab($ini_param)->annotation;
    # escape embedded quotes
    $ini_comment =~ s/"/\\"/g;
Retrieve the correct sub from dispatch table:
    my $sub = $dispatch $config_class $ini_param 
              $dispatch _default_ ;
Run the sub to get the model string:
    my $model_spec
      = $sub->( $config_class, $ini_param,
                   $ini_comment, $ini_v );
Attach the comment from LCDd.conf as class description:
    $model_spec .= qq! description="$ini_comment"!
      if length($ini_comment);
Then, last but not least, load class specification in the model, and end the loop aroung INI parameters:
    $meta_root->load($model_spec);
   
Now create a an $ini_class element in LCDd class (to link LCDd class and LCDd::$ini_class):
  my $driver_class_spec = qq!
    class:LCDd
      element:$ini_class
  ! ;
Since server and menu are not drivers, they have a special treatment:
  if (   $ini_class eq 'server'
      or $ini_class eq 'menu' )  
    $driver_class_spec .= qq!
      type=node
      config_class_name="LCDd::$ini_class"
    ! ;
   
Here s the treatment for LCDd drivers. Setup the model with a warped node so that a driver configuration class is shown only if the driver was selected in the [server] class:
  else  
    $driver_class_spec .= qq!
      type=warped_node
      config_class_name="LCDd::$ini_class"
      level=hidden
      follow:selected="- server Driver"
      rules:"\$selected eq '$ini_class'"
        level=normal
    !;
   
Now we can load the LCDd driver model in meta root:
  $meta_root->load($driver_class_spec);
 
Step 5: save LCDd model Still with me ? Good. Here s the last part, now that the model was created in memory, let s save it in files. Config::Model::Itself constructor returns an object to read or write the data:
my $rw_obj = Config::Model::Itself
     ->new( model_object => $meta_root );
say "Writing all models in file (please wait)";
$rw_obj->write_all(
    model_dir => 'lib/Config/Model/models/'
);
That s it. Once this script is run, the directory lib/Config/Model/models/ contains a bunch of files: You can see the resulting editor in my first blog on lcdproc. Conclusion and future steps (with you?) As mentioned at the end of this blog, the result of this model generation process is far from perfect, because the information retrieved from LCDd.conf template are not complete for this task (which is normal since these comments were targeted for users). Now, I d really like to discuss with project developers to improve configuration template to generate better models. For project owner, such an improvement would give them: Please leave a comment on this blog (or send a message to config-model-users at lists.sourceforge.net) if you are interested in configuration tool generation for a project you contribute to. All the best

Rapha&#235;l Hertzog: My Debian activities in June 2011

This is my monthly summary of my Debian related activities. If you re among the people who made a donation to support my work (195 , thanks everybody!), then you can learn how I spent your money. Otherwise it s just an interesting status update on my various projects. Dropbox for Debian This is not free software but Dropbox is very popular and they did only provide an Ubuntu package that did not work on Debian. So I created an official package. I have been in touch with Dropbox developers and they have been very helpful. They ll shortly release a signature mechanism (with GPG) so that we can further improve the package by verifying the origin of the downloaded binaries. SAT Britney At the start of the month, I continued my work on the britney reimplementation (the software that creates testing out of unstable) but I quickly stalled it because the release managers asked the feedback of Stefano Zacchiroli and Ralf Treinen (who have extensive knowledge on the topic with their research work on Mancoosi) and I did not want to invest further work in case they would identify a major flow the feedback came only very late this month and while it was somewhat negative, I still think it s worth pursuing the effort for a bit longer. Converted ftplib to multiarch While dpkg still doesn t support multiarch (no news from Guillem and no visible sign of progress :-( ), unstable got all the remaining bits allowing us to convert libraries to multiarch (see the announce). As soon as the required libc6 landed in unstable, I looked into converting the only library package that I maintain. I had no major problem but I still identified 2 issues in Lintian (filed as #630164 and quickly fixed by Niels Thykier). build-arch / build-indep support For the 42th time in the last 10 years, the idea of using build-arch/build-indep targets in the rules file has surfaced again. I had already decided some time ago that I would accept a patch implementing a new field Build-Features to enable dpkg-buildpackage to use those targets and this time Bill Allombert completed such a patch so I merged it. The technical committee also decided that it would take a final decision on this topic (see #629385). Roger Leigh provided useful input by doing an archive-wide rebuild with the various solutions suggested. Given that the majority would like to make the target mandatory at some point in the future, I provided the dpkg patch for my preferred solution. We would use auto-detection as a temporary measure until all packages have been converted to have the targets. The technical committee has not yet taken any decision even though the discussion stalled since the 12th of June. But that s usual with that body. I m sure it will be solved during Debconf. ;-) Misc dpkg work Hamster applet update Hamster-applet is a GNOME application which did not have a 3.0 release, but it had a development release (2.91.x). I checked out whether it was possible to package this version for experimental and have the applet work with the GNOME fallback mode. Apparently not, the code was not yet updated to be compatible with the newer panel. Instead I uploaded the latest stable version (2.32.1) to unstable. It has some nice improvements in the standalone version (and the name of the executable changed). For usage with GNOME 3, I have created a custom shortcut to start it quickly (with gconf-editor set /apps/metacity/global_keybindings/run_command_1 to <Mod4>t and /apps/metacity/keybinding_commands/command_1 to hamster-time-tracker because the GNOME 3 control panel does not seem to work to set custom keybindings currently). Translated my professional website into English While I m grateful for all the people who are supporting my work, I m still far from my goal to have one third of my time funded through donations and sales of products on this blog. So I decided to also bring more visibility to my company and in particular to its Debian-related service offering. It was only available in French up to now so I translated it and expanded it a bit. My support page on this blog now also links to my company s website. If your company needs help to create Debian packages, or needs Debian technical support by email, you just found the right partner. :-) BTW, I have discounted prices for individuals and non-profits who would like to benefit from my help to create Debian packages. The Debian Administrator s Handbook This is the title of the upcoming translation of my book. The project now has a dedicated website: debian-handbook.info. You can subscribe to its RSS feed to keep up with the latest news. The full table of contents is online along with a FAQ. I m actively looking for partners to help me promote the fundraising once it goes live. If you can reach a large set of readers interested by a good Debian book, get in touch with me to join the affiliate program. Thanks See you next month for a new summary of my activities.

No comment Liked this article? Click here. My blog is Flattr-enabled.

Next.

Previous.