URL:
<http://gna.org/bugs/?11228>
Summary: Wind indicator don't work properly, if 0.8beta4 is
compiled from source on Linux kernel 2.6 x86_64.
Project: Wormux
Submitted by: zelinskiyis
Submitted on: Воскресенье 09.03.2008 at 18:06
Category: Interface
Severity: 2 - Minor
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release: 0.8beta4
Discussion Lock: Any
_______________________________________________________
Details:
Bug description:
If Wormux 0.8beta4 is compiled from source on linux kernel 2.6 x86_64, a bug
appears.
The bi-directional wind indicator at the bottom of the sceen shows left winds
as overscaling right, while showing right winds correctly. Zero wind is shown
as no wind, but just a little left wind is shown as a big right.
The problem resembles 'unsigned' situation, when little negative values are
treated as big positive.
Steps to reproduce:
1.Take a x86_64 linux distributive with 2.6 kernel, installed on x86_64
platform.
2.Compile wormux 0.8beta4 (the bug also affects 0.8beta3) from source.
3.See, that everything works well, except the wind indicator.
Analysis:
The bug appears because in
(0.8beta4/src/gui/progress_bar.cpp : line 71)
function CalculeVal has to return negative values, in case if
ProgressBar is used as a wind indicator.
(0.8beta4/src/interface/interface.h : line 79).
Example, where CalculeVal have to return negative values is in
(0.8beta4/src/gui/progress_bar.cpp : line 156).
At the same time, returntype of CalculeVal is 'uint'.
This worked fine with linuxes of x86 architecture, where 'uint' and 'long'
had similar size equal to 4 bytes.
(Despite the bug existed, it did not reveal itself).
However, on linux 2.6 x86_64 'uint' size is 4, while 'long' size is 8.
This has triggered the bug.
One of the places in code, where this makes difference, is
(0.8beta4/src/gui/progress_bar.cpp : line 77).
Here is a substraction of 'uint' from 'long'.
Attached 'test2.c' simulates the situation, the output of test2.c on diferent
systems is given below.
Linux Knoppix 2.6.19 #7 SMP PREEMPT Sun Dec 17 22:01:07 CET 2006 i686
GNU/Linux
========
difference test
20|0|0|0|
u test
ffffffbc|ffffffff|ffffffff|ffffffff|
l test
ffffff9c|ffffffff|ffffffff|ffffffff|
size of long is 4
size of uint is 4
========
Linux ivze-desktop 2.6.22-14-generic #1 SMP Tue Feb 12 02:46:46 UTC 2008
x86_64 GNU/Linux
========
difference test
20|0|0|0|1|0|0|0|
u test
ffffffbc|ffffffff|ffffffff|ffffffff|
l test
ffffff9c|ffffffff|ffffffff|ffffffff|ffffffff|ffffffff|ffffffff|ffffffff|
size of long is 8
size of uint is 4
========
The test shows, where from the big values appear in case of x86_64.
Patch:
Changing the returntype of CalculeVal from 'uint' to 'long' eliminates the
bug on x86_64. At the same time, I have not tested it on x86 yet, the above
minor tests were performed with the use of a Live CD.
The attached file 'diffout' contains diff output of the patched version
against 0.8beta4.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Воскресенье 09.03.2008 at 18:06 Name: diffout Size: 406B
By: zelinskiyis
Diff patch and little test program.
<http://gna.org/bugs/download.php?file_id=3923>
-------------------------------------------------------
Date: Воскресенье 09.03.2008 at 18:06 Name: test2.c Size: 748B
By: zelinskiyis
Diff patch and little test program.
<http://gna.org/bugs/download.php?file_id=3924>
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?11228>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna