A bug or two...

  • From: Sam Holden <sholden@xxxxxxxxxxxxxx>
  • To: wilyfans@xxxxxxxxxxxxx
  • Date: Wed, 01 Sep 2004 14:38:36 +1000

I stumbled across a bug, which lead to another bug...

I was playing around with "Split" since it's something I've never
used, and ended up trying it out on a directory.

Try the following:

1. start up wily and open a directory
2. have two columns with one window containing a directory listing
   (the default startup state for me...)
3. Split the directory window
4. Drag one window to the empty column
5. Drag it back again

If you are lucky (and is the bug I stumbled upon) the now empty column
will still contain the text of the window. The text will disappear on
a refresh, so wily isn't updating it - just failing to clear it in the
first place.

If you are unlucky, wily crashed on step 3. This is the second bug
that the first bug led to. I downloaded a fresh copy of wily
(the non-9libs version) from sourceforge and compiled and ran it and
did the above - checking if my local modifications were the problem.
The default wly settings and my screen size didn't agree with each
other and in the columnate() at wily/util.c:210 the following
line of code was executed:

        columns = ((totalwidth -biggest) / maxwidth) +1;

totalwidth had the value 0 (I guess because the new view was
in the process of being created?).
biggest had the value 84.
maxwidth had the value 84.

Hence columns was assigned the value (0-84)/84+1 == -1+1 == 0.

Then the next line was executed:

        rows = nitems / columns;

And the division by zero resulted in floating point exception and
a swift exit for wily.

This second problem can be bandaided over with a:

        if (columns==0)
                columns = 1;

or for the sufficiently paranoid:

        /* there must be at least one column */
        if (columns < 1)
                columns = 1; 

For the first problem, I have no idea and know nothing of libXg...

Also splitting a directory window a few times, in multiple columns and
then resizing the columns results in some very strange artifacts which
I assume has the same root cause as the first problem. And contrary to
the comment above text_formatdir() in text2.c the directory text is not
formatted for the smallest view.

Sam Holden

Other related posts: