Bug 165821 - COUNTA on a true »empty range« returns 1
Summary: COUNTA on a true »empty range« returns 1
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.7.2 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:25.8.0 target:25.2.3 target:24...
Keywords: bibisected, regression
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2025-03-19 12:53 UTC by Werner Tietz
Modified: 2025-04-25 09:42 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
COUNTA on empty ranges (2.97 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-03-19 17:14 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Werner Tietz 2025-03-19 12:53:30 UTC
Description:
Open a new spreadsheet-Document and enter into A1 the Formula:
```=COUNTA(K:K)```
it returns 1 instead expected 0

Steps to Reproduce:
see descriptio

Actual Results:
the Formula returns »1«

Expected Results:
the observed Range is empty, so I would expect »0« as result


Reproducible: Always


User Profile Reset: No

Additional Info:
Happens with:
```
Version: 7.4.7.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 4; OS: Linux 6.6; UI render: Skia/Vulkan; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Debian package version: 4:7.4.7-1+deb12u7
Calc: threaded
```

also with:

```
Version: 25.2.1.2 (AARCH64) / LibreOffice Community
Build ID: d3abf4aee5fd705e4a92bba33a32f40bc4e56f49
CPU threads: 4; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Flatpak
Calc: threaded
```
and Develop-Built from Source:

```
Version: 25.8.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: c10dbe07b7def2eebd8eed3874c3df9b9d37fa41
CPU threads: 4; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded
```
Comment 1 Vladimir Sokolinskiy 2025-03-19 13:25:42 UTC
Repro.

Version: 24.8.5.2 (X86_64) / LibreOffice Community
Build ID: fddf2685c70b461e7832239a0162a77216259f22
CPU threads: 6; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: ru-RU (ru_RU); UI: ru-RU
Calc: CL threaded
Comment 2 m_a_riosv 2025-03-19 15:20:31 UTC
Reproducible.
Moving the cell to column L and back to column A, works fine, seems like initially it is counting column A not column K.

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e1c7923596f39bac8ce926b56a2450911ffde4d8
CPU threads: 16; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-GB
Calc: CL threaded
Comment 3 Mike Kaganski 2025-03-19 17:14:16 UTC
Created attachment 199906 [details]
COUNTA on empty ranges

The attachment opens with 0,0,0 in A1:A3 in v.7.3.0; but it has 1,2,3 in v.7.4.0.

Regression after 9e2d48b9e04f7ea895fb095699c32ed8a44eb129
Comment 4 Mike Kaganski 2025-03-19 18:19:08 UTC
Actually, regression after 8e3a29110c8ad739bedeea90932663608d8d3935. If the formula referenced 65th column (BM), then it already failed in 7.0. The commit mentioned in comment 3 only made the pre-allocated number small enough, to manifest already in column B.
Comment 5 Mike Kaganski 2025-03-19 19:51:04 UTC
https://gerrit.libreoffice.org/c/core/+/183141
Comment 6 Commit Notification 2025-03-20 05:10:40 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/78a66f99958ed258686cb2fac90f361954b5afe4

tdf#165821: don't change range of ScCellIterator outside of wanted bounds

It will be available in 25.8.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 7 Werner Tietz 2025-03-20 08:46:37 UTC
(In reply to Commit Notification from comment #6)
> Mike Kaganski committed a patch related to this issue.
> It has been pushed to "master":
> 
> https://git.libreoffice.org/core/commit/
> 78a66f99958ed258686cb2fac90f361954b5afe4

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

Thank you… the patch fixed the issue for my build:

```
Version: 25.8.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: c10dbe07b7def2eebd8eed3874c3df9b9d37fa41
CPU threads: 4; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded
```
Comment 8 Commit Notification 2025-03-20 09:25:14 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/7cbe0cf7f249954adf56efc959d4b59961484b24

tdf#165821: don't change range of ScCellIterator outside of wanted bounds

It will be available in 25.2.3.

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 9 Commit Notification 2025-03-20 11:33:49 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d3c38d590bec7a2ea3b4415ba21cbd5137121370

tdf#165821: sc_uicalc: Add unittest

It will be available in 25.8.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 10 Commit Notification 2025-03-21 13:47:28 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/727d93ee82695308f93236eaff09c7e30f1a9474

tdf#165821: don't change range of ScCellIterator outside of wanted bounds

It will be available in 24.8.7.

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 11 Commit Notification 2025-03-21 13:47:31 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-25-2-2":

https://git.libreoffice.org/core/commit/9faef5064c7ca0e44a738b0312378655d78813e1

tdf#165821: don't change range of ScCellIterator outside of wanted bounds

It will be available in 25.2.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.
Comment 12 Commit Notification 2025-03-25 18:56:15 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6997e953593cfd055485af37bf34f0e7861261e9

related: tdf#165821: update test range

It will be available in 25.8.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 13 EdwardMalloy 2025-04-24 08:56:47 UTC Comment hidden (spam)