Older blog entries for alejandro (starting at number 45)

10 Aug 2004 (updated 10 Aug 2004 at 16:50 UTC) »


I have finished the module for Samba 2.2, it is now working with 2.2.9. There are not a lot of changes in Samba after 2.2.4, so it should work with versions 2.2.4 and up without problems. In versions before 2.2.4 there are changes in the VFS API which makes the module incompatible.


I have been using Mutex/MutexHandlers classes, which underneath use pthread_mutex_lock and pthread_mutex_unlock. This is needed to protect a linked list from access and modification from multiple threads. For data structures, I have been considering using STL's built-in support, but they seem overly complicated and somewhat painful.

3 Aug 2004 (updated 3 Aug 2004 at 17:13 UTC) »

SAMBA and iconv

I have been playing with iconv (not the libiconv one, else the integrated in glibc) to convert the SAMBA strings encoded into UCS to the current locale, so it shows well the registered files to syslog without odd chars. For the current locale implementation I've tested first the nllanginfo(CODESET) function but I had some troubles getting used locales so I have done an easy little program that gets the LC_ALL, LC_TYPE and LANG env vars and then gives the locale to a convert program (the iconv one).

Anyway I think the samba-vscan modules will have the same trouble when registers messages with not-known characters with syslog because is printing the Samba provided information in UCS.


The known problems in the sockets communication was solved, now the G++ compiler is more strict (was introduced the new C++ parser in GCC 3.3) and when you do a cast with a reference first you have to do the cast and then the reference. For example that kind of things the C Compiler let to do it in C and in the G++ 3.2 version, at least is finally solved now in the code.


David Waite finished the encoder last night and tons of unit tests. The encoder parses .torrent files and allows to generate .torrent files.

In a torrent file there are four data types within torrent files strings, long integers, lists, and maps. They all have a format, lists and maps can nest so a torrent has a document object model of these four types. So there is a dictionary at top, and it has an entry called 'info' which is another dictionary and one called files which is a list of dictionaries, each representing data about a file within the torrent. David is going to make an actual file type and parser, but things seem very free-form and we wouldn't want to break if someone encoded a torrent with an experimental bittorrent fork which added additional data.

When I talk about a Document Object Model is not really an XML but one of the bittorrent libraries for java allows to save as xml.


I've only created an skeleton of the Samba 2 code and updated the Samba 3 one. In the Samba 3 side I have created a linked list to follow the opened files so the filtered files don't notify read/write/unlink/rename operations and organizated all the code in subversion.


At home in the desktop computer I have updated GNOME 2.6.1 to 2.7.4 but I experiment some troubles viewing files in nautilus. Then I'll see if it was any problem with the update, at this moment is making an emerge -e gnome (so it will be compiled with gcc 3.4.1 and glibc with nptl support). I tried to compile the last Ximian OpenOffice build (1.1.61) but it requires gcc 3.2.x so I will try later with an old gcc profile.

Nice article of Davyd about new GNOME 2.8 features.


I would like to go there, a lot of interesting conferences, like in the OLS and Kernel Summit.


More work in the Arandano code. At this moment we have almost finished the bencoder (it specify all encoding of the bittorrent file) and the storage (basically maps the file in memory ranges).

Now we are beginning in the Download.cs that handles the code for the data transfer.

I have uploaded in a different svn module the bittorrent python code.

Samba VFS Module

Now the module is filtering operations and is taken the information from a xml configuration file. In the configuration file I can filter contents like extensions, directories, all files, activate filtering and the default paths used.

I have fixed some things related to case sensitive filtering and autotools stuff. Now I don't need a manual libtool compilation to link the library with pthread/libxml.

GCC troubles

I have been getting some errors using g++ 3.3 versions when you use a reference to a pointer with a '&' giving a: non-lvalue reference with '&' in accept sockets code.

The c++ code compiles well in a Fedora Core2 and Redhat9 using g++ 3.2.2. Reading maillists I have found is a bug in the gcc 3.3 series but I have compiled gcc 3.4 and is again the problem there, so I'll have to do a regression to gcc 3.2.2

LibXML and XPath

This morning at work I finished the parsing of the config file for the VFS module with libxml and using Xpath expressions. It's so easy to navigate in a XML tree using XPath and get the nodeset values.

The trouble is still you have to compile the module over Samba and is ABI dependent so I have some troubles trying to use other external libraries with the autotools/libtool stuff, I don't know if the trouble is the generated shared object library or the libtool stuff is missing to add the libxml2, I'm beginning to hate autotools but although I'm using lib_LIBADD, LDADD or LDFLAGS, it's ignoring me and the 'ldd sambamodule.so' doesn't show anything about 'libxml'.

Anyway the stuff is compiling, so is hard to debug all the code in Samba and see why is crashing with the new xml config parser.

Automated Testing Frameworks

In the evening, I have been looking some interesting tools for automated testing. Here are the more interesting tools I have found:



STP/PLM: Automated testing of kernel patch trees or single patches.

Some STP Client API calls are in the Perl modules (DiskHandler.pm, Oprofile.pm and Tools.pm) like: create_disk_layout, setup_tools, create_logic_volume, make_one_disk, check_profile, report_all, os_detect, etc..

Tests: aim9/reaim, bonnie++, dbench, DBT*, DOTS, hackbench, contest, iozone, lmbench, LTP, memtest, pgmeter, tiobench, VM_Regress..


Sourceforge Compile Farm

Test Execution Wrapper (TEX)

25 Jul 2004 (updated 25 Jul 2004 at 21:26 UTC) »


Some documentation was asked in the xorg maillist, I recommend reading:



It's a pity there is not updated documentation about X internals like the out-of-print X/Xlib vols internal ones.

And there are more advances for the August 15th plan release. There will be included the new extensions C/D/F and Debrix changes like the use of autotools instead using imake. It's cool, in some months we will look more eye-candy features in the desktop like transparencies and shadows.

Another features like the new MMX optimizations in gcc 3.4 intrinsics affect in performance rendering. For example here is a benchmark rendering a paragraph of component alpha text to a pixmap:

Unmodified X server and the pixmap in system RAM:

[ssp@localhost x]$ ./a.out

total time: 41.394618

average rect time: 0.683200

worst rect: 9

average glyph time: 3.550500

with the MMX optimizations:

[ssp@localhost x]$ ./a.out

total time: 22.972553

average rect time: 0.677900

worst rect: 9

average glyph time: 1.692000

In addition there are some applications beginning to support the new extensions like Vino. I want to have thinks like expocity and minimizing effects like 'aladino' in macosx working in linux.

Some interesting tools

I have been looking more tools to follow code like egypt' or 'gengraph'.

These both utilities give the call graphs from sources.

You can find these on following links:

egypt: http://www.gson.org/egypt/

gengraph: http://www.csn.ul.ie/~mel/projects/codeviz/

In console mode, you can use cscope to travel through your code, in addition frecuently used ctags/etags.


Lastly I have been looking the Samba 3 and I have done some little modules with Samba VFS. In examples/VFS you can find some skeleton modules filtering operations like open/read/write/connect/disconnect/etc, all the provided VFS file operations from the Samba VFS layer.

In the following days I will port the Samba modules to 2.2.x, so it can be useful in other Samba versions before 3.0. Anyway is so interesting, it wraps each operation in the smbd with operations like SMB_VFS_OPEN, that are really the operations you are intercepting and making the SMB_VFS_NEXT_OPEN.

I had troubles registering close operations but now is fixed. Actually smbd has a close.c:fd_close() that calls the locking poxis methods to close correctly a file and do the corresponding SMB_VFS_CLOSE, for a moment I didn't see the VFS wrapper in the code.

And a recent exploit in Samba in base64 encoding was published:

if (*s == '=') n -= 1;

/* fix up length */

decoded.length = n;

memcpy(s, decoded.data, decoded.length);

if n == 0 before it is decremented, then it will wrap around to ~0 and the memcpy will eventually SEGFAULT.

Zettabyte File System





A few days ago David Waite and myself began the project 'Arandano'.

Arandano is a bittorrent library written in C# that implement the bittorrent p2p protocol, now is in the beginning stages so we are only looking about the FileFormat and tracker implementation.

More details about the protocol:


25 May 2004 (updated 25 May 2004 at 09:39 UTC) »

I have uploaded the slides about freedestop.org here


This weekend I was in Almendralejo in Extremadura talking about the project Freedesktop. It was so interesting, a lot of GNOME developers were there, like fer, acs, garnacho, rodrigo, lgs, carlosgc, ...

The talks was all really interesting, desktop integration, GNOME future, fisterra, gobject, pygtk and so on. And now we are formed an association for the spanish GNOME group, GNOME Hispano.

The next year the guadec-es will be in Coruña, Spain,

A long time without blogging, I have been busy with the new job. I left HispaFuentes in the end of February and I began to work for OpenSistemas.

My new work is more related with services, we provide open source solutions related with CMS, ERP, CRM, web services, web/ftp/mta/... servers, linux migrations and so on.

Concerning free software and the desktop I will talk about Freedesktop in my university on Friday. There are a lot of guests speakers like Alvaro del Castillo (GNOME developer), Juan Quintela (the mandrakesoft kernel maintainer), Xavier de Blas (linuxshow) and Juan Jesus (metadistros fame).


Other day working in the Hispafuentes distribution in the morning.

Tomorrow I'll go to the Open Source World Conference with some partners of my university. I'm sure that there will be a lot of friends that I haven't seen some time ago so we can talk about new projects and ideas about free software in general.

I will take the plane in 7.45 so I'll arrive at 8.45 to Malaga, see you there!


I have order Linux Kernel Development, J2ME in a Nutshell and Mastering Algorithms with C, I expect that I can read it soon.

36 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!