How to fix an issue in OpenOffice.org Michel Loiseleur Wednesday, 19

Transcription

How to fix an issue in OpenOffice.org Michel Loiseleur Wednesday, 19
How to fix an issue
in OpenOffice.org
Michel Loiseleur
Wednesday, 19th of September, 2007
mloiseleur@openoffice.org
Who am I
●
There was the day before meeting OOo
Open Source Software Assurance
●
One place to fix'em all
●
A guaranted time of correction (SLA)
●
Patches are contributed to community
The real OS world
You
Linagora's answer
You
The Goal
Fix an issue
in less than
5 days
The tools
●
●
Forget tools like
–
Eclipse
–
Visual Studio
–
Anjuta
–
Kdevelop
The code source is too big for them
The tools
●
You have choices between
–
Emacs
–
Vim
–
SlickEdit (Commercial)
–
MSDev (Commercial)
●
See Developer_Tools in the wiki
●
Cscope will be your saviour
The source code
●
As of SRC680_m224, there is 1,9 Gb of
sources
The source code
●
So many code, but hey, do not panic
–
100 folders which are < 2Mbs
–
helpcontent2 (480Mbs) won't need any patch
–
19 external library (sometimes patched)
–
binfilter (62Mbs) is a SO 5.2
The source code
●
Actually, it can be shortened like this
The source code
●
●
You will probably hack in one of those :
–
vcl : Visual Component Library (15 MB)
–
sw : Writer (71 MB)
–
sc, scaddins, scsolver : Calc (80 MB)
–
sd, svx : Draw & Impress (114 MB)
In those folders lies easily 80% of issues
What does it look like
sc/source/ui/docshell/docfunc.cxx:
ScPostIt aNote(pDoc);
//
Zeichenobjekt updaten
//! bei gelocktem Paint auch erst spaeter !!!
ScDetectiveFunc aDetFunc( pDoc, rPos.Tab() );
aDetFunc.ShowComment( rPos.Col(), rPos.Row(),
FALSE ); // FALSE: nur wenn gefunden
}
The saviour
●
–
http://lxr.go-oo.org as an alternative
–
don't ever activate one of the graph options
ScDocument
●
652 public members
●
2 static public members
●
2 public attributes
●
30 private members
●
112 private attributes
●
10 friend classes
The source code
●
That was only one class
●
There are 1977 classes in Calc
●
How can one be able to fix issue in this ?
Tips #1
Don't procrastinate
Just
Do it
Find an issue
●
Sample #1: i7500
–
I can't copy and paste on merged cells
–
It comes with this message box :
"Cell merge not possible if cells already merged!"
Understand the issue
Find the code
●
We have an error message so...
●
We can find the corresponding code (!)
●
grep it and « voilà », in globstr.src
–
STR_MSSG_PASTEFROMCLIP_1
–
STR_MSSG_MOVEBLOCKTO_0
–
STR_MSSG_MERGECELLS_0
Find the file
●
an other grep on « PASTEFROMCLIP » :
●
source/ui/view/viewfun3.cxx:993:
if (bClipOver)
if (lcl_SelHasAttrib(...,HASATTR_OVERLAPPED )) {
ErrorMessage(STR_MSSG_PASTEFROMCLIP_1);
delete pTransClip;
return FALSE;
}
Fix it
if (bClipOver)
if (lcl_SelHasAttrib(...,HASATTR_OVERLAPPED )) {
ScRange destRange( ... );
pDocSh->GetDocFunc().
UnmergeCells(destRange, FALSE, TRUE);
}
That's all folks
Tips #2
You have to know
how to fix the issue
BEFORE
you look at the code
Find an issue
●
●
Sample #2: i51564
–
Open Calc.
–
Fill values A1=1,A2=2,A3=3
–
Select A1,A2,A3
–
Click on "SUM" symbol on the formula toolbar
All the selected values becomes 0 or #REF!
Find the code
●
A grep on « sum » gave ~ 1000 results
●
The feature create a « sum » formula
●
It must use some kind of operation code
●
grep on 'SUM_IF' to find where are opcodes
●
grep on 'SC_OPCODE_SUM' gave 2 files :
–
source/core/tool/appoptio.cxx:106
–
source/ui/view/viewfun2.cxx:725
The Fix
●
●
It was
–
10 pages of specifications
–
5 versions of the patch
–
collaboration between 5 people
for about 30 lines of C++ code
At the end
●
We took more time to think to
–
●
How we want the fix to behave
Than to
–
Really fix it with writing code
Find an issue
●
●
●
Sample #3 : i74651
Removing with API an image from a Calc
document does not change the modified
state of the document.
It can even cause crashes if the
document was not saved
Crash
Really easy. It's tracked in 3 steps :
1. Grab name of files from the trace
2. Recompile only them with
$ build debug=TRUE
3. Launch gdb
Uno API
●
More difficult. A search in developer guide
Uno API
●
The invalid call is « remove » on a
« DrawPage ».
●
That's the only valid entry point to look.
●
http://lxr.go-oo.org returns nothing
●
Time to use doxygen on SD and on SVX
–
SdDrawPage::remove
–
SvxDrawPage::remove
Uno API : The fix
●
After finding the code
●
Find how to use the Undo* API
●
●
The faster way is to take a look at how it
is called
The gigantic code size of OpenOffice.org
Code can become an advantage
Tips #3
Always look at
a reference code
BEFORE
using an API call
After one year
●
Goal attained
●
My last issue took less
–
●
than 15 minutes to fix
You can make it too
Thanks for your attention
mloiseleur@openoffice.org