Nice picture

Posted on: Mar 2008

Well, not much to say these days...

Einstein

Sometimes we have to find a reason to laugh, even a little bit... I found this picture very funny. :)




Kwort 2.4 released

Posted on: Mar 2008

I'm proud to announce that Kwort 2.4 final version has been released after a very long time (more than a year). The system is very stable and very usable.

The core system is based on Slackware and provides a rock solid system, and it's also a great place to start making a full featured and usable desktop environment using Xfce. This version includes several changes from 2.2 from a new toolchain to a completely new base system. The inclusion of hal provides a great way to communicate the hardware with the desktop making the system a lot more user friendly.

Good things in this new version: * Hal: As I said before provides a lot of new features giving the desktop some kind of control of the hardware. * New init system: Kwort 2.4 includes a new init system written mostly from scratch. Also it puts all the work together with the new service command. * Linux 2.6.24.3: The latest stable version of the linux kernel. * Kpkg: The new version of kpkg was re-written from scratch. * Kwort User Manager: Provides a simple way to create and remove users with default Kwort templates. * Xfce: This new version integrate great with hal. * Ristretto: The image viewer of the Xfce project. * Mplayer: The most famous video player on Linux is now included in the iso. * Pidgin: The latest version of the best multiprotocol IM. * Mpd+Gmpc: This is the new combo to play media files in Kwort. Just put your media files in ~/Music, go to gmpc, give update and play.

As in every old version now comes the things that I look forward to improving: * Better support for wireless devices: This is not part of Kwort itself, but the kernel, but finally affects Kwort users. * Amule: Once again amule is giving the hebbe-jeebes. There is no stable version of amule that works well enough with Kwort. The latest version is dated from middle of 2006 wich is very old and buggy with newer versions of wxGTK.

Screenshots available here: http://kwort.org/?n=Main.Screenshots

People who I would like to thank: Andreas Schipplock for making and maintaining the website, mirroring the iso, working in Kwort core (he made most part of the job with Core) and bring lzma support to Kwort. Stijn Seger for working in some packages like openntpd and the pm support. And writing the Kwort user manager. I would like to give a special thanks to the users who ran tests specially to David Luskovec and Juan Martin Villanueva, if it wasn't for you guys, this iso would take even longer to come out. Manuel Naranjo for reporting bugs, submiting patches for the new init system, hosting the iso and run test all along Kwort core. Also, I would like to thank all the mirror providers: Ricardo Brisighelli for the development mirror in the UNR, Alberto Ferrer for the mirror in Emanon Linux and the AIRcable people for the mirror at aircable.net. Finally, but not less important a very big THANKS to Patrick Volkerding for Slackware Linux, the system kwort is based on. I hope I didn't forget anyone.

As usual, if you need support, help, or you just feel like talking about Kwort (or anything else), or you just want to meet the people who is behind Kwort, you can join us on IRC: irc://irc.oftc.net/Kwort




ktsuss 1.3... Finally

Posted on: Feb 2008

Well, today I'm releasing the new ktsuss. It toke quite some time, not because it was too much work, but because I didn't the enough time to finish it. This new version includes the new authentication backend, and the new interface, which I have to say it's quite better than the old one. The main setuid program has a better comand line parser, not for the user, but if someone wants to understand it, is quite easy.

I would like to thank Christian Dywan for putting so much work in the graphical interface, he made an excellent job with it. I would like to thank too to all the people who reported bugs to make this release the best one.

Summary: https://developer.berlios.de/projects/ktsuss

Changelog: here

Download link: here




Why ktsuss use setuid

Posted on: Feb 2008

Well, this was the question made by one of the debian packagers. I see a good thing the fact that they ask this, since including a program setuid without asking the reasons would be kind of dumb. They ask why not using pam or su in the way gksu does, so I will try to answer these questions.

