Author: dropbear

  • When a dynamic library and program share functions

    This is about making procps have a proper library but it really is a generic sort of question.  Say you are making a library and a program that uses that library.  Now at times you may have convience type functions; procps has them for things like escaping command names or allocation different sorts of memory.  Both the library and the programs use some of these functions.

    Now, there seems only two approaches to this setup.  The first is to have the function stay in the library and for the program to call this function, just like all the other library functions.  But this means the library has exposed for all other programs that link to it and that doesn’t really make a lot of sense.

    The second method is to have the functions defined in both places, perhaps in a file that is linked with the program and the library.  That seems to be duplicating the code in two different places.  Namespace collision could be a problem but that easily fixed with using some unqiue prefix.  I really don’t think having procfs_malloc, procfs_calloc and procfs_strdup are that useful.

    I’m sure this sort of problem has been solved elsewhere.  Has anyone else come across this? The functions are simple utility type functions such as malloc a block of memory, if there is a problem print to stderr.

     

    Enhanced by Zemanta
  • procps-ng 3.3.1 released

    Procps-ng, the Debian, Fedora and OpenSuSE fork of procps had another release today.  This is a bugfix release that fixes some important bugs that have cropped up in 3.3.0

    pgrep crashes, pgrep -u not finding processes and a problem with top forest view have all been fixed.

    An important addition to this release is that test scripts have now been added using the Dejagnu framework.  This framework tests most of the programs that ship with procps-ng.  There is only 100 tests so far and they are only tested for Linux architecture, but we expect to increase this test count and sophistication with each release.

    The test scripts even found long-present but unknown bugs in the package. For example, running ps with output flags around the signal masks work as expected in Linux, but fail on kFreeBSD.  This is due to the unusual output of the relevant lines on that architecture. This is not a new bug, bug has been around for quite some time; noone ever noticed (or reported) it.

     

    The Debian package has already been built and uploaded to the master FTP server.

    Oh, and it is the first package with my new GPG key!

     

     

    Enhanced by Zemanta
  • New procps 3.3.0 for Debian

    Coming soon after the upstream procps 3.3.0 being released, the Debian packages have been uploaded tonight.  The Debian packages have had the added benefit of being a day late by having a tiny 2 line patch to stop pgrep from crashing.

    One regression that is on purpose, watch is currently not 8-bit clean again until I can sort out how to get the linking right with the new build process.

     

    Testing Systems

    The embarrassing problem with pgrep did start a discussion about testing, especially regression testing.  I’ve recently started using unit testing in my python programs and love the level of assurance those tests give me that I haven’t broken anything (to a degree anyhow). I’d really like to be able to type “make test” and have each of the programs run through a series of tests.

    The problem with packages like procps (psmisc too) is that you really need to test the entire program, not just a stub, and that the program needs access to a know level of /proc.  The only thing I have seen that is even remotely what is needed is the bunch of scripts that coreutils uses which creates dummy files and directories to operate the commands on.  I expect we could do something similar with some scripts that create a known process but if anyone has a better idea about how to test a command line program let me know.

    Enhanced by Zemanta
  • procps-ng 3.3.0 Released

    Tonight procps-ng, a fork of procps by developers from Debian, Fedora and SuSE was released.  The main goal of the team for this release was to reduce the number of patches we all carry in our respective distributions and learn from each other.  As an added bonus, we had one of the original authors of top, Jim, join the team and greatly enhance top.

    While the upstream version is now released, the Debian package is not quite ready to go as it involves removing a lot of patches and adjusting some others.  The build system is also now a reasonably standard (but different to previous) setup that means the packing scripts need adjusting.

    The best place to find out what is different is the procps NEWS file. The source code is available from Gitorious  at https://gitorious.org/procps

    Enhanced by Zemanta
  • @ 0x28

    It doesn’t look so old in hex; Zero, x, Two, Eight  but I finally got there.  So on this day, what other landmarks am I up to?

    • I’ve been programming, on and off, for 28 years (thanks for teaching me Chris – anyone still use LOGO?)
    • Writing Free Software for 17 years (thanks Terry for explaining the concepts and giving me my first Linux)
    • A Debian developer for 14 years (thanks for telling me and eventually adding me Bruce)

    Some people get a little sad hitting this age, but it really is only a number, wether it is 0x28, 50 or even 40.  As the saying goes: only the dead don’t age.

     

    Enhanced by Zemanta
  • ncurses library split

    The new ncurses library that is currently sitting in the NEW queue will have a significant change that, if we’ve done it right, should be an invisible change.  If we’ve got it wrong, then the BTS (and us) may be a little busy.

    What has happened is that the low-level terminfo library has been split out from the general ncurses library making a new package called libtinfo5.  This also means that there only needs to be one libtinfo5 package because at this low level it doesn’t care about wide characters, so there is no libtinfo5w (and that gets important later). libncurses is linked to libtinfo so from the point of view of using libncurses there should be no major change in how things are done.

    So, why bother?

    The way ncurses was built before causes a nice long “conga line of trouble”.  There really are (was) two main ncurses library packages, libncurses5 and libncursesw5. The w meant it was for wide characters. So anything that uses ncurses needs to decide which one to link to or perhaps both. A problem came up with the readline library that needs to link to ncurses because programs that link to IT (such as python) want a wide library but other programs do not. One solution is to have two readline libraries, but then any other library would need to be compiled and built twice as well and so on and so on.

    readline didn’t really want the full ncurses library, it only wants the terminfo part but there was (until now) no way of picking up that bit only.  Once this new version of ncurses gets released then readline can link to libterminfo which is agnostic to wide and non-wide characters which means it is as well which them means everything else should, in theory work.  If you are using ncurses for some low-level terminfo work only, you may want to have a look to see if you can link to libtinfo5 only which will mean depending on libtinfo5 and not libncurses5 or libncursesw5.

    I’m just writing this up mainly and uploading the packages, the bulk of the work was done by Sven and Matthias as well as some help from our ever-helpful upstream Thomas.

     

    Enhanced by Zemanta
  • Getting music into the iPod Shuffle

    IPod shuffle
    Image via Wikipedia

    Sounds easy doesn’t it?  You got a nice Debian computer filled with mp3s and you got an iPod Shuffle. You want to get the mp3s onto the Shuffle, simple really!

    Well, no.

    I’ve got a 2nd Generation iPod Shuffle; its a little blue thing the size of a postage stamp with no screen. Specifically a model A1204.  It uses the headphone socket with a special connector to get it connected via USB.  It also steadfastly refused to play anything I transferred onto it.

    gtkpod was first.  I knew I was in trouble when my model doesn’t appear in their list of supported devices. 2nd Generation Shuffles do, just not an A1204.  After a lot of fiddling around and playing with special files and firewire IDs I got a file onto it. Great, but then turning the iPod on I got the green and orange sequence of lights which means no file found.

    Next, was Rhythmbox.  It is supposed to understand iPods too.  The funny thing was that it saw the music file I put on the iPod by gtkpod, but adding any file gave me the same colour sequence.  What was worse is if you tried to look at the information about the iPod, Rhythmbox crashed.

    It seemed I was doomed to use iTunes on the windows computer in the living room.  A program that seems designed not to work the way I want. (It tries to load all the mp3 files from my son’s games into the iPod but ignores my music on the samba share, for starters).

    I just wanted the files on the player and the player to recognise and play them.  It didn’t seem like a too hard a task, but I was stuck.  That was until I found a small (643 lines) python script called rebuild-db that builds the special iPod files with my music.  I found the file at the rebuild-db sourceforge page and it was very simple process.

    Now I plug the iPod in, wait for the window to appear, push my songs onto the iPod and run the script.  It’s quick and simple and more importantly it works.  Not bad for a program that hasn’t been developed since April 2006.

     

     

    Enhanced by Zemanta
  • Debian turns 18

    In Australia, 18 means you can do things like vote and drink. While most don’t get terribly excited about the first, the second usually happens on your 18th.

    And so 18 years ago Ian Murdock brought together the new Debian distribution. I’ve been along for the ride for 14 of those 18 years and it certainly has been a fun time and what a lot of differences it has been since then. Debian is not only one of the best distributions around, but has an important place in ensuring there IS a Free Software distribution.

    So raise your glasses (mine’s the one with the chilled filtered water, its 8am after all) and wish Happy Birthday to Debian, may you have many more.

    And if you’d like some calorie-free cake, hope over to DUG’s site where they have been busy making Debian Birthday Cakes. Just looking at that yummyness won’t be too bad for you, unless it makes you hungry now.

  • Be careful with dspam and multi-arch

    Do you use the Debian dspam packages, specifically with one of the database backends? Recently upgraded the packages? Does noone email you anymore?

    You might be bitten by a bug, or perhaps undocumented misfeature, that bit me this morning. No emails were coming in and yet the mailserver logs said they were coming in, but a closer look at the logs showed this:

    Aug 15 09:08:17 elmo dspam[24896]: dlopen() failed: /usr/lib/dspam/libpgsql_drv.so: /usr/lib/dspam/libpgsql_drv.so: cannot open shared object file: No such file or directory

    What happened here? A quick look at the installed packages said the pgsql backend was still installed but this file was not being found.

    The latest version of libdspam7-drv-pgsql now has multiarch support which means /usr/lib/dspam no longer exists and the driver is found in /usr/lib/x86_64-linux-gnu/dspam. The problem happens because the configuration file specifies the directory and that has now changed. The fix is as simple, update /etc/dspam/dspam.conf with the new path.

  • Making peace with Network Manager

    Painless they say, automatically they say.  This is what the NetworkManager manual page describes the daemon.  I’d like to say annoying and intrusive and I know there are a lot of people out there that feel the same.  The program is used to set-up network connections and provides a system tray thingy for Gnome and for simple set-ups its great.

    Sure, I got NetworkManager running on my laptop and we’re all friends over there.  It just works, it just works for my local network, wireless network and even 3G and VPNs work just like they should.  This is the environment where it was designed for and it shows.

    What about on the server where I login using gdm?  We’ve had nothing but a world of pain there.  It used to be bad enough when it fiddled with /etc/resolv.conf meaning DNS stopped working everytime i logged out.  Every “stop playing around with my settings and leave me alone” option fails to do just that.  It got so bad I had to use chattr to make the file immutable; so if you are tearing your hair out, then chattr +i /etc/resolv.conf is your friend.

    The latest version of NetworkManager takes this insanity to a new level.  Now not content with messing around with my resolver files, it reconfigures my statically assigned IP address to a dynamic DNS one AND removes it when I logout. No doubt if it let it, it would muck around with resolver files too.  Again, by default on a laptop this is fine.  The problem is the ‘would you leave me alone’ options fail to work, or mean stupid things happen like pidgin doesnt think there is a network so never logs in.

    So I resorted to reading more about this intrusive program and was there a way of stopping it doing what it was doing.  The directory /etc/NetworkManager/system-connections looked promising as they were connections available at boot time and across all users.  But then there is the funky format and wow, nothing saying what you might need versus what if you have missing makes the thing fail.

    What’s not obvious is that if you edit your network connections and then select ‘available to all users’ then your settings go into that system-connections directory and that for the moment appears to be working.  It means I have my network settings configured in two places which means all sorts of fun if I change them and forget about the other.

    This isn’t an ideal situation and network manager should start to behave properly and read the ifupdown stuff and use it but not muck around with settings if it is told to.  There are options that imply they do this but they don’t work.  Despite the title, I don’t think peace has broken out between me and Network Manager but rather an uneasy truce; I’m sure that program is just sitting there thinking of what other settings it could play with when my back is turned.

    Enhanced by Zemanta