Tuesday, November 16, 2010

-C (in)sanity

I'm currently building binaries from scripts that will be included in LFScript4 v0.1, which will make up the fsOS 2 alpha Live CD, which will be released within the next couple of days.

Whenever I build a final set of binaries, I use the -C flag on ./lfscript which should identify broken scripts by resetting the build environment after every package built, thereby erasing any file that has not been archived. This prevents other packages to find incorrectly packaged software and thus somewhat ensures that software is built and packaged properly.

The problem...
It was my intention to also ensure that software does not link against any other software that is not a direct (or indirect) dependency. This was already implemented in LFScript 3, but I've just discovered that it is not (yet) properly implemented in LFScript 4.

Al tough the environment is reset properly, in LFScript 4, every package that is already built and is a dependency of any package specified with -x is installed back in the new environment. So, currently, it is possible that unspecified non-essential dependencies are linked to anyway, even though -C is used.

An example...
The best real example of this problem is building wget while also building any other package depending on openssl. Even though openssl is not an essential dependency of wget, if openssl is already built, wget will link to it. Later, you might decide to only install wget, which will them complain and fail to run because it can no longer find openssl.

It is for this reason that in the scripts provided with v0.1 of LFScript 4, I've (temporarily) added openssl as a dependency to wget, but I'm sure there are other packages which will have this problem.

The solution...?
The solution is for me to rewrite the relevant code in ./lfscript, but that will probably not happen soon. Because most people will only build software with LFScript that they will also install and use immediately, it is only a minor nuisance to most, if you even encounter it. Therefore, rewriting the code is not a priority at all.

If you want to know more...
If you are a programmer, and dependency handling is something you would like to know more about, you should take a look at topological sorting. It is the basis of dependency handling in LFScript (through a third party tool called tsort in LFScript 4, because it is quicker) and implementing an algorithm for it is a good exercise for beginning and moderate programmers.

No comments:

Post a Comment