#1109002 libreoffice: Basic function BubbleSortList gives wrong result

Package:
libreoffice
Source:
libreoffice
Description:
office productivity suite (metapackage)
Submitter:
Arnaud Giersch
Date:
2025-07-09 17:59:02 UTC
Severity:
normal
Tags:
#1109002#5
Date:
2025-07-09 10:18:51 UTC
From:
To:
Dear Maintainer,

The Basic function BubbleSortList from the module Tools/Strings gives
sometimes a wrong answer.

When the smallest element of the array is at the last position, it is taken
to the second position instead of the first in the sorted result.

For example, the following program shows "After: [2, 1, 3]" instead of the
expected "After: [1, 2, 3]".

Rem ***** cut here *****
Sub Main
	Dim a(2)
	a(0) = "2"
	a(1) = "3"
	a(2) = "1"
	Print "Before: [" + a(0) + ", " + a(1) + ", " + a(2) + "]"
	b = BubbleSortList(a)
 	' expected: After: [1, 2, 3]
	Print "After: [" + b(0) + ", " + b(1) + ", " + b(2) + "]"
End Sub
Rem ***** cut here *****

I guess that in the code for the BubbleSortList function, the "For s"-loop
should be
	For s = 1 to i
instead of
	For s = 1 to i - 1

Regards,
Arnaud Giersch

#1109002#10
Date:
2025-07-09 15:53:41 UTC
From:
To:
tag 1109002 + moreinfo

thanks


Hi,

Am 09.07.25 um 12:18 schrieb Arnaud Giersch:

https://bugs.documentfoundation.org/show_bug.cgi?id=89803, maybe?


In any case, this is reported against stables old version. Which would definitely not receive fixes for bugs like this - especially as "stable" also means "non-changing" in case people had workarounds in their code.


Backports has 25.2.3, please  retry there? Maybe even 25.8.0 rc1 which is in experimental in some test VM or so?


Regards,


Rene

#1109002#15
Date:
2025-07-09 15:53:41 UTC
From:
To:
tag 1109002 + moreinfo

thanks


Hi,

Am 09.07.25 um 12:18 schrieb Arnaud Giersch:

https://bugs.documentfoundation.org/show_bug.cgi?id=89803, maybe?


In any case, this is reported against stables old version. Which would definitely not receive fixes for bugs like this - especially as "stable" also means "non-changing" in case people had workarounds in their code.


Backports has 25.2.3, please  retry there? Maybe even 25.8.0 rc1 which is in experimental in some test VM or so?


Regards,


Rene

#1109002#24
Date:
2025-07-09 17:46:04 UTC
From:
To:
found 1109002 4:25.2.3-2~bpo12+1

thanks


Hi,
----- Le 9 Juil 25, à 17:53, Rene Engelhard rene@debian.org a écrit : I took a look at the upstream bug report #89803, but I think that it relates to a different problem (it talks about the ordering of accented characters). line must be added at the beginning of the procedure : GlobalScope.BasicLibraries.LoadLibrary("Tools") With this change, I can confirm that the bug is also present in version 4:25.2.3-2~bpo12+1. This is not surprising, given that the code has apparently not been changed in the last 20 years : https://github.com/LibreOffice/core/blame/master/wizards/source/tools/Strings.xba#L373 Unfortunately, I currently have no means to test the experimental version. Regars, Arnaud