• The Multiboot specification and NetBSD

    In the OS world, each OS comes with its custom boot loader that knows how to load the kernel and how to pass the execution flow to it. These boot loaders often know very little about other OSes, so if you need a multi-OS environment, you have to install several different boot loaders. It is often tricky to get them to coexist and, even if you accomplish it, it's still annoying to chainload between them.The GRUB developers wrote the Multiboot specification which aims to solve this problem. This specification defines an interface between a boot loader and the OS's kernel, so that any Multiboot-compliant boot loader can execute any Multiboot-compliant OS without knowing any of its internal details. There are several free OSes that already follow this specification, including GNU/Hurd, ForthOS, AtheOS or Syllable. (I'm sure there are many more.)Although this is i386-specific, I think the idea is quite interesting. Therefore, I've started adapting the NetBSD kernel to this specification. I'm progressing (very) slowly, mostly because the lack of documentation on boot code, the complexity behind it and some bugs in GRUB! No matter what, I can boot a kernel directly from GRUB already, although it still lacks configuration (i.e., information about the boot device, memory mappings, etc.). Leave me some more days and I think it'll be ready :-)What are those bugs in GRUB I said? The specification reserves some space in the Multiboot header to specify where in memory the image has to be loaded. This is required for a.out binaries but it is optional for ELF binaries... and optional means that GRUB forgets about it in the ELF case. Which is a pity because I must pass special information through there. To the curious ones, the kernel's text is mapped into the 0xc0100000 virtual address, but the boot loader must load it into the physical address 0x00100000 (because paging is not enabled and such high addresses are not available). Similarly for all the other segments.I also hope to write a little boot(9) manual page as a result of this mini-project, explaining the overall NetBSD boot process (at least under i386). I'm sure many people could benefit from it.Edit (23:49): Some typos and grammar incorrections pointed out by Amitai Schlair have been fixed. [Continue reading]

  • Merry Christmas!

    Merry Christmas, my fellow readers, and thanks for reading this blog! Seizing the opportunity to post some numbers: since this blog was moved from Livejournal to Blogger it has got around 2.300 unique visits. This makes the 209th post and the blog has been up for 19 months; I think it's in good health.Oh, and I just got a Linksys WRT54GS broadband router as a Christmas present... time to set it up :-) [Continue reading]

  • Monotone: Got T-Shirt

    The last weekend of past November, Monotone's main author, Graydon Hoare, proposed a "bugathon": a time frame in which all efforts could be focused on fixing existing bugs in the code. The price for solving a bug was a T-Shirt (or any other object from its CafePress shop), so I decided to help a bit by fixing some portability bugs to NetBSD. And today, I received the long sleeved T-Shirt I ordered in exchange for the fixes :-) (Will post a photo of this one too when I learn how to do it.) [Continue reading]

  • NetBSD 3.0 released

    The NetBSD Project has just released a new major version of its operating system, thus making NetBSD 3.0. This release comes a year after of 2.0 publication and includes lots of new features and bug fixes. For more information, see the announcement (also available in Spanish).From here, a big thank you to all the people who made this release possible and, specially, to the release engineering team. [Continue reading]

  • SoC: Got T-Shirt

    When I got home yesterday, I found that I had already received the so-promised Google's Summer of Code T-Shirt as well as a certificate stating that I passed the program. I'm happy :-) I now should learn how to post photos here in Blogger. [Continue reading]

  • Comments after a month with the iBook

    It has already passed a full month since I bought the iBook 12". And man, this is one of the best buys I've ever made. Just after I got it, the preinstalled Mac OS X greeted me and let me set up the machine. After that, I spent some time installing the applications I needed such as XCode, Vim.app (yes, I really like Vim's graphical version), the Subversion and Monotone clients, Adium X, Firefox (because Safari fails to open my faculty's website), NeoOffice/J, The Gimp, Colloquy and a bunch of other less-important things. (I haven't had time yet to play with some of the integrated applications.)Since then, I have been doing real work exclusively. The machine has been rock solid and I haven't had any single problem with the hardware nor the software. Not to mention that the system and the applications have taken care to update themselves whenever needed, so I haven't had to administer the box. I now understand when people say they want to use computers rather than fight with them...Anyway, the first idea of this post was to summarize the things I like most about the system itself, so let's continue with that. First of all, I'm in love with Exposé. Before I had the Mac, Mac-users often told me how great this feature was, but I was really skeptical and didn't believe them. My mind has changed completely: this feature is truly amazing. Visually selecting the window you want rather than having to look for a name in a task bar or window list is a lot easier. Not to mention that the way it behaves is a lot better than some free clones (which I had tried and didn't really convince me).Secondly, there is the Dashboard. I find this feature useful because I have tools like a dictionary, the weather report, iTunes control and several other things quickly available after a mouse gesture. Indeed, GNOME provides much of these features in the task bar, but they end up bothering me because they remove a lot of useful space from it. Having these applications in a "secondary screen" is nice — of course, you can achieve something like this with an auxiliary virtual desktop.Then, there is the concept of active application vs. active window. I also was quite reluctant to have the menu bar at the top of the screen; in fact, I'd already tried this behavior in KDE but didn't convince me (possibly because its applications are not designed to work in such way). I've now come to like it: the menu bar is quickly accessible, as it is placed along a screen boundary, and when the application is active, all its windows come to the front layer. Furthermore, the menu layout is well standarized across applications, so the most common options are available in a known place even if you've not used the program before.There is also Spotlight, which quickly searches your hard drive for files matching a given search criterion. It is nice, but there is already Google Desktop for Windows boxes or Beagle for Unix ones, so I don't see it as revealing as the other features described here.Not to mention its BSD core. While the system is designed for desktop usage, having a Unix system underneath is excellent for development tasks. Add pkgsrc to the mix and you can get any Unix software you want painlessly :-)At last, although I'm also a bit reluctant about visual effects, the ones in Mac OS X are well done and do not get in the way. They even help you in your daily work by, e.g., showing your active window at a "upper" level (using a drop shadow), letting you put some windows in transparent mode so that you can work on two documents at once and other similar things.Conclusion: I don't regret at all having bought the iBook and I really like its OS, Mac OS X (pity its UI is not free). Of course, I won't leave NetBSD nor pkgsrc development, as I already have a quite long to-do list for them (on which I'll work when I finish this university semester) and I believe in them! ;-) [Continue reading]

  • Vim: Macros

    Vim (The editor) is able to record and replay macros; unfortunately, this feature is often unknown. Since I learned about it, I'm not afraid any more to do large and monotonous editing tasks as Vim can do most of the work for me.OK, but, what is a macro? A macro is a list of prerecorded actions that can be executed (replayed) at any time in an automated fashion. Macros are identified by a single letter and can be recorded while Vim is running — that they are volatile in the sense that they are forgotten when the editor is closed. I'm sure there is a way to store them in the configuration file but I haven't looked for it (yet).In order to record a macro, press q followed by the name — a single letter — you want to assign to it. The most commonly used name is q (because it's quick to type after the recording command), so simply press this key twice, qq, to start recording a macro named q. You will see that the status line changes to recording so that you know what is going on.With the editor in recording mode, do changes to the document as you'd usually do. The macro will remember everything; even changing the current document to another one (e.g., :wn) will be stored (useful in multifile edits). When you are done, simply press q again to stop recording.So, now that you have your macro recorded, how do you replay it? Simply press @q and watch Vim redo your actions! Note that @ stands for the replay command and q indicates the macro's name.Be careful when recoding macros, though. It is useful to stick to generic movements around the text rather than simple ones; that is, instead of moving letter by letter, move word by word, go to the beginning/end of the line, move X lines forward/backward, etc. This way, the macro will be applicable even if the text you are currently editing does not match the one you used to record the macro. [Continue reading]

  • Java: Visibility

    I'd always (incorrectly) believed that, if you didn't specify the visibility of an attribute or method in a Java class, it'd be private in the former case and public in the latter. This is not what really happens. In fact, Java has four different visibility modifiers: public, protected, private and "package". The first three are the "standard" OOP types, while the last one is Java specific.There is no reserved keyword in the Java language to denote an attribute or method as "package"-visible; this status is automatically assigned when no modifier is applied. But... what does it mean? Consider a Foo class with an attribute bar and a methodbaz, both with the default visibility set. Any other class in the same package as Foo will be able to freely access bar and baz. In the other hand, classes from other pacakges will see bar and baz private.Aren't you thinking about C++'s friend keyword by now? Exactly! This default visibility status can be used to achieve a similar thing in Java. Just put the classes with a friendship relation in the same package and they will be able to interact with each other, sharing implementation details without exposing them to the public. [Continue reading]

  • Case-sensitive vs. case-preserving

    A file system is case-sensitive when it differentiaties uppercase letters from lowercase ones. This means that foo.c is not the same thing as Foo.c and therefore you are allowed to have these two files living in the same directory. While I've lived with case-sensitive file systems for a long time (since I discovered Unix), I haven't yet found any advantages to them except for an easier and faster implementation. In these file systems, detecting a file match is a matter of a raw comparison of the characters you are given agains the ones stored on disc. Examples of case-sensitive file systems include UFS, Ext3, Reiser, etc., while examples of the other set include VFAT, NTFS and HFS+.On the other hand, case-insensitive file systems can be case-preserving or not. A file system is case preserving if it keeps the case of the file names as they are entered. For example, if you name a file Foo.c, it will appear as such in all listings, not foo.c nor FOO.C. Such file systems include VFAT, NTFS and HFS+. However, if the file system is not case-preserving, it will convert all file names to either uppercase or lowercase. An example is the old FAT, which shows all 8.3 file names in uppercase letters.I'm sorry for not having posted in more than 20 days, but this university project (PROP, if you must know) is really exhausting me. Not to mention that I've taken the FCE exam today, too... [Continue reading]

  • Java: Dynamic class loading, part 2

    As we saw in a previous post, Java has the ability to dynamically load classes based on their name. We previously assumed that the classes being loaded had a constructor with no arguments. However, this restriction is ficticious. Let's now see how to load a class with random constructors.The first thing we have to do is to create a vector of Class objects that describes the constructors' prototype. Each element corresponds to a function parameter. Similarly, we later create a vector of Object instances that represents the parameters' values. For example, let's consider the following class:public class FooClass { public FooClass(String a, Integer b) { ... }}Having this, we'd do the following to prepare the call:Class[] proto = new Class[2];proto[0] = String.class;proto[1] = Integer.class;Object[] params = new Object[2];params[0] = "foo";params[1] = new Integer(5);Once we have this, we can proceed to create the instance of the desired class. To do this, we start by loading the class as we did in the former post. With the class loaded (as a Class object), we use the getConstructor method using the constructor's prototype (proto variable) as its single argument; this returns a Constructor object that represents the desired method.At last, we call the newInstance function over the Constructor object to create a new instance of the requested class (FooClass in our example). Shown as real code:Class c = Class.forName("FooClass");Constructor ct = c.getConstructor(proto);FooClass fc = (FooClass)ct.newInstance(params);Note that I've used the Integer class rather than the primitive int type; I'm not yet sure if you can dynamically call a function that uses primitive types in its signature. Also note that the class being loaded, as well as its constructor, are declared public; otherwise, the load will fail. [Continue reading]

  • RAID: Monograph

    I've just finished writing a monograph for the APC university course, a subject in which we study the PC architecture. My monograph talks about RAID and is 30 pages long. It starts describing what RAID is, which levels it has and ends up analyzing some current hardware and software solutions to set up a RAID system. Please note that it is in the Spanish language.Oh, by the way, this makes the 200 post! :-) [Continue reading]

  • NetBSD: File system directories, part 2

    In the first part, we saw what a directory is and gave some fuzzy ideas on how it is implemented. Let's now outline the most common operations run on directories: lookup and readdir.The lookup operation receives a path component name (a string without slashes) and returns the node pointed to by this name within the directory, assuming, of course, that the entry exists. Otherwise, it tells the caller that the entry is missing or incorrect (i.e., not a directory). This operation takes advantage of the name cache because it must be fast; keep in mind that lookups are executed extremely often.The implementation of the lookup operation, however, is very complex. It is cluttered by a weird locking protocol and has a lot of special cases. These include access advices, a technique used to tell the operation what kind of lookup is happening: a creation, a removal, a rename or a simple lookup. UFS uses these to locate empty holes in the directory while looking for an entry, among other things. tmpfs uses it to avoid two lookups for the same file on some operations, such as the creation.On the other hand, we have the readdir operation, the one used to read the contents of a directory. This operation is conceptually simple, as all it has to do is read as much entries as possible from the offset given to it. These entries are returned in a standard format, described in getdents(2).However, there is a tricky thing in readdir: the cookies. They are used by the NFS server to map directory entries to offsets within it so that further lookups can be done in a more efficient manner. For each entry returned by readdir, a cookie is also returned that specifies its physical offset inside the directory. A further call to this operation using the cookie's value could restart the read at the point where the entry lives.It is also interesting to note that some file systems return fake cookies because they do not have physical offsets within them — in other words, they are not stored on disk. This happens in, e.g., tmpfs or kernfs.Post suggested by Pavel Cahyna. [Continue reading]

  • How to prolong lithium-based batteries

    I've been recommeded to read the How to prolong lithium-based batteries article after asking how to manage my new iBook's battery. I'm posting the link here because I found it useful and interesing, so it can be helpful to you too. [Continue reading]

  • NetBSD: File system directories, part 1

    A file-system directory is an object that maps file names to nodes (i-nodes in UFS terminology). When given a file name, the directory must be able to tell whether it has that name or not and return the node number attached to it. File names are not stored in the nodes themselves as this allows for hard link creation flawlessly: you can have multiple directory entries pointing to the same file with no extra cost.Let's see a very simple directory implementation, coming from NetBSD's tmpfs (see tmpfs.h). This file system implements directories by using a linked list (struct tmpfs_dir) of directory entries (struct tmpfs_dirent). These structures look like:struct tmpfs_dirent { TAILQ_ENTRY(tmpfs_dirent) td_entries; uint16_t td_namelen; char *td_name; struct tmpfs_node *td_node;};TAILQ_HEAD(tmpfs_dir, tmpfs_dirent);Of special interest are the td_name field, which holds the entry name (file name), and the td_node pointer, which points to the file system node related to this directory entry (UFS could use i-node numbers instead).This implementation is really simple as it is completely backed by virtual memory; adding and removing entries is as easy as allocating a memory block and modifying the linked list accordingly. It could, of course, be more complex if it used a B+ tree or some other structure instead.However, on-disk file systems do extra tasks to optimize directory accesses. For example, when an entry is removed, it is marked as deleted using a special flag but it is not really removed from disk, because shrinking the directory could be expensive. Similarly, new entries overwrite previously deleted entries, if possible.In the next post, we will outline how some directory operations (such as lookup and readdir) work.Post suggested by Pavel Cahyna. [Continue reading]

  • Got new laptop: iBook 12'

    I never blogged about this before, but around six months ago, I bought a second-hand iBook 14", G3 at 600Mhz with 256Mb of RAM. The machine has served me very well during this time although I felt its slowliness (specially under Mac OS X) to do common tasks: buildling stuff (university projects) and composing documents under OpenOffice.org. I also felt its weight when carrying it on my backback.However, a friend of mine offered to buy it for a reasonable price some days ago... so I decided to sell it and buy a shiny new one. And this is what I've just done: gone to the closest Apple Store and bought an iBook 12" (G4 at 1.33Ghz, 1Gb of RAM, and 40Gb of hard disk). Less weight, faster and nicer :-)I'll keep using Mac OS X for a while in this computer. I want the laptop to do real work and not fight setting it up (as used to happen in the previous one with Debian GNU/Linux and NetBSD. Of course, I'll try them some day (or, at the very least, pkgsrc), but when I have more free time; I'm very busy these days with some university stuff (and I needed a faster laptop to get this work done).Now, to explore it a bit more! :-) [Continue reading]

  • Java: The finalize method

    I recently discovered that Java has finalization methods for objects, just like C++. However, they do not behave the same way due to Java's garbage collection.In Java, a finalization method has the following prototype: protected void finalize();, which is inherithed from java.lang.Object. This method can do any task it wants to explicitly release resources owned by an object.In C++ you have the following expectation: a finalization method is called whenever the object ceases to exist. That is: when a local object goes out of scope (all of them are deleted when the program shuts down) or when you explicitly delete a region of allocated memory. However, dynamically allocated objects are not automatically deleted when the program exits (you must remember to do it by hand).Java behaves much like C++'s dynamically allocated objects in this regard. If they are not "explicitly" deleted, their finalization method is not executed. And who deletes them? The GC when it feels it has to. This means that you cannot predict in any way when your object will be deleted; in fact, you cannot even know if the destroyer method will be ever executed. This is why Java classes provide methods to deallocate resources on purpose (see the close method on any class that affects files).Let's see a little example:class Test { protected void finalize() { System.out.println("Removed"); } public static void main(String[] args) { Test c = new Test(); }}If you build and run this program, it will probably print nothing. The GC doesn't act on shutdown so the object is implicitly removed when the VM closes. Instead, if you try the following, you will probably see something:class Test { protected void finalize() { System.out.println("Removed"); } public static void main(String[] args) { for (int i = 0; i Test c = new Test(); } }}It's a pity that destoryers do not work "correctly" (I mean, as in C++'s local variables), because this can make some pieces of code overly complex to control all possible execution flows.And sorry for the long delay in posting. I'm nowadays extremely busy with a university project and have few time for anything else. [Continue reading]

  • Delta modulation

    In a previous post, I outlined how the Pulse Code Modulation (PCM) works (it was not the aim of the article, but it contains this information). Let's now see another modulation technique used for voice signals, the Delta Modulation (DM).The DM codifies each signal sample using a single bit, which is determined from the previous sample's value and the current one. The bit specifies whether the new sample is higher than the previous one, hence only describing the variation in the information (and not its contents). The resulting set of bits can be drawn as a staircase that approximates to the original signal, being 1 a rise of the stair and a 0 a descent of it.Remember that the number of samples per second is determined by the Nyquist theorem.For example, consider a standard 4KHz voice channel. You need to take 8000 samples per second to preserve the original signal. Given this and using the DM, you can codify the signal with 8000 bps or 8 Kbps. OTOH, if you were using PCM with 256 levels (8 bits each), the same signal could occupy 8000 * 8 bps or 64 Kbps.It is clear that the DM needs to transmit a lot less data than PCM. But, as you can imagine, DM doesn't provide any quality: it does not adapt well to signals with sudden changes (such as a shouting voice), although it might work for monotonous voices. On the opposite side, PCM with 256 levels provides very good quality.IIRC, DM was once used in the Japanese public telephony network but was soon dropped due to the poor results. (Sorry, couldn't find a link to demonstrate this.) [Continue reading]

  • Java: Dynamic class loading

    One of the things I like most about Java is its ability to load classes on demand. Given its interpreted nature, the virtual machine can detect when a class is not yet loaded and bring it to memory transparently; think of this as page faults and the MMU handling them.Even more, you can ask it to load a specific class based on its name, which allows you to design powerful abstract models painlessly. Of course, you can do the same thing with C or C++, but things are trickier — dynamically loadable modules are not easy to deal with. (You could also use link sets.)As an example, let's consider (a simplification of) a set of generic classes for unit testing that I've written as part of a university project: Test: An abstract class to implement unit tests. Each class in the project will have another class dedicated to testing, which will inherit this one. For example, given a Foo class, there will be a TestFoo that does whatever is appropriate to ensure that Foo works. Tester: A generic driver that, based on commands given in the standard input, loads the appropriate test class, runs its unit tests and verifies the results based on prerecorded (correct) output values. The thing is: how do you get a Tester class that is completely independent of, say, TestFoo? Ideally, Tester should only know the Test class and nothing else. Here is where dynamic class loading comes to help.The Tester class receives a class name (Foo in our example) on the program's standard input, among a set of arguments that describe the unit test to be executed. Based on this name, it tries to load its corresponding testing class and, if it succeeds, it executes the appropriate methods. This is only possible because all testing classes have Test as the common ancestor.As a code example, assume a className variable that holds the name read from standard input and a opName variable that has the name of the operation to be tested:String className, opName;/* Read className and opName from stdin. */try { Class c = Class.forName("Test" + className); Test t = (Test)c; t.execute(opName);} catch (Exception e) { /* Catching Exception for simplicity. */}It is up to your imagination how you use this feature, but, as you can see, it is extremely useful. [Continue reading]

  • USB mouse, pbbuttons and lack of udev

    When I have to do intensive "graphical" work on the iBook, I often connect an external USB mouse because I find the touchpad uncomfortable. However, I've been suffering a problem for a long time: the pbbuttons daemon did not recognize it, so it didn't detect activity and shut off the screen every now and then.I was so tired of this annoying behavior that I sat down and looked for the problem. It bothered me a lot because it used to work correctly in a previous installation. I'm running Debian and udev is not enabled; this last thing is the most likely difference between the two installations.Looking at pbbuttons' manual page, I found that it uses the /dev/input/event* devices to detect peripheral activity. I looked at those files and there were four of them (generated by MAKEDEV); strange, I thought; everything looks correct. So I did the obvious thing after reading pbbuttonsd.conf(5): added autorescan=yes in /etc/pbbuttonsd.conf. No luck; it kept working incorrectly.The next thing was to check whether the daemon was using the devices or not. I did: lsof | grep pbbuttons as root and, as expected, it had all the appropriate devices open. Hmm... it reads from the devices but doesn't detect mouse activity? Maybe there is something wrong in the kernel? (No, fortunately ;-)My next test was a cat /dev/input/event? >/tmp/a for each device, move the external mouse while the command was running and see if /tmp/a had a size different than 0 afterwards. As you can expect, for the event[0-3] devices (the standard ones), I saw no output. Aha! That had to be the cause.I created a new device:# cd /dev/input# mknod event4 c 13 68# chmod 660 event4ensured that it received mouse events using the trick above and restarted pbbuttons. Voila; it detected the mouse again. Maybe I should enable udev and this could have worked automatically... [Continue reading]

  • GNU Zebra

    This semester, I'm taking a course (PIAM) about Internet protocols at the university. One of its main subjects are Internet routing protocols, of which we've seen RIP and OSPF as IGPs and BGP as the EGP.In order to see their functionality in action, we set up a set of machines to simulate the Internet and/or isolated LANs, using the protocols mentioned above. You can imagine that we needed many routers to get this working (around 20), as all the class had to practise the same thing at once. But the routers that implement these protocols (specially BPG) are very expensive, so this is not affordable.Instead, we use regular PCs running Linux to act as real routers. There is a wide variety of software to do this, but we used the GNU Zebra application. Zebra is a free routing software that runs on top of Unix systems and implements all the protocols mentioned above.What I found very interesting, though, is that GNU Zebra is controlled through an IOS-like interface. It accepts most of the IOS commands verbatim, despite some of them are a bit different. Also note that this is not restricted to the routing protocols only: you can even set up the network interfaces and routing tables using this interface so it can be used to hide the underlying OS to anyone who already knows IOS. [Continue reading]

  • SoC: Map and results

    Quoting Google Code news:As the remaining awards are being distributed and the t-shirts are being prepped to ship out, we thought we'd give you an idea of the both the global scope and the hard work done by the students and mentors during the Summer of Code. We've put together a map and a list of projects for your examination. Please note that not all of the projects are listed quite yet, but we wanted to share some info with the people who follow this site.It has taken a while, but the projects and results are finally announced. There certainly is a lot of interesting stuff in the list :-) [Continue reading]

  • Remembering Freedows OS

    Yesterday's MINIX post made me remember the Freedows OS project; I talked about it with a friend recently, who didn't know about its existence, so hence this post.Freedows was an operating system that aimed at providing multi-platform emulation. It was born in 1996 and was based on a microkernel architecture. It had to have servers for different popular operating systems, such as Windows, Linux and DOS (IIRC), allowing the user to run applications from each of these seamlessly.It is a pity that it was abandoned in 2002, possibly because its high ambitions and expectations. It seemed to be quite popular at its time, as I recall articles about it in generic computer magazines. What is worse, the web site disappeared together with the code (I guess it is still somewhere else for historical reasons, though). Check out the Wikipedia article for more details.Fortunately, we now have ReactOS, which is coming along nicely and also plans to incorporate non-Windows subsystems.BTW, a quick Google search shows a Linux distribution from Brazil whose name is Freedows. Don't get confused, as it is completely unrelated. [Continue reading]

  • MINIX 3 published

    As seen in the MINIX news site, the 3rd major release of this operating system has been released today. As seen in the new web site:MINIX 3 is a new open-source operating system designed to be highly reliable and secure. It is based somewhat on previous versions of MINIX, but is fundamentally different in many key ways. MINIX 1 and 2 were intended as teaching tools; MINIX 3 adds the new goal of being usable as a serious system on resource-limited and embedded computers and for applications requiring high reliability.The fact that it is based on a microkernel and published under a BSD-like license have raised my interest in this new version — yes, I like the microkernel design more than the monolitical one (and this is one thing I don't like from NetBSD).I've already tested the downloadable live CD and looks promising. It's extremely fast, but obviously less functional than a complete BSD or Linux system (at least for now). I still remember when I tried Minix 2.something on a 386SX 16Mhz laptop; it really made a difference compared to Linux (using a Slackware 3.4).I guess we can expect nice things from this new code-base. [Continue reading]

  • SoC: Payment received

    Being part of Planet SoC, I think it is a good idea to post this: I've just received Google's cheque for my Summer of Code 2005 tmpfs project! I'm happy :-)Unfortunately, due to some tax issues, Google has withhold a 30% of the original payment. I hope to be able to ask for a refund the next year... [Continue reading]

  • Sending mail from the command line with Mutt

    During the migration to Blogger, I used the post-by-mail service to ease the move of all posts. I downloaded all the old ones into my computer and then automatically sent a mail for each of them to the appropriate posting address.However, this was not easy. As all the posts were in HTML format, I needed to tell the mailer to send a multipart message with a text/html part. After many attempts, NetBSD's mail(1) command proved to be insufficient so I had to look for another mailing utility to do the same thing. (Note that I know few things about the mail protocol, so I can be missing something.)My first thought was that Mutt could help. Indeed, if I composed an empty mail and attached an HTML file, it did what I wanted. The problem came when I had to automate this from a script... The first attempt was something like:mutt -s "$(cat mail/$f.subject)" -a mail/$f.html address@example.orgOk, this worked, but having to type [Enter][Enter], then :wq and then y for each message was not automatic. The first thing I solved was the save and edit part from the editor. Instead of using vi(1), I asked Mutt to use touch(1):EDITOR=touch mutt -s "$(cat mail/$f.subject)" -a mail/$f.html address@example.orgThis solved the :wq part but I still had to type [Enter][Enter]y for each post. How to solve it... I searched a bit (I mean, Googleed a bit) and found that giving /dev/null as the standard input to Mutt was enough to silence it. So the command ended being as:EDITOR=touch mutt -s "$(cat mail/$f.subject)" -a mail/$f.html address@example.org </dev/nullStill, it'd be nice if the standard mail(1) utility was able to send complex messages... [Continue reading]

  • Blog migrated to Blogger; welcome!

    As I outlined a week ago, I was considering the migration of my blog (jmmv's weblog) from Livejournal to Blogger... and I finally did it. Therefore, welcome to the new site!Before continuing, update your subscriptions! You can find the link to the new Atom feed in the Basics section on the sidebar (don't know how to do RSS yet). And forget about the older site; it will no longer be updated (though the contents will remain there for a long time).As you can see, the name of the blog has changed to The Julipedia. See this page for more information on its etimology and a bit of history.How did I do the migration? It was not easy; I was able to automate several things, but ended up doing a lot by hand. Of course, I could have spent a lot of time writing and creating a script that did the whole migration, but it was not worth it. Here is a brief outline of what I had to do: I exported all the messages from the old site to XML documents using Livejournal's export utility. This tool works on a month basis, so I had to go month by month (easy). With the XML files at hand, I created a little XSLT stylesheet that extracted the subject and body parts of each post and converted them to a plain text file with extremely simple delimiters. Then I created a Perl script that took this plain text file and wrote a pair of files for each post: one holding the subject and one the body, doing some HTML fixes along the way. With all these little files at hand, I used Blogger's post-by-mail feature to automatically post all my messages (by using a little shell loop and mutt). I will talk about this on another post. Unfortunately, this did not preserve timestamps, so I manually fixed them all. Big ew: 181 posts to fix by hand. At last, I migrated all user comments, also by hand. At first, I thought there were very few of them, so it seemed like a painless task. But in the end, there were a lot (which is a good thing :-).All my posts were migrated using my account. Posts made by other Livejournal users were migrated by using their user name and link to their blog. Posts made by other people were posted as anonymous.I also added a little note on each post with the exact date in which it was originally posted, for archiving reasons. And that is it. It has not been fun, but it is done. I hope you will enjoy the new site as much as I like it! [Continue reading]

  • About The Julipedia

    The Julipedia is Julio M. Merino Vidal's personal blog; this was born on June 22nd, 2004, and was previously known as jmmv's weblog. On October 22nd, 2005, jmmv's weblog was officially migrated from Livejournal to Blogger due to multiple reasons (beeing the ability to control visits the most important one).The transition was an ideal moment to rename the blog to give it an identity of its own, and hence The Julipedia was born. This name was invented by Brainstorm, a friend of mine, who uses to call me by this name. It is composed of two parts, as you can see: Juli, which is the Catalan spelling of my first name, and pedia, which comes after Wikipedia. I believe this is because I often answer his Unix related questions quickly :-)I hope you like the new look and structure of the blog; it should be easier to navigate than before. And, of course, be welcome to the blog if you are new to it!(The aim of this post is to be linked from the Basics column on the sidebar. Its contents can change without further notice.) [Continue reading]

  • How to contact Julio M. Merino Vidal

    If you would like to suggest an idea for a future post, please use the Suggestion box. I will receive a notification when you add a note to that post, so rest assured that I will read it.If you need to contact me personally, you can do it by sending an e-mail to my personal address. If your message is related to NetBSD in some way, you can use my NetBSD address. I will ignore technical questions sent to these (see above).(The aim of this post is to be linked from the Basics column on the sidebar. Its contents can change without further notice.) [Continue reading]

  • Suggestion box

    I am open to suggestions from my readers — that is, you — for future posts. Keep in mind that these are mere suggestions: I reserve the right to talk about those that I find interesting and omit those that don't. Note that this post's comments might be deleted in the future to leave room for newer ones.Here is a non-exclusive list of topics I am inclined to cover: General programming questions — specially if they are focused on C++. General Unix questions — specially if they target BSD systems.General portability questions. pkgsrc internals and questions about the packages I maintain (mostly GNOME). NetBSD internals (to some extent; I will be glad to explain what I have learned so far but I do not know much yet). Questions about my own software projects. Please note that this is not meant to be a technical support forum. If you need help using any of the projects listed above, please refer to their documentation and/or public mailing lists.Yes, I took the idea of a suggestion box from The Old New Thing ;-)(The aim of this post is to be linked from the Basics column on the sidebar. Its contents can change without further notice.) [Continue reading]

  • GNOME 2.12.1 hits pkgsrc

    As usual, the latest stable version of the GNOME Platform and Desktop, 2.12.1, has been integrated into pkgsrc. It has been a tough job due to all the affected packages and comes a bit late, compared to all the previous updates, but I hope you'll enjoy it. [Continue reading]

  • Blogger

    Two years ago or so, I registered a weblog at Blogger, which only lasted a week (don't bother looking for it; it was deleted). At that time, I didn't like that site much, specially because it lacked a very important feature: integrated support for comments. Yes, you could use external utilities/sites to host comments, but that was complex. [Continue reading]

  • Articles: Lightweight web serving with thttpd

    Several months ago I started writing an article about setting up and using the lightweight web server thttpd, focusing on the NetBSD operating system. I finally decided to finish it a month ago and submitted it for publication. You can now read it on-line at ONLamp. [Continue reading]

  • C++: Constructors and global data

    As a general rule of thumb, accessing global data from within class constructors is a dangerous operation and ought to be avoided. The C++ specification does not describe the order in which global variables are initialized, so there are high chances that your constructor accesses uninitialized data, producing unexpected resultsn (e.g., crashes in some circumstances). [Continue reading]

  • Monotone: Using mini-branches to apply patches

    The Monotone VCS provides the concept of mini-branches. A mini-branch is a lightweight branch created inside a formal branch whenever a commit causes "conflicts" with the actual contents of the repository. For example, if your working copy is not up to date and you commit something, you will create a new head within the branch (that is, a mini-branch), that you will later need to (possibly manually) merge with the other head to remove the divergence. [Continue reading]

  • Games: Half-Life 2

    Half-Life 2's Game Of The Year edition was published past Friday. I finally bought it (have been waiting for this since I threw away my illegal copy several months ago); this edition is cheaper than the original game and comes with some goodies. And just a few minutes ago, I completed it :-) (had started with my old saved game, which was almost at the end). All I can say is that the game is really stunning. If you like FPSs, this is The One. [Continue reading]

  • C++: Templates and the ABI

    In the previous post, we saw why inlined code is dangerous in a public API. Unfortunately, I carelessly put templates in the same bag in an attempt to generalize the idea too much, giving an incorrect impression of how they work. A reader (fellow_traveler) spotted the mistake and here is this new post to clarify what's up with templates and an ABI... if one can relate the two concepts at all. [Continue reading]

  • C++: Inlined code and the ABI

    There are many development libraries that provide inline functions (or macros) as part of their public API. This is often done for efficiency reasons, although some times it's done because developers don't know the consequences of doing such things (this last thing is just a guess, but it can perfectly happen). Providing such inlined functions breaks the whole idea of encapsulation and shared libraries. Let's see why. [Continue reading]

  • New utility: verifypc

    After five months or so of not touching the code, I've finally cleaned up my verifypc utility and imported it into pkgsrc. Its purpose is to sanity check the dependencies of a given package based on its calls to the pkg-config program. [Continue reading]

  • Lose vs. loose

    Some days ago, I misspelled lose as loose in one of my posts. One of the readers pointed me out the error and suggested to look at this comic strip from Queen of Wands (never read it before). I think I'll never make the same mistake again ;-) [Continue reading]

  • Cleaning up a Debian box

    I have to confess that, for a long time, I was a big Debian fan; this changed when I switched to the BSDs, but I still think that it is (one of) the best GNU/Linux distribution. This, and because its excellent hardware support, is why it's the main system on my iBook G3. [Continue reading]

  • NFS exports lists rototill

    After two weeks of work, the NFS exports lists rototill that I briefly outlined in this past post is finished and committed into NetBSD's source tree. Believe it or not, the whole set of changes was triggered by a XXX mark in mountd(8)'s code (in other words, fixing code marked as such is not always trivial). [Continue reading]

  • Quality of digital signals

    I have seen many times people thinking that a signal has better quality if it's in digital form rather than in analog form, yet this is false. When you convert an analog signal to a digital format, you always lose quality because you are converting a continuous signal to a discrete one. Let's see a little example: [Continue reading]

  • Linker's link sets

    I don't know about other linkers, but GNU ld provides a very useful feature: link sets. A link set is a list of symbols constructed during link time which can then be inspected in regular code. This is very interesting in situations when you want to initialize several subsystems from a centralized place but don't know which of these will be available; that is, you don't know which ones will be in the final binary. [Continue reading]

  • Interface to change NFS exports

    While adding NFS support to tmpfs, I found how NetBSD currently manages NFS exports from userland. The interface is, IMHO, scary. As NetBSD aims for clean code and design, it must be fixed. [Continue reading]

  • tmpfs: Project merged into NetBSD

    After listening to many queries from developers asking when tmpfs could be integrated into NetBSD, I finally imported the code into the CVS repository. I'm really happy about this :-) Development will be simplified from now on and it will be a lot easier for interested parties to test the code. Please read the announcement for more information. [Continue reading]

  • NFS file handles

    NFS uses a structure called a file handle to uniquely identify exported files. When a client requests to access a file, the server constructs a file handle that identifies it; from this point on, this identifier will be used in all communications between the server and the client to access that specific file. (Look at the fs_vptofh and fs_fhtovp hooks in NetBSD's VFS layer to see how this mapping works.) [Continue reading]

  • FFS, LFS and MFS

    The designers of the Fast File System (FFS) organized it in two different layers aiming for flexibility and code reuse; this happened in 4.4BSD (or maybe earlier, I don't know for sure). The upper layer communicates with the VFS and vnode code while the lower layer accesses the underlying devices and only receives requests from the upper layer. It goes like this: [Continue reading]

  • SoC: The end

    So... the deadline for Google's Summer of Code 2005 program arrived some time between yesterday and today (don't know exactly due to timezones). The final results from my side: a functional memory file-system (not efficient yet) for NetBSD named tmpfs, as well as the beginnings of a book/article on file-system development under NetBSD. [Continue reading]

  • A prompt that does not get in the way

    Yesterday, I saw a screenshot of a developer's box. His prompt was composed of two characters only: a colon and a semicolon (:;). This looks wired, doesn't it? Yes, it does, but there is a rationale behind it: using this prompt, you can copy and paste complete lines from a terminal into another one and they will just work. Why? Because those characters are ignored by the shell (the colon returns success and the semicolon starts another command). [Continue reading]

  • SoC: Project announced

    Despite I don't like doing premature announcements of my projects, I've been kind of forced to do it for tmpfs. The reason is that SoC's deadline is really close now and people should have a chance to test it. Not to mention that the code won't suffer any serious improvements in the subsequent days, so delaying the announcement is not worth it either. [Continue reading]

  • pkgsrc's strengths

    Jeremy C. Reed has collected an excellent list of pkgsrc's strengths. I encourage you to read his post to tech-pkg@ in case you still had doubts about why to use pkgsrc ;-) [Continue reading]

  • Local sockets' permissions

    A few days ago, I was trying gamin under NetBSD which unfortunately didn't work at all. The first problem I encountered was that it complained about the excessive permissions given to newly created local sockets (those stored in the file-system, also known as "Unix sockets" historically). After analyzing the issue, I saw that those files were given 777 permissions, regardless of the user's umask. Strangely, the code was explicitly checking for this mode after creation, so I was probably missing something. [Continue reading]

  • SoC: Status report 6

    This past week has not been excessively productive because I spent some time dealing with long overdue pkgsrc tasks (mainly updating GNOME to 2.10.2, the latest stable version) and was away from computer more time than usual. Anyway, I have done a bunch of things, although they are not as visible as the work from other weeks (this is, in part, why I felt less productive). [Continue reading]

  • Manual ChangeLogs; a thing of the past?

    If you have ever examined the source distribution of an open source project, you'll probably have noticed a ChangeLog file. This file lists, in good detail, all changes done to the source code in reverse order, giving their description, the name of the affected files and the name of the author who did the change. So far, so good. But I really think that these files, or better said, the way they are written and managed, is flawed. Let's see why: [Continue reading]

  • Booting NetBSD with Yaboot

    I have an iBook G3 with Debian GNU/Linux as the primary OS and NetBSD to play with. Yaboot is the boot loader I'm using because it was installed by Debian automatically. [Continue reading]

  • SoC: Status report 5

    I started this week's work by reading the first chapters of Design and Implementation of the UVM virtual memory system to see if I'd learn how to manage anonymous memory. I had been suggested to use anonymous memory objects (aobjs, for short) to store file contents, so I was shown with the task to learn what they are and how to use them. I have to confess that I was afraid of not knowing how to complete the read/write operations for the file-system, because things were very confusing to me even after reading the document. In fact, I spent two or three days reading documentation and code, as well as doing tests, but not doing any real work. [Continue reading]

  • Raw disk devices vs. regular ones

    People have sometimes asked me what is the difference between regular disk devices and raw ones in BSD systems; as an example, take /dev/fd0a and its corresponding /dev/rfd0a. The thing is that I wasn't able to answer them correctly because I didn't know how they really differed. However, while reading The Design and Implementation of the 4.4BSD Operating System during past month, I found the explanation. So here goes a clarification: [Continue reading]

  • SoC: Status report 4

    This past week has been quite productive as regards my SoC project, tmpfs, although at the beginning I was a bit stalled (and afraid of not knowing how to solve the problems I had). [Continue reading]

  • Using 'goto's in C

    It is common knowledge that usages of the goto statement are potentially dangerous in any structured programming language, as their abuse can quickly make your code unreadable. This is why this construction is seldom explained to people learning how to program and their use is strongly discouraged. [Continue reading]

  • Dedicated machine for kernel testing

    During the past month, I had to do all tmpfs development on my laptop. This includes coding and testing. If you have ever done any kernel hacking you know what this means: reboot every now and then to test your changes, which can drive you crazy after few reboots (specially if things keep breaking). [Continue reading]

  • Hollywood OS

    Have you ever been disappointed by how software looks and behaves on almost all movies? If so, just go and read the description of Hollywood OS; it's worth it ;-) [Continue reading]

  • SoC: Status report 3

    It has been a long time since the previous status report; I'm sorry for that, but I haven't been able to publish one earlier. The good thing is I'm finally back from my vacations, so I'll able to work on tmpfs more seriously and continuously from now on (and I have to!). [Continue reading]

  • SoC: Thoughts about tmpfs data representation

    The text below is a message I just sent to NetBSD's tech-kern mailing list. I'm reproducing it here with better formatting and with some e-mail specific sentences removed. [Continue reading]

  • SoC: Status report 2

    After several days since the previous status report, it's time for a new one. During the past week, I've improved several aspects of the existing code, without adding many new stuff. [Continue reading]

  • SoC: Status report 1

    During this past week, I've been working a bit on my SoC project; only a bit because I had to prepare the slides for the NetBSD presentation I'm giving tomorrow at Partyzip@. Fortunately, from now on I won't have anything else to do, so I'll be able to devote all my time to tmpfs :-) [Continue reading]

  • Monotone's CVS gateway, part 2

    After explaining what is the Monotone's CVS gateway, I've been asked to post a little step by step tutorial about it. I'll focus the example towards pkgsrc. Here it goes: [Continue reading]

  • Going on vacation

    I'm going on vacation tomorrow and will be back by the end of the month. I'll bring my laptop with me, but I won't have regular Internet access (unless there is an open AP close to the place, that is). This will make my SoC's project development a bit more difficult, as I won't have my workstation (fast build machine) nor a test machine (very useful for kernel development). [Continue reading]

  • Monotone's CVS gateway

    After a long time, I've finally decided to give Monotone's net.venge.monotone.cvssync branch a try. The code in it implements a bidirectional gateway between Monotone and CVS. What this means is that Monotone can be used for private development while working on a project that already uses CVS (doing the inverse could be... stupid?). [Continue reading]

  • NetBSD conference at Partyzip@

    I just realized I haven't posted about this before... A month ago or so, I was invited by the Partyzip@ organizational team to give a conference about NetBSD. For those that don't know it, Partyzip@ is a party held at Monz�n, Spain: it holds several technological conferences and workshops as well as gaming contests. This is its second year. [Continue reading]

  • SoC: Project page ready

    I've just set up the NetBSD-SoC: Efficient memory file-system project page. At the moment, it includes a list of the project goals, a copy of the original proposal text (in case you would like to read it) and a list of existing documentation. [Continue reading]

  • SoC: The NetBSD-SoC project

    The NetBSD Project has set up a project at the Sourceforge site that aims to centralize the development of the eight projects chosen for the Summer of Code program. Its name is NetBSD-SoC and its page contains information about all the elected projects, information about mailing lists of interest and a CVS repository for the students and their mentors. Read the official announcement for more information. As regards my project, I'll start filling up its page in the site when I've got access to it (probably tomorrow). BTW, all the other seven projects are really nice and I hope all of them to be "finished" (or mostly working) by the end of the summer. [Continue reading]

  • SoC: Accepted!

    After a very long delay, Google has finally chosen the projects that will be part of the Summer of Code program. There seems to be no official announcement in the page yet, but I already received a mail... and... my project is accepted! :-) [Continue reading]

  • EasyTAG

    A few days ago, I finally decided to sort all my MP3s. I started erasing lots of cruft that I never listen to and then renamed some files I had with weird names. I ended up with this layout: Artist/Album year - Album name/Song number - Song name.mp3. [Continue reading]


    So... my faculty became part of the MSDNAA program few months ago. This program is meant to provide students with Microsoft's software — basically operating systems and development tools — for free. The intention (I guess) is to let we, the students, learn how these software packages work so that we use them in the future in our professional career. [Continue reading]

  • SoC: My project proposal

    In yesterday's post, I mentioned that I applied for Google's Summer of Code — a program designed to introduce students to the world of open source software development — and I realized I had not blogged anything about it yet. [Continue reading]

  • MFC: Developing for Windows

    During the past two days, I've been working (again) on my Boost Process library idea. While doing so, I realized that I don't know anything at all about coding for Windows using the MFC. I must learn how to handle processes under this platform to be able to design a correct abstraction layer for process management. [Continue reading]

  • Fragmentation in Unix file systems

    Back in the days when I started to use Unix-like systems (Linux), I learned that their file-systems barely suffer from fragmentation. Nobody ever told me the reason behind that statement, and I never bothered to look for it, since there was no choice in the file-systems area (ext2 at the time under Linux) and there were no defragmentation utilities. Therefore, I assumed it was true... but it's not! (At least not as I understood it.) [Continue reading]

  • pkgsrc: Documentation about pkginstall

    Two days ago I started touching the FAQ chapter in the pkgsrc's Guide and I literally opened a can of worms. The thing is that I started to rewrite the question about configuration files placement (because most of the answer was just internal details of pkgsrc) and ended up writing a whole new chapter about the pkginstall framework. Hope it's an interesting read for you ;) [Continue reading]

  • pkgsrc: mplayer switches to the options framework

    My little project these last two days has been to convert the mplayer packages to use the options framework and deprecate the old-style variables to tune its behavior. This is the "new" (has been around for a while already) way to go in pkgsrc, as it's cleaner, more homogeneous and more flexible. [Continue reading]

  • Unprivileged pkgsrc builds

    As you already know, pkgsrc can be used to build a large variety of software. What you may not be aware of is that it can be used without super-user privileges; i.e., as a regular user, you can take advantage of pkgsrc to build software in systems you do not own! (Provided that you are allowed to do that, of course.) [Continue reading]

  • Distributed streaming

    Data streaming, as known today, lets a single machine send real time data to a number of clients. This number is limited due to bandwidth constraints, as it is expensive (specially on the upload channel). The problem that arises is that individuals or little associations can't set up reliable streaming servers, as they won't be able to pay the costs for it (thus only being able to serve a very limited number of clients). [Continue reading]

  • Styles in word-processors

    When writing a long document in a word-processor... have you ever seen people creating a table of contents by hand? Numbering pages manually? Having to change the font face of their section headers one by one? Poor guys; I often feel annoyed because word processors impose no rules on how to write documents, and people don't care to discover all the marvelous features they provide. Yes, I'm talking about styles. [Continue reading]

  • Shutting up /etc/security

    For a long time, I've been receiving, almost daily, useless security reports from my NetBSD boxes. With "useless", I mean notifications of changes that I know are perfectly legitimate. That is, all they contained was: [Continue reading]

  • pkg-config: Sanity-checking package dependencies

    A while ago, I posted a series of pkg-config related messages: 1, 2 and 3. They were intended to give some background knowledge about that program, to let me easily explain something else: how pkg-config can be used to sanity-check packages — that is, to ensure that the libraries they depend on are the correct ones. [Continue reading]

  • Recent pkgsrc changes

    Eww, it has been a very long while since I wrote the previous post, and even more since I did any serious changes in pkgsrc. Real life tasks get in the middle and take too much time (fortunately, this stressful period is about to end). However, during the last few days, I've been able to work a bit on pkgsrc, so I'd like to comment the changes I've done. [Continue reading]

  • Articles: Making packager-friendly software (part 2)

    More or less a month ago, the first part of my Making packager-friendly software article was published at ONLamp.com. I was happy to receive comments from several people saying that they liked it (sorry if I haven't replied to you yet; I've been very busy during the past few weeks). [Continue reading]

  • Modifying the environment from scripts

    Two days ago, a friend of mine was trying to modify the environment (the CLASSPATH) from within a shell script. Her intention was to run the script and then start working with Java on the same shell were the script was run. This didn't work. In order to explain why, I'm going to review the three different ways to run scripts and how they are related to the current environment. [Continue reading]

  • Increasing RAM to 1GB

    Since I bought my latest workstation (summer of 2003), I'd been running with 512MB of RAM. During all this time, I was "angry" seeing how the system used swap space when it was somewhat loaded — e.g., GNOME running with a bunch of applications in the background (Epiphany, Evolution, aMule, Gaim, Beep Media Player...) and compiling some stuff. You know, when the system uses the swap, the performance (or at least, the responsiveness) decreases dramatically. For some reason, I kept blaming the OS for using the swap, rather than thinking that my hardware was not enough. [Continue reading]

  • pkgsrc: Linux distributions

    As you may already know, pkgsrc is a packaging system that works on many different operating systems — not just NetBSD. Linux is included among these. pkgsrc will work fine on most Linux distributions, but IMHO, there are some that are more pkgsrc-friendlier than others (basically because their original packaging system may be limited). [Continue reading]

  • Articles: Making packager-friendlier software (part 1)

    During the past summer, I started writing an article which details a set of serious problems I usually find when packaging third party utilities. These problems are very annoying, but usually not difficult to fix. They are generally caused because the original software authors are not packagers in most cases, so they are not aware of the things described here. Summarizing: the article analyzes these issues and gives some advice to solve them, in the aim that software developers make easier to package applications. [Continue reading]

  • pkgsrc: Package-related terminology

    For a long time, I've been noticing a recurrent terminology mistake in some pkgsrc-related mailing lists and bug trackers. The error is that some people use the "pkgsrc" word to refer to single packages inside the pkgsrc tree; e.g., they send a problem report with a summary line saying: "New pkgsrc for foo-1.0". This is incorrect and should read: "New package for foo-1.0", but we will discuss this below. (A confession: I did this mistake when submitting my first packages, too.) [Continue reading]

  • The TERM variable

    After reading some messages posted during the last few days in a NetBSD mailing list, I realized that several people do not know what is the real purpose of the TERM environment variable. [Continue reading]

  • pkg-config: Specifying dependencies

    One of the good things about using pkg-config in a software package is that its configuration script can easily specify external dependencies by their name and their version. It doesn't need to mess with other requirements, such as specific build flags or tricks to determine whether the installed library is new enough to fulfill its needs. [Continue reading]

  • Books: The Da Vinci Code

    I've just finished reading The Da Vinci Code, which I started this past Tuesday. It didn't take my attention at first, as it seemed just like many other mystery stories, but after around 50 pages, I was hooked. I can't remember any other book which has captivated my interest so much. [Continue reading]

  • GNOME 2.10.0 hits pkgsrc

    After more than a week of work, I've finally updated the GNOME packages in pkgsrc to the latest and newest stable version; that is, 2.10.0. [Continue reading]

  • XTerm: Anti-aliasing

    One of the things I kept missing in XTerm, compared to Konsole or gnome-terminal, was anti-aliased fonts. But you know what? They are, in fact, supported, as XTerm now — well, I suppose since XFree86 4.0 at least — uses freetype to render text. [Continue reading]

  • XTerm: Setting up scrolling

    Back to the days when I used KDE (that was more than a year ago), I got used to the Shift+Up and Shift+Down keybindings in Konsole (I have to say it's a great terminal emulator). These keys combinations scroll up and down, respectively, a single line of text. [Continue reading]

  • pkg-config: Mixed state in some libraries

    A reply to my previous pkg-config introductory post outlined a real "problem" with "mixed-state" packages. These packages provide pkg-config metadata files in some situations; i.e., not always. This is a quite common situation in libraries that did not use pkg-config in the past, but have been recently converted to do so. Some examples are OpenSSL or the X libraries (which are being converted to the GNU toolchain by Freedesktop.org). [Continue reading]

  • TV series: Dark Angel

    I've just finished watching the second (and last) season of Dark Angel, a TV series I discovered around past summer. All I can say is that the whole series are great, but IMVHO, too short. In fact, that's because FOX canceled them just after two seasons; what a pity. [Continue reading]

  • pkg-config: A quick introduction

    If you have ever tried to check for the presence of a library from a configuration script, you know this is not an easy task. Getting the right compiler (CFLAGS) and linker (LIBS) flags can be very difficult, if not impossible, without manual help from the user. [Continue reading]

  • GNOME 2.10.0 released

    The GNOME Project has just released the 2.10.0 version of its Desktop Environment. This is a new major release of the 2.x branch, which is source and binary compatible with all previous versions in the 2.x series. [Continue reading]

  • How to get the window size?

    Today, a friend of mine raised the issue of how to get the terminal window size from within a program. He had observed in his system an environment variable, called COLUMNS, which was automatically set to the window's width; that variable even changed when resizing the window. [Continue reading]

  • pkgsrc: Yesterday's changes

    It has been a while since I've done any "big" changes in pkgsrc, basically because I've been quite busy with VCS Made Easy during the past month. To make things worse, I've got back to university and there is a lot of work to do. [Continue reading]

  • Tabulators vs. spaces

    Code indentation is a very personal thing; people use 2, 4, 8, or any other amount of whitespace to align their constructions. However, few of them pay attention to the usage of spaces or tabulators to accomplish what they want. Some others do, but problems remain. Let's analyze what these are: [Continue reading]

  • Boost: Shared pointers

    The Boost Smart Pointers library provides a set of classes to manage pointers. I've started using boost::shared_ptr and am very happy with the results. Let's see what it is. [Continue reading]

  • Boost: First impressions

    Despite my previous post, I decided to give a try to Boost and switched VCS Made Easy to use some of its libraries; the modified source code is not yet on the public server (hmm, the joys of Monotone), but I think it'll be soon. [Continue reading]

  • Boost: To use or not to use it

    For at least two weeks, I've been rewriting VCS Made Easy from scratch (and it's already working fairly well), a project I announced a long time ago. It's being written in C++ and the code is organized in three (independent) layers: [Continue reading]

  • Passing information to configure scripts

    GNU Autoconf provides three ways to pass information to the generated configure scripts; these are enable-style flags, with-style flags and command line variables. Despite each one is provided with a very concrete goal in mind, many people overloads their meaning. Their purpose is clearly described in the manual, which these people "forget" to read. (I know it's impossible to read everything one would like to... not an excuse in this case, I'd say.) [Continue reading]

  • How to get the user's home directory

    Many programs need to access the user's home directory to look for files, specially configuration ones. To do that, they usually get the HOME environment variable's value and use it to construct the full path. However, if the application is security-sensible, this is probably inappropriate. [Continue reading]

  • C++: Verifying program sanity

    The C language provides a macro, called assert, that is used to verify conditions that must be true at any point of the program. These include preconditions, postconditions and invariants, all of which are explained in introductory programming courses. Whenever an assertion is violated, the program is abruptly stopped because there is most likely a bug in its code. [Continue reading]

  • C++: Containers of pointers

    One of the things C++ provides to programmers is that pointers can be avoided in much situations, and IMHO, they should be (specially in public class interfaces). However, there are some times in which pointers must be used. [Continue reading]

  • Guessing Tcl/Tk configuration

    When a program uses Tcl and/or Tk, its configuration script (if any) has to check for the presence of these libraries and retrieve some information about them, such as their version, the required link flags, etc. Unfortunately, the process to achieve this is rather obscure (AFAIK), thus it is unknown by many people. This results in unportable (and broken) configuration scripts. [Continue reading]

  • C++: Exceptions and destroyers

    If you use exceptions to signal errors in C++, you should be really careful when throwing an exception from inside a class' destroyer function, because you can easily cause an abort trap. Consider the following code: [Continue reading]

  • Alternatives added to pkgsrc

    A few days ago (on the 25th), I finally added the alternatives framework to pkgsrc; haven't had a chance to write about it until now. [Continue reading]

  • GNOME Panel easter eggs

    Today I reinstalled GNOME from scratch on my machine due to a mistake I made yesterday (which blew away half of it). After starting it, I saw a problem I had never noticed before. I have been able to solve it, although I haven't figured which is the root cause yet. Anyway, while looking for where the problem was, I discovered three easter eggs in the GNOME Panel module. If you don't like spoilers, stop reading now. [Continue reading]

  • vr(4) problems

    Since I started using the vr(4) driver (i.e., when I switched my network to twisted pair cables), I've been experiencing very annoying crashes when running in promiscuous mode. This happened rarely at boot up, while dhclient(8) fetches its first lease. However, if you happen to use any other utility that puts the NIC in promiscuous mode, such as tcpdump(8) or bridge(4), the crashes happen almost 95% of the times. [Continue reading]

  • Alternatives become wrappers

    Todd Vierling made some interesting suggestions about the alternatives stuff. I didn't like them at first, but the more I thought about them, the more I realized they were the way to go :-P [Continue reading]

  • Alternatives system in pkgsrc

    Inspired by the recent comments of a user, I decided to implement an alternatives system for pkgsrc, similar to the one used by Debian. The purpose of this framework is to manage symbolic links that point to specific programs from a group of utilities with similar behavior. [Continue reading]

  • QEMU

    Today, I decided to try the QEMU CPU emulator. I installed it and, after fighting several problems caused by incorrect flags passed to the compiler, I got it working. [Continue reading]

  • Automatic verification of PLISTs

    pkgsrc uses static file lists to register the contents of an installed package. A drawback of this approach is that the file list of a package may occasionally become out of sync with reality. I.e., it may omit some files that are really installed, thus leaving them orphaned, or specify extra files that are not really copied into place. There are multiple reasons that can cause this desynchronization, including careless updates, incorrect detection of dependencies or, even worse, files that are only installed depending on the OS you are running. When some files are not properly installed, pkgsrc can easily tell you that an error happened, because it will not find all the files listed in the static list. However, the opposite situation is hard to detect, and it was not possible up until now. [Continue reading]

  • Monotone dedicated server

    Some weeks ago, I installed Monotone on my main machine to act as a dedicated server for Vigipac's source code. During the process, I had to write a rc.d script and configure multiple things to get everything working safely. The overall process is not difficult once you know how Monotone works, but it is quite time consuming and error prone (due to concrete file permissions, for example). So I thought I could share my work to make this process easier to other people and love pkgsrc even more ;-) [Continue reading]

  • Kernel debugging tutorial

    I recently had two crashes while killing a process which are very likely to be caused by the kqueue code. I asked NetBSD's current-users@ mailing list about the issue and got an answer suggesting the reading of a paper. [Continue reading]

  • NetBSD 2.0 beats FreeBSD 5.3 in server performance

    Gregory McGarry has published an article that benchmarks NetBSD 2.0 and FreeBSD 5.3 in multiple situations that can be of interest in production servers. This includes scalability, reliability and performance in areas such as sockets, threads, process creation... [Continue reading]

  • Tracking down a deadlock

    Yesterday's night, I packaged Vino, a VNC server that integrates seamlessly with GNOME. After creating the package, I ran vino-preferences and saw it crash with the following assertion: [Continue reading]

  • Epiphany's scrolling

    For a long time, I've been believing that Epiphany, the GNOME web browser, was broken when installed through pkgsrc. And I was starting to hate it. [Continue reading]

  • VigiPac is now public

    First of all, happy new year! [Continue reading]