Bug 143305 - SID collision in hrc files
Summary: SID collision in hrc files
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Hossein
URL:
Whiteboard: target:7.3.0 target:7.2.0.2
Keywords: difficultyBeginner, easyHack, skillCpp, topicDebug
Depends on:
Blocks:
 
Reported: 2021-07-12 06:20 UTC by Hossein
Modified: 2021-07-20 17:27 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2021-07-12 06:20:23 UTC
There are some collisions in these files that should have been avoided:

* include/sfx2/sfxsids.hrc
* include/svx/svxids.hrc
* include/editeng/editids.hrc

For example, we see 'SID_SVX_START + 44' twice, which is not acceptable.

These collisions can result in symptoms like tdf#143204 (Tabbed interface not working in Impress or Draw) which affects all the platforms (Windows, Linux, etc.). All these collisions should be resolved by changing the numbers added to SID_SVX_START in svxids.hrc.

An example fix can be seen here:
https://git.libreoffice.org/core/+/8ea9a8bc43ea054521a44dc8e3bc537110ca9e33
Comment 1 Kevin Suo 2021-07-12 07:40:08 UTC
Patch submitted on gerrit under review:
https://gerrit.libreoffice.org/c/core/+/118544

Please mark the bug status as ASSIGNED if you are working on this bug.
Comment 2 Commit Notification 2021-07-12 10:17:27 UTC
Hossein committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/04c7c90fe886c5fcebd52f727ff8b4edb840ad32

tdf#143305 Remove remaining SID collision in .hrc files

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Xisco Faulí 2021-07-12 10:58:59 UTC
Hi Hossein,
Would it make sense to have a script to check for this kind of collisions ?
Comment 4 Hossein 2021-07-12 11:09:11 UTC
(In reply to Xisco Faulí from comment #3)
> Hi Hossein,
> Would it make sense to have a script to check for this kind of collisions ?

Hi Xisco,

Yes, I think having a script for finding possible collisions is important.

As written in the commit log:
https://git.libreoffice.org/core/+/04c7c90fe886c5fcebd52f727ff8b4edb840ad32%5E!

to make sure no collision is remaining, I have used grep:

  git grep -h "SID_SVX_START[ ]*+" *.hrc | grep -Ev '^\s*\/\/' \
    |awk -F\( {'print $2'} | awk -F\) {'print $1'}             \
    |awk '{gsub(/^ +| +$/,"")}1'|sort|uniq -c|grep "      2"

It searches for 'SID_SVX_START +' in .hrc files, removes comments out of
it, extracts the parts between parenthesis, trims spaces, sorts and
then finds the number of unique occurrences and looks for 2.

Possibly, similar thing can be checked using Python.

I think in the long term, a better and more reliable solution would be generating these values, and not setting them manually.
Comment 5 Commit Notification 2021-07-13 12:33:47 UTC
Hossein committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/1b4997d7a84d1ea7de6be6099bddcc8c31c0146a

tdf#143305 Remove remaining SID collision in .hrc files

It will be available in 7.2.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.