Category: Software

  • killing a process in TCL

    Suppose you had spawned a process in TCL and knew its PID and wanted to kill it? Sounds simple enough thing to do, right? This problem has plagued me for many months because some things you can assume on a normal system do not hold true on strange environments, such as build deaemons.

    Seems simple enough, I started off with:

    exec kill $pid
    

    Except.. not every environment has the kill binary, and with that piece of code exec has to be a binary and not a shell builtin. The funny thing is that /bin/kill is in the procps package, which is the package having the buildd problems.

    So next idea was to use command -v to check for the existence of kill and skip those tests that needed kill if not found. Good idea except, so I found out later, it also finds built-ins. That means we are back to problem .

    There is a kill command in tcl, but it requires tclx. That seems excessive for just one little simple command. How can I run a shell out of TCL that runs the kill builtin? On the command line, something like below would do it.

    /bin/sh -c 'kill 1234'
    

    I was closer, but then hit TCL quoting hell. No matter what I (initially) did I’d either get the shell to complain or my variable to not be evaluated. In the end, I had to write it to a separate variable for the command line then apply that to the exec. Not perfect but at least it works now.

    The resulting code (found in testsuite/config/unix.exp) looks like:

    proc kill_process pid {
        set cmdline "kill $pid"
        if { [catch { exec /bin/sh -c $cmdline } msg]} {
            warning "Could not kill process: $msgn"
        }
    }
    

    Perhaps there is a more elegant way, I’m certainly no star TCL programmer, but of all the combinations I saw this was the only that worked.

  • Sneak peek of top graphs

    Jim has been busy as part of the procps-ng team that looks after top. Basically all the changes you find in top from around 2.7 or so are by him. Not satisfied enough with fixing top, making it faster and showing more fields, he has given us CPU and memory graphs.

    He also thinks I don’t have enough colours (or as he would put it colors) on my top output so I’ve posted what the new top looks like for me so you can see the graphs and he can see my colours.

    top, with colours
    top, with colours

     

    I think it is both colourful and useful addition. The colours have been available for a while now and the graphs will appear in the next upstream release of procps-ng.

     

  • A python utf gotcha

    This one had me stumped for a while:

    # -*- coding: utf-7 -*-
    import datetime
    from sqlalchemy import ForeignKey, Column
    from sqlalchemy.types import Integer, Unicode, Boolean, DateTime
    
    default_due_date = datetime.datetime.now() + datetime.timedelta(days=30)
    

    Syntax error found on last line.

    Hmm, bring up a python interpreter and type the last line in with the imports. Works fine.

    It’s the first line that is the problem, I typoed it and made it utf-7 not utf-8. I suppose it means that it is case-insenstive. Still, it wasn’t too clear to me at least, what was going on.

    Enhanced by Zemanta
  • WordPress update needed for stable too

    Yesterday I mentioned that wordpress had an important security update to 3.8.2  The particular security bugs also impact the stable Debian version of wordpress, so those patches have been backported.  I’ve uploaded the changes to the security team so hopefully there will new package soon.

    The version you are looking for will be 3.6.1+dfsg-1~deb7u2 and will be on the Debian security mirrors.

    Enhanced by Zemanta
  • psmisc 22.21 Released

    Today as it was raining and I couldn’t do much gardening, psmisc version 22.21 was released. The files are located up on sourceforge at https://sourceforge.net/projects/psmisc/files/latest/download or at your favorite distro repository soon.  Once again, thanks to all patch submitters, bug reports and translators for all their help in getting this out. Apologies to the translation teams for having two alpha versions.

    So what does psmisc 22.21 bring you? Amongst a lot of minor bug fixes it has:

    • If you started a process and then spawned some threads and then decided to change the names of the threads, pstree would show the “old” name, it now shows the correct new name
    • pstree has a new flag (-N) for namespace support, thanks Aristeu for the patches
    • Previously fuser -M flag only worked if it was before -m, now it can be either order

    The Debian psmisc package should be out in the next few hours.

    Enhanced by Zemanta
  • jffnms 0.9.4

    JFFNMS version 0.9.4 was released today, this version fixes some bugs that have recently appeared in previous versions.

    Alarmed Interfaces and Events
    Alarmed Interfaces and Events

    The triggers rules editor had a problem where some of the rules clicked off the triggers would not appear or could not be edited correctly.

    Most of the Admin screens have the ability to sort the rows. This, unfortunately, didn’t sort but the functionality has been restored.

    Most users are probably unaware of this, but the database schema is first created for MySQL and is then converted for PostgreSQL. The conversi0n process is far from ideal and hasn’t worked until this release. More testing is required for PostgreSQL support but it should be a lot better.

     

    Enhanced by Zemanta
  • Debian's procps 3.3.9

    While the upstream procps which was released last week has a new pidof, the Debian package will continue to not have that binary and the

    Debian sysvint-utils package will continue to have that file. That stops any messy procps splits and putting one part into Essential etc.

    This may mean that one distributions pidof doesn’t quite work like anothers, but that has been like that already; which is why when I discussed the change as upstream I wondered where they found some of those flags I don’t have.

     

    Enhanced by Zemanta
  • procps-ng 3.3.9

    Procps version 3.3.9 was released today.  As there has been some API changes and fixes which means the library has changed again.  There is a fine balance between fixing or enhancing library functions and keeping the API stable, with the added problem it wasn’t a terribly good one to start with.

    Besides the API change, the following changes were made:

    • kernel namespaces support added to skill, pgrep, ps and top
    • pidof was reimplemented from scratch (replacing sysvinit pidof)
    • ps has configurable libselinux support (–enable-libselinux)
    • ps provides for display of systemd slice unit (–with-systemd)
    • free can once again report non-zero ‘shared’ memory
    • sysctl provides ‘–system’ to ignore missing /etc/sysctl.conf
    • watch interval capacity was increased – debian #720445
    • pwdx no longer fails in a nonexistent locale – debian #718766
    • top clarified summary area Mem/Swap stats – debian #718670
    • top batch mode -w (width) abend fixed – debian #721204
    • top man page removed ‘Bd/Ed’ mdoc macros – debian #725713
    • top no longer clears screen at exit – redhat #977561
    • top adapted to potential libnuma stderr message – redhat #998678
    • top added missing batch mode newline – redhat #1008674

    Tar file is at sourceforge at https://sourceforge.net/projects/procps-ng/files/Production/

  • XBMC with MythTv

    I have had MythTV running on my server for quite some time. Once I got past the weird problems you often have with the local ABC channel, it has worked very well. One tip, put the recordings into their own partition. MythTV will happily fill it and deleting files only marks them for deletion. This makes perfect sense when it has its own partition but is annoying otherwise.

    Until recently, the frontend on the television in the living room was a DVD player that spoke DLNA. This worked ok, but was very basic. The recordings were just a list with no graphics or details. Something better had to go here and it has; XBMC.

    A small (size of a paperback) PC later and we have XBMC running and doesn’t it look pretty! The cute thing was it merged my DVD images and my recordings into one, so it didn’t matter where the movie came from, it looks the same. It even understands MythTV advertising marks and skips them, all is good.

    Except, no sound. This is where a combination of my Google skills and XBMC’s documentation failed.  The documentation either says switch to HDMI output or go through a very long and involved process to get the sound card working.  The tests on the command line failed and I thought I was going to be in for that long and involved process fixing alsa.

    Then in another part of the menus I saw you had Basic, Advanced, Expert levels and wondered what that did? It gave me more things to tweak in the menus. Perhaps that might fix my HDMI sound problem?  Going into the System setup and then audio and then switching to a higher level of menu (it’s on the left) suddenly I have a screen and a half of options and a few seconds later, sound!

    So if you are searching for NVIDIA and HDMI and sound, first turn on the advanced menu items and try setting that, it might be all you need (despite what Google and documentation says).

    One other thing, the C or I button on  a remote could be called “Guide”. It is on mine.

    Also, SMB shares give a much better result than DLNA ones because SMB all the images and info are done on XBMC and it doesn’t do the same for DLNA.

  • Quieting dbus

    I run a program called logcheck which regularly scans the logfiles looking for “interesting things”. One of these interesting things (to logcheck, not to me at first) was dbus complaining about mythtv.  The logs look something like this:

    Nov 17 05:08:18 elmo dbus-daemon[1621]: dbus[1621]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.236" (uid=999 pid=3669 comm="/usr/bin/mythfilldatabase --verbose general --logl") interface="org.freedesktop.NetworkManager" member="GetDevices" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=1930 comm="/usr/sbin/NetworkManager ")

    What this is is the dbus daemon rejecting a message being sent from mythfilldatabase that wants to go to NetworkManager.  Looking at NetworkManager’s dbus configuration, its doing all the right things.

    So it’s a simple matter of just fixing up the dbus configuration and you’re done. Then I hit the first snag; the dbus documentation is a little sad. I remember seeing a show where they MRI scanned some artifacts to get to the writing and then used a maker-bot to recreate the hidden writing. They then painstakingly translated it using a team of experts to work out the English translation.  Working out the dbus configurations is not quite that difficult, but it’s close.  The easiest way is to copy something and see if it works, which is what I did.

    I created a file /etc/dbus-1/system.d/mythtv.conf which permitted the myth user access to the GetDevices method. It looks like:

    
    
            
                    
            
    
    
    

    Reloaded dbus and all went quiet.

     

     

    Enhanced by Zemanta