Using pam would requiere setuid too (since pam_unix2 doesn't have it's own wrapper), which doesn't bother me as long as I program in a secure way... What really does, is that not every distribution out there use pam, slackware is the most important it comes to my mind now. Using su, well, there might be a problem there, gksu does it in a very unportable way waiting for the string " Authentication failure" which is a very bad idea, look this example:

Fedora "su" command:
-sh-3.1$ su
Password:
su: incorrect password
-sh-3.1$
Slackware (Kwort) "su" command:
nomius@Neptune:~$ su
Password:
Sorry.
nomius@Neptune:~$

As you can see in gksu, different versions of su would really break things up. None of above shown implementations gives " Authentication failure". I guess that message is given by pam with strerror(), so once again, it's not portable.

The actual ktsuss code is very clean and simple (which is the whole idea behind ktsuss), I always gave security with the authentication backend, maybe a feature bug (like the PATH thing in 1.1), but not security issues.

There might be a way using su better than what gksu does, something like doing "su -c exit" (pepping the password of course) getting the exit status with WEXITSTATUS(), waiting for 0 (password ok and then run su command with the same password) or 1 (wrong password). But would be kind of messy... I should see that like something in a long distant future... But I think it could be a way to avoid the paranoid.

So since ktsuss have its own implementation of authentication backend, that's why it needs setuid.




MPD: What's missing?

Posted on: Jan 2008

I been using mpd+gmpc now for a while, I really like the combination, but what I missed on it was the ability to modify tags, which normally all players can do. Well, I started working on gmpc to add support for tag editing when I stopped with the following issue: The fact that mpd doesn't support tag editing was the reason for gmpc to not support it (which makes sense), because mpd is run on a different machine so gmpc does not have access to these files. Some of you will tell me "Dude! Sonata supports tag editing even when mpd doesn't", and I know, but what sonata does is actually a very like a "half done work" with that, as you can only edit tags if mpd runs on the same machine sonata is running, which normally doesn't happen (that's the idea of a client-server structure). So, now, my approach to resolve the problem was completely different as I had to include a new command in the mpd protocol so I could add tag editing support. Well, I did include the command, I did gave support to tag edition and I even gave a command to check if the file can be edited or not. Finally, I gave support to libmpd and gmpc, so now, gmpc can "full edit" tags. :-)

So here are the patches (descriptions on how to use the commads can be found in mpd's patch, and descriptions on how to use the new functions libraries can be found in libmpd's patch): MPD (stable version, by now 0.13.0): mpd-0.13.0-tageditsupport.patch

LIBMPD (stable version, by now 0.15.0): libmpd-0.15.0-tageditsupport.patch

GMPC (stable version, by now 0.15.0): gmpc-0.15.5.0-tageditsupport.patch

Now, the main problem wasn't the code itself, I mean, I had to spend some time investigating the code to finally hint the right keys. But the problem is now in what mpd developers want to do with this patch. Some developers like it (specially client's developers and users, like Qball Cow and Scott Horowitz), but others disagree. I really understand both sides (I have to admit I like more mine's, that's why I developed this patch). Some argues that the patch will add more code to maintain, but actually, the mpd's patch is not more than 300 lines (so that excuse looks more like a joke), others say that mpd is just a music player with a client-server architecture, and not a tag editing software, and I really understand this philosophy. But IMHO I think that if mpd wants to take care of the music this is like "a must have".

Since this made very people a little uncomfortably, I see this like something good, not because of the internal fight/war, but because it helps to discuss the development. The fact that is being considered means the project is still alive and defining issues while the time is going on. People say that if this doesn't get in trunk tag editing is off the table. Well guys, if that happens, bad luck.

Anyways, Kwort 2.4 will use mpd+libmpd+gmpc with tag editing support. :-)




The childs of my son are my enemies... What about their childs

Posted on: Nov 2007

I had to deal with this problem related to process sincronization some months ago, and since Kwort 2.4 core edition is waiting for Linux 2.6.24, I will show you what my problem was and how I dealed with it.

