Real world example of the includes-with-the-same-name "bug"

new topic     » topic index » view thread      » older message » newer message

There's often much debate and complaining on the
includes-with-the-same-name-in-other-directories-are-treated-as-the-same-file
"bug" and many examples of why many people (myself included) consider this a bad
thing. However, many examples are theoretical or trivial but today at work I ran
into the limitations of this bug head on.

We have this Matlab program at my job that was written years ago by one of our
research specialists that we use to locate underwater moorings. I've been the
sole maintainer of this program for years since the other guy doesn't have the
time to work on it. A couple years ago I was requested to write a Perl script to
install it on people's computers (just for the Windows users, the Linux users are
usually smart enough not to need it).

During my winter break from college I did a minor update of this program and am
now working on updating the installer. Since I now have a deep dislike of Perl
(that's probably Euphoria's fault) I decided to rewrite the program in Euphoria
(yaay!). I was making good headway until today when my progress was brutally
stopped at work today by the "bug".

Before this week the installer was a one-file Perl script that unzipped the
program, installed some libraries, changed the path in the registry to point to
the libraries, and created a shortcut to the program and moved it to the desktop.
This new version will also go through the system path and see if there are any
old versions of the library installed and it'll then uninstall them.

Right now I have the searching the path, uninstalling the libraries, and setting
the path part of the install pretty much done using Davi de Figueiredo's registry
wrappers (which work quite well I might add). After I finished writing those
parts I started work on the part that unpacked the program itself. Before we
distributed the program as a zip file with the installation program which simply
unzipped it and set the path and everything. I tried to do the same thing but the
only good unzipping routines don't seem to like the file (again, they are from
Davi and I've sent him a bug report).

After messing with unzipping files I then tried to embed my files in the program
itself by using Davi's file2eu program (another excellent program, the fact that
he's made every file I've used on this project so far is pretty amazing). I wrote
a script that gets the contents of a directory and for every filename in the
directory makes an include file with the file contents as a massive sequence. I
needed this not only to simplify stuff but also so anybody else can generate
these files if I ever leave (I'm the only Euphoria programmer we have AFAIK). It
also goes through directories recursively and mirrors that structure in the file
where the new include files are stored.

Well, at this point I think you can guess where the problem will occur. After
running this I now had a directory full of include files with subdirectories for
the subdirectories of the program. So, I now run my test install script which
promptly crashes.

The reason for the problem is that the program consists of the main directory
with the execuable files and the resource files and there's a directory inside
that which contains the source. However, since it's a Matlab program and Matlab
programs are usually meant to be used through the Matlab shell and our users are
scientists who know Matlab we decided to include the source for them to look at
and modify if need be. To make the source directory self sufficient all the
example and resource files are in there as well but may not be the same because
of minor differences between compiled and interpreted Matlab. Sadly, since the
files are stored in separate include files sorted by directory the files do not
translate correctly and the installation fails.

I know this is a fairly domain-specific and convoluted example and I have found
a way around this but it does illustrate that this is a limitation and a
limitation that has real-world consequences (imagine if I didn't test it, I
could've lost my job!).

This isn't a rant or a demand for change from Rob (although it would be nice...)
just a friendly reminder to anyone who uses Euphoria scripts to write larger
Euphoria programs that you need to check your includes! smile


The Euphoria Standard Library project :
    http://esl.sourceforge.net/
The Euphoria Standard Library mailing list :
    https://lists.sourceforge.net/lists/listinfo/esl-discussion

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu