Bug 73678 - FORMATTING: Conditional Formatting lost when Click-drag Sheet2 tab to position 1 or adding, then removing an empty sheet
Summary: FORMATTING: Conditional Formatting lost when Click-drag Sheet2 tab to positio...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: All All
: high major
Assignee: Matt K
URL:
Whiteboard: target:24.8.0 target:24.2.0.2
Keywords: bibisected, bisected, regression
: 99378 (view as bug list)
Depends on:
Blocks: Conditional-Formatting
  Show dependency treegraph
 
Reported: 2014-01-15 22:18 UTC by Kevin Hunter
Modified: 2024-01-09 08:55 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Single sheet with some conditional formatting. (14.69 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-01-15 22:18 UTC, Kevin Hunter
Details
What sheet should look like. (116.93 KB, image/png)
2014-01-15 22:19 UTC, Kevin Hunter
Details
Conditional formatting formulas before corruption (21.40 KB, image/png)
2014-01-15 22:19 UTC, Kevin Hunter
Details
Making a new sheet (15.84 KB, image/png)
2014-01-15 22:20 UTC, Kevin Hunter
Details
Move new Sheet2 to first tab position (19.77 KB, image/png)
2014-01-15 22:20 UTC, Kevin Hunter
Details
Right-click Sheet2 and select Delete (27.08 KB, image/png)
2014-01-15 22:21 UTC, Kevin Hunter
Details
Close window and click yes on "Save?" prompt (23.12 KB, image/png)
2014-01-15 22:21 UTC, Kevin Hunter
Details
See new red cells that should not be there (18.06 KB, image/png)
2014-01-15 22:22 UTC, Kevin Hunter
Details
Now corrupted conditional formatting formulas (21.13 KB, image/png)
2014-01-15 22:22 UTC, Kevin Hunter
Details
A single formula and a single conditional formatting (9.36 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-12-27 16:37 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Hunter 2014-01-15 22:18:28 UTC
Created attachment 92186 [details]
Single sheet with some conditional formatting.

58484 

Problem description: 

Creating, moving, and deleting a (empty) sheet, then saving appears to corrupt conditional formatting formulas.

Steps to reproduce:
1. Open supplied spreadsheet.

2. Note one red cell.  This is correct, as image 1 shows.

3. Create a new sheet by clicking the green plus arrow.

4. Click-drag Sheet2 tab to position 1, so that Sheet2 is the first sheet, and Data is the second sheet.

5. Right-click on the Sheet2 tab and choose "Delete" from the context menu.

6. Close window/exit Libreoffice, so that you're prompted with "Save your work?" dialog before exiting.

7. Click save.

8. Reopen the spreadsheet, and note two red cells that are now incorrect.


Current behavior:

A seemingly innocuous operation (adding, then removing an empty sheet) corrupts the conditional formatting on another sheet.

Expected behavior:

The conditional formatting should not get corrupted.

Operating System: Ubuntu
Version: 4.1.3.2 release
Comment 1 Kevin Hunter 2014-01-15 22:19:24 UTC
Created attachment 92187 [details]
What sheet should look like.
Comment 2 Kevin Hunter 2014-01-15 22:19:49 UTC
Created attachment 92188 [details]
Conditional formatting formulas before corruption
Comment 3 Kevin Hunter 2014-01-15 22:20:21 UTC
Created attachment 92189 [details]
Making a new sheet
Comment 4 Kevin Hunter 2014-01-15 22:20:54 UTC
Created attachment 92190 [details]
Move new Sheet2 to first tab position
Comment 5 Kevin Hunter 2014-01-15 22:21:25 UTC
Created attachment 92191 [details]
Right-click Sheet2 and select Delete
Comment 6 Kevin Hunter 2014-01-15 22:21:59 UTC
Created attachment 92192 [details]
Close window and click yes on "Save?" prompt
Comment 7 Kevin Hunter 2014-01-15 22:22:26 UTC
Created attachment 92193 [details]
See new red cells that should not be there
Comment 8 Kevin Hunter 2014-01-15 22:22:55 UTC
Created attachment 92194 [details]
Now corrupted conditional formatting formulas
Comment 9 Kevin Hunter 2014-01-15 22:25:50 UTC
Comment on attachment 92186 [details]
Single sheet with some conditional formatting.

Updating mime type.
Comment 10 Kevin Hunter 2014-01-16 04:19:44 UTC
This is potentially related or a duplicate of one of these bugs:

    Bug 48360
    Bug 54464
    Bug 54842
    Bug 58484

Maybe not, but perhaps they can some context to track down the error, if needs be.
Comment 11 Dominique Boutry 2014-01-16 11:06:30 UTC
Partly reproduced with LibO 4.2.0.2 on Win7 : 
- after step 5, the two red (C29:D29) cells are incorrect,
- after step 8, there are no more conditional formating.

Thus related to bug 54464 and bug 58484 (not fully resolved ? regression ?).
Comment 12 Joel Madero 2014-01-31 15:58:29 UTC
Thank you for reporting this issue! I have been able to confirm the issue on:
Version: 4.2.0.3 rc
Platform: Ubuntu Linux 13.04

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
As I've been able to confirm this problem I am marking as:

New (confirmed)
Major - loss of data
High


Markus - any thoughts on this one? Instructions are really clear and I can reproduce on last RC

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage and join us on freenode at #libreoffice-qa

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material
Comment 13 Owen Genat (retired) 2014-09-06 00:14:21 UTC
(In reply to comment #0)
> 8. Reopen the spreadsheet, and note two red cells that are now incorrect.

No longer reproducible under GNU/Linux using v4.3.0.4 Build ID: 62ad5818884a2fc2e5780dd45466868d41009ec0. Original single red cell displays as expected after described actions. Perhaps fixed at some point?
Comment 14 Owen Genat (retired) 2014-10-10 13:15:06 UTC
(In reply to Owen Genat from comment #13)
> (In reply to comment #0)
> > 8. Reopen the spreadsheet, and note two red cells that are now incorrect.
> 
> No longer reproducible under GNU/Linux using v4.3.0.4 Build ID:
> 62ad5818884a2fc2e5780dd45466868d41009ec0. Original single red cell displays
> as expected after described actions. Perhaps fixed at some point?

Reproducible again under GNU/Linux using v4.3.2.2 Build ID: edfb5295ba211bd31ad47d0bad0118690f76407d.
Comment 15 Joel Madero 2016-04-18 18:30:00 UTC
*** Bug 99378 has been marked as a duplicate of this bug. ***
Comment 16 QA Administrators 2017-05-22 13:27:09 UTC Comment hidden (obsolete)
Comment 17 eisa01 2019-11-03 16:05:08 UTC
This is still present

It was also working in LO 3.3, so this is a regression

Version: 6.4.0.0.alpha1+
Build ID: 80109586e6cb6d3e2e0a53a9079c3125ec9b8368
CPU threads: 4; OS: Mac OS X 10.14.6; UI render: default; VCL: osx; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 18 Aron Budea 2020-02-01 12:37:55 UTC
Good catch! Bibisected to the followiing commit using repo bibisect-41max.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=9261c0bf6ecf6633a5577879f003edfcb569f4d7
author		Markus Mohrhard <markus.mohrhard@googlemail.com>	2013-03-24 05:09:08 +0100
committer	Markus Mohrhard <markus.mohrhard@googlemail.com>	2013-03-24 05:14:18 +0100

URM_INSDEL we need to update the src position, fdo#62206
Comment 19 QA Administrators 2022-02-01 04:46:09 UTC Comment hidden (obsolete)
Comment 20 eisa01 2022-02-05 13:12:54 UTC
This is still present

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 583185235389b55d6cfffac3067c0e1ccb2852b1
CPU threads: 10; OS: Mac OS X 10.16; UI render: Skia/Raster; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 21 Matt K 2023-12-10 19:59:10 UTC
Fix is posted at https://gerrit.libreoffice.org/c/core/+/160234.
Comment 22 Mike Kaganski 2023-12-27 16:37:01 UTC
Created attachment 191604 [details]
A single formula and a single conditional formatting

The attachment has a simplest case, that allows to see the difference in processing. B1 has a formula "=A1"; and also it has a conditional formatting "if value is equal A1 ...". So both reference the same cell (i.e., have relative reference "same tab, column -1, same row").

Put breakpoint to adjustSingleRefOnDeletedTab, do steps from comment 0 (just with this attachment), and see how the *two* invocations of adjustSingleRefOnDeletedTab - first for ScConditionalEntry, and second for ScFormulaCell in call stack - differ in the value of *rOldPos* argument. For ScFormulaCell case, it has tab 1, while for ScConditionalEntry case, it has tab 0.

It shows, that the wrong tab is passed to the function in one case; so the function has no chance to do the right job.

The fix should focus on finding, why doesn't conditional formatting tab data update on Sheet2 move.
Comment 23 Matt K 2024-01-03 02:20:14 UTC
(In reply to Mike Kaganski from comment #22)
> The fix should focus on finding, why doesn't conditional formatting tab data
> update on Sheet2 move.

You were right, there was a better way of doing this that matches what you would expect.  I've updated the linked fix with a new patchset.
Comment 24 Commit Notification 2024-01-06 17:20:51 UTC
Matt K committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0ba4e0483bacd698a227d0d18422fc6a08055c28

tdf#73678 Prevent conditional formatting from being lost in Calc

It will be available in 24.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 25 Commit Notification 2024-01-09 08:55:49 UTC
Matt K committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/5653238332deac00affa4fa913354b3c8384dab9

tdf#73678 Prevent conditional formatting from being lost in Calc

It will be available in 24.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.