I was trying to run a process, this process forks itself and ran some bash scripts. So far there's nothing bad on it, the problem is that those shell scripts create some childs, and it is more than sure that the parent (the main script) die before the childs, so I'll get some orphans process. And the main C program shouldn't die before all the childs die.

So, let's take for example the code in the first post in this blog "Checking the network with bash". In this case a wait in the end would fix the problem, but let's just think that we can't modify this script:

#!/usr/bin/env bash

function pinging(){
    SUBNET=${1}
    LAST=${2}
    PING="$(which ping) -c 1 -W 1"
    ${PING} ${SUBNET}.${LAST} > /dev/null 2>&1
    if [ $? -eq 0 ]; then
        echo -e "${SUBNET}.${LAST} is up"
    fi
}

if [ -z ${2} ]; then
    for((x=1;x<255;x++)); do
        ${0} ${1} ${x} &
    done
else
    pinging ${1} ${2}
fi

So, this was the first attempt to control this mess but unfortunately didn't work as expected because this process was in another Process Group ID (avoid comments about controlling the return value of fork and such, since this is an example of something that didn't work):

int main(int argc, char *argv[]){
    int status;
    if(fork())
        waitpid(-1*getpgrp(), &status, 0);
    else
        execlp(argv[1], argv[1], argv+1, NULL);
    return 0;
}

So, basically, the idea was that the main C program shown above shouldn't die until all the childrens of the scripts die (that's why I was using using getpgrp(), which didn't work as expected for what I explained above). On Linux, running ps axfj, showed me that the small childrens (those one generated by the script) are in the same group, but I couldn't wait for them, as they are not my childrens, but then child of my child process children's.

After dealing a little of time I came up whit this program that control all the childrens, grandchildrens and rest of the "family". The code is very simple to understand and explains on itself:

int main(int argc, char *argv[]){
    int status;
    pid_t pid;
    if((pid=fork()) != 0) {
        sleep(2);
        waitpid(pid, &status, 0);
        while(killpg(pid, 0) != -1)
            usleep(0.1);
    }
    else if(pid==0){
        setpgid(getpid(), getpid());
        execv(argv[1], argv+1);
    }
    return 0;
}

Thanks to Marcel, who actually helped me a lot with some concepts and ideas to find a workaround to this.




ktsuss 1.2 released

Posted on: Sep 2007

I just released ktsuss 1.2. There's not much to say about this new version. The most important changes were made to the GUI which now uses a native gtk dialog instead of a custom window. (Thanks to Christian Dywan for the patch). Ktsuss now allows running applications as any user instead of root only. The code was in the authentication backend, now it is used in the GUI. Added to the main launcher are options -v, --version, -h, and --help.You can read the full changelog and download the new version here: http://developer.berlios.de/projects/ktsuss

Screenshot as usual:

ktsuss 1.2

Finishing... You guys know, report bugs and all that kind of stuff. ;)




Some flashlights of Kwort 2.4

Posted on: Aug 2007

Well, me and the rest of the team are working in Kwort 2.4 (2.2.2? I dunno, but I think 2.4 will be alright).

Andreas Schipplock (aka Avaurus) is working on the core system and as far as I know he is making a remarkable work on it. One of the most important parts is the lzma compression for the packages, so the final iso will be smaller than the Kwort 2.2 one. He is now working on the installation system, so when he gets done I'll put Kwort desktop on it.

Stijn Segers is working on the new interface for the users admin system (as my mockup looked very bad :-P), so once he finishes with it I will make a Xfce plugin of it and include it in the mcs settings manager. He will also take care of the kernel. So this time, getting kernel source to compile drivers won't be needed and as he told me we will include some drivers by default like those free ralink ones. But kernel work stopped until 2.6.23 come out, as that one will be the one for Kwort 2.4.

And it's time to tell what I'm doing... Well, until Andreas and Stijn doesn't finish I'm still maintaining 2.2 serie including and upgrading packages http://www.kwort.org/?page=MorePackages.

But until that happens I'm checking projects and taking decisions for the desktop and in core (helping Andreas and Stijn). Today I did some user custom actions for kwort packages:

Installing Kwort packages from the file manager

For those paranoids (I know you guys are right about this), ktsuss will be included and all those sudo commands will be removed (sudo will still be included, but not used for anything else but xfsm-shutdown-helper). So this custom action showed above use ktsuss in case you ask.

Oh, another interesting things are the fact that kwort is listed in as a Xfce distribution and Kwort being used in school (COBAEH - Cuautepec de Hinojosa - Hidalgo - Mexico) with old machines (Pentium MMX 200Mhz with 32MB ram).

Well, that's all for now folks, I will keep bringing Kwort newsflash :)




The IT Crowd for download

Posted on: Jul 2007

The last week I started to see a tv serie called "The IT Crowd" on Sony, it's a funny geek serie about an IT team in a british company. Anyways, a friend of mine (Manu) wanted to download all the chapters from a site, so I wrote this simple script for him:

#!/usr/bin/env bash

wget http://stage6.divx.com/The-IT-Crowd---Spanish-Subtitled/videos/
i=1
for x in $(egrep -i "The-IT-Crowd---1x0*" index.html | awk -F '/' '{ print $4}' | sort -m -u); do
   tput setaf 1
   echo "Downloading chapter ${i} (Link: http://divx-226.vo.llnwd.net/stage6vid/${x}.divx)"
   tput sgr0
   wget http://divx-226.vo.llnwd.net/stage6vid/${x}.divx --output-file="${i}.avi"
   i=$((i+1))
done

I hope someone find it useful.

EDIT: Unfortunately, this doesn't work anymore, since stage6 was closed.




Knowing the network speed at a given moment

Posted on: Jul 2007

Well, a friend of mine asked me for this, and it was very interesting to understand what was in /proc/net/dev.

#!/usr/bin/env bash

if [ -z "${1}" ]; then
   echo "Give a network interface"
   exit 1
fi
DEV=${1}
/sbin/ifconfig ${DEV} >/dev/null 2>&1
if [ $? -ne 0 ]; then
   echo "Please, do man 8 ifconfig to know what a network interface is"
   exit 1
fi
LINE_OLD=$(cat /proc/net/dev | grep ${DEV})
sleep 1
LINE_NEW=$(cat /proc/net/dev | grep ${DEV})
while [ "${LINE_OLD}" = "${LINE_NEW}" ]; do
   sleep 0.1
   LINE_NEW=$(cat /proc/net/dev | grep ${DEV})
done
OLD_DOWN=$(echo ${LINE_OLD/*:/} | awk -F " " '{ print $1 }')
OLD_UP=$(echo ${LINE_OLD/*:/} | awk -F " " '{ print $9 }')
NEW_DOWN=$(echo ${LINE_NEW/*:/} | awk -F " " '{ print $1 }')
NEW_UP=$(echo ${LINE_NEW/*:/} | awk -F " " '{ print $9 }')
REST_DOWN=$((${NEW_DOWN} - ${OLD_DOWN}))
REST_UP=$((${NEW_UP} - ${OLD_UP}))
if [ ${REST_DOWN} -gt 1024 ]; then
   echo "DOWNLOAD: $(echo "scale=2;${REST_DOWN}/1024" | bc -lq)k/s"
else
   echo "DOWNLOAD: ${REST_DOWN}b/s"
fi
if [ ${REST_UP} -gt 1024 ]; then
   echo "UPLOAD: $(echo "scale=2;${REST_UP}/1024" | bc -lq)k/s"
else
   echo "UPLOAD: ${REST_UP}b/s"
fi

You can run it this way for example:

while true; do ./netspeed eth0; done

I don't think this is really reliable, but anyways, see you guys in the next few days to tell you something new :)