Issue 119332 - "Find & Replace" matches wrong sequences on Solaris
Summary: "Find & Replace" matches wrong sequences on Solaris
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: 3.4.0
Hardware: Sun SunOS
: P3 Major (vote)
Target Milestone: 3.4.1
Assignee: AOO issues mailing list
QA Contact:
Depends on: 105945
  Show dependency tree
Reported: 2012-05-11 10:46 UTC by Nicolas Christener
Modified: 2012-07-04 08:02 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---
jsc: 3.4.1_release_blocker+

"Find & Replace" matches wrong sequences (98.30 KB, image/png)
2012-05-11 10:46 UTC, Nicolas Christener
no flags Details
Possible fix for #119332 (768 bytes, patch)
2012-05-11 16:12 UTC, Nicolas Christener
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Nicolas Christener 2012-05-11 10:46:20 UTC
Created attachment 77529 [details]
"Find & Replace" matches wrong sequences

The following text is given:

"Referat und Gerichtschreiber und er ist erst in die Schule gegangen und hat weinen Vortrage erstellt."

Using "Find & Replace" I search for "rat", what happens is:
- Refe*rat* is found (good)
- e*rst* is found (wrong)
- e*rst*ellt is found (wrong)

Also see the attachment which shows the issue.

This is NOT reproducible in the official builds, but it is in our unofficial OpenSolaris/SPARC builds. Chances are, that a.) we did something wrong during build, or b.) this is a OpenSolaris/SPARC specific issue.

The build can be found here:

The script to produce the build can be found here:

Any pointer into the right direction would be helpful :)
Comment 1 2012-05-11 14:04:50 UTC
Which of the options in "search and replace" are enabled in your testing? E.g. only-in-selection, backwards, regular expressions, similarity-search, case-sensitivity, etc.
Comment 2 Nicolas Christener 2012-05-11 14:23:58 UTC
Hi, thanks for contacting me and taking a look into this!

I didn't change any of the default settings (you can probably see them in the attachment

So this is:
[ ] Match case
[ ] Whole words only
[ ] Current selection only
[ ] Backwards
[ ] Regular expressions
[ ] Similarity search
[ ] Search fpr Styles
[ ] Notes

The options in "Attributes" are empty too

Hope that helps.

This is with a clean profile and no installed extensions btw.

Don't hesitate to contact me, if you want ssh/x11 access to the build machine.

kind regards,
Comment 3 2012-05-11 14:45:21 UTC
It is very strange that the problem doesn't happen on the official builds, but only on the ones you built yourself. This might be an optimization problem. The relevant code is in main/i18npool/source/search/textsearch.cxx and the method to debug into is TextSearch::NSrchFrwrd() and maybe TextSearch::MakeForwardTab(). If you could build the textsearch.cxx file without optimizations disabled and retest the problem with the resulting i18search library that could provide an interesting data point.
Comment 4 2012-05-11 14:46:19 UTC
Of course I meant "with optimizations disabled" instead of "without optimizations disabled".
Comment 5 2012-05-11 14:51:33 UTC
I just found bug 105945, which seems to match exactly that problem. It is marked as fixed though and we need to investigate whether we have a new problem here or whether the old fix doesn't work anymore.
Comment 6 Nicolas Christener 2012-05-11 14:58:48 UTC
Thank you very much for your investigation! I see, that bug #105945 also mentions optimization - so this could definitely be a starting point.

I'll take a look at this and will provide feedback as fast as possible.
Comment 7 2012-05-11 14:59:46 UTC
The fix from bug 105945 doesn't apply because it checked for "Solaris C52 Intel" which obviously doesn't apply for Solaris Sparc.

The fix should be straight forward by adjusting the line in
with SOLARISC52INTEL to something that matches in your case, e.g. by dropping the CPUNAME part.
Comment 8 Nicolas Christener 2012-05-11 16:11:30 UTC
hdu, you're awesome :D

It seems, that it was indeed the optimization which triggered this error.

I changed the Makefile as you proposed, but was not sure if $(COM) doesn't restrict the selection to much. Maybe multiple versions of the SunStudio compiler are affected? We currently use this one:
$ /opt/solarisstudio12.3/bin/cc -V
cc: Sun C 5.12 SunOS_sparc 2011/11/16

Therefore I not only removed $(CPUNAME) but also $(COM) - not sure if this is right, maybe you can comment on this?

Anyway using this patch, "Find & Replace" seems to work as expected - we'll test it further and I'll inform you, if we find something else.

Thank you very much for you assistance! I really appreciate it!

Have a nice weekend

kind regards
Comment 9 Nicolas Christener 2012-05-11 16:12:13 UTC
Created attachment 77530 [details]
Possible fix for #119332
Comment 10 2012-05-11 16:32:52 UTC
Thanks for the flowers! I'm glad I could help. Welcome to our fine community.

I took the liberty to apply your patch as revision 1337260.
Comment 11 2012-05-11 16:38:44 UTC
I forgot to answer your question:
> Therefore I not only removed $(CPUNAME) but also $(COM)
> not sure if this is right, maybe you can comment on this

Better a reliable working search than a very buggy but optimized search! ;-)

Have a great weekend,
Comment 12 2012-05-14 07:34:54 UTC
Thinking over this bug I think we should try to understand where the compiler problem comes from since it could hit us in other places where a problem would not show so clearly. Now that we can switch the problem on and off by changing the optimization setting we should use this chance to analyze this better.

Could you debug into this? I suggest to add some fprintf to TextSearch's NSrchFrwrd, MakeForwardTab and MakeForwardTab2 methods, run your test with the different optimization settings and compare the fprintf outputs.
Comment 13 2012-05-15 10:56:13 UTC
Updated the issue summary to be less generic.
Comment 14 Nicolas Christener 2012-05-15 13:50:37 UTC
Hi Herbert

I'll get back to this issue asap - I'm currently working hard on #119263 and will of course try to help you to find the (real) reason behind the optimization issue.

I hope you don't mind if it takes two or three days until I can work on this one again?

kind regards,
Comment 15 2012-05-15 14:16:05 UTC
No worries, there is always way more than enough to do all over the place in such a big project ;-) And with higher priority bugs, work items, issues in life, travel schedules, holidays, weekends, etc. delays of a couple of days are quite normal in an open source project.
Comment 16 jsc 2012-05-31 07:57:52 UTC
set release blocker flag for 3.4.1
Comment 17 2012-05-31 12:31:18 UTC
Also applied as revision 1344678 for AOO3.4.1
Comment 18 binguo 2012-06-19 05:58:55 UTC
Verified it on Aoo_Trunk_20120616.1800.1350879 and it does not reproduce, so close it as fixed.
Comment 19 Yan Ji 2012-07-04 07:33:40 UTC
Need verify this bug against Solaris system.