Bug 83067 - Sort broken when using functions NOW, TODAY, INFO and RAND
Summary: Sort broken when using functions NOW, TODAY, INFO and RAND
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.3.1.1 rc
Hardware: All All
: medium major
Assignee: Eike Rathke
URL:
Whiteboard: target:4.4.0 target:4.3.2 target:5.3.0
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-08-25 17:10 UTC by Laurent BP
Modified: 2016-09-22 08:07 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Test file to sort on column A. Columns B and C should remain equal (21.99 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-08-25 17:10 UTC, Laurent BP
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent BP 2014-08-25 17:10:04 UTC
Created attachment 105245 [details]
Test file to sort on column A. Columns B and C should remain equal

Description: Sorting when cells contain one of these special functions and some internal relative references will mixed references.

Steps to reproduce:
1. Open attached document which contains:
     column A some dates
     column B formula =YEARS($A2;NOW();0)
     column C formula =YEARS($A2;$E$1;0) same formula with same result, but NOW() has been replaced by absolute reference to E1 which contains formula =NOW()
2. Select data A1:C5
3. Click on "Sort Ascending" button

Expected result:
Column B and C should be sorted the same way, and references in formula should remain with the same row number

Actual result:
Column C is correctly sorted, but column B is mixed because references are modified to reflect the new position of the cells.

Same bug with other functions: TODAY(), RAND() and INFO(). No problem with many other functions. The bug appears if formulas use one of these functions (which seem to need to communicate with the system).

Test made on Win 7 with Version: 4.3.2.0.0+
Build ID: 02bcf0d5abff100289d01c29eee2ed0685eb64ca
TinderBox: Win-x86@42, Branch:libreoffice-4-3, Time: 2014-08-23_08:23:00 
which contains correction for bug 79441

Bug also reproduce with previous versions:
- Version: 4.4.0.0.alpha0+
Build ID: ad85ce18d3939170e5ef7b1a1f8e5dda2c8aeb9c
TinderBox: Win-x86@39, Branch:master, Time: 2014-08-11_05:21:44
- Version: 4.3.1.1
Build ID: c4b15cd4d00dec6b266fa830b4ba73e31ae6ce73
- Version: 4.2.7.0.0+
Build ID: 8de2e9b4bc53e6c097897142bad223c100d36292
TinderBox: Win-x86@42, Branch:libreoffice-4-2, Time: 2014-08-08_21:42:21
- Version: 4.2.7.0.0+
Build ID: 352a728ffbe171ea6f9f8e93e143fa24198d8271
TinderBox: Win-x86@42, Branch:libreoffice-4-2, Time: 2014-08-25_10:03:12

NOT reproduce with versions:
- Version: 4.1.6.2
Build ID: 40ff705089295be5be0aae9b15123f687c05b0a
- Version: 4.2.6.2
Build ID: 185f2ce4dcc34af9bd97dec29e6d42c39557298f
- Version: 4.3.0.4
Build ID: 62ad5818884a2fc2e5780dd45466868d41009ec0
Comment 1 Eike Rathke 2014-08-25 19:12:45 UTC
I'm working on it.
Comment 2 Commit Notification 2014-08-25 20:01:47 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0792aef9010007d5738723d8930990028bef2f9e

fdo#83067 also volatile cells need to listen to all references



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 3 Eike Rathke 2014-08-25 20:07:10 UTC
Pending review
https://gerrit.libreoffice.org/11112 for 4-3
https://gerrit.libreoffice.org/11113 for 4-3-1
Comment 4 Commit Notification 2014-08-25 23:11:07 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a8526c4ab75af37574dff85ce4b9c9a5b88f4886

unit test for sort with volatile formula cells, fdo#83067



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 5 Laurent BP 2014-08-26 16:19:17 UTC
(In reply to comment #2)
> Eike Rathke committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=0792aef9010007d5738723d8930990028bef2f9e
> 
> fdo#83067 also volatile cells need to listen to all references
Resolution verified with Version: 4.4.0.0.alpha0+
Build ID: 37b9ea92ba81d74764a2345a9c75c65bfd272d2b
TinderBox: Win-x86@42, Branch:master, Time: 2014-08-26_09:37:01

Thanks Eike :)
Comment 6 Commit Notification 2014-08-27 06:14:50 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fe97e1d66aecedb019c85967d5e81bd620c7555a&h=libreoffice-4-3

fdo#83067 also volatile cells need to listen to all references


It will be available in LibreOffice 4.3.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2016-09-22 08:07:41 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5306fabfea74c01b49f96920564c7eefa91e87aa

tdf#87101 Revert "fdo#83067 also volatile cells need to listen to all refe"...

It will be available in 5.3.0.

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

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