Bug 103890 - cut paste formula rewrite
Summary: cut paste formula rewrite
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium normal
Assignee: Kohei Yoshida
QA Contact:
URL:
Whiteboard: target:5.4.0 target:5.3.1 target:5.2.6
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2016-11-12 16:23 UTC by Karoly Gossler 'connor'
Modified: 2017-02-15 16:46 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
sample document (14.37 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-11-12 18:15 UTC, Karoly Gossler 'connor'
Details
original document before the cut/paste (14.45 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-11-12 19:23 UTC, Karoly Gossler 'connor'
Details
details of bibisecting "partial" qualification (3.58 KB, text/plain)
2016-11-17 17:47 UTC, Terrence Enger
Details
details of bibisect "all" qualification (3.33 KB, text/plain)
2016-11-17 17:48 UTC, Terrence Enger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karoly Gossler 'connor' 2016-11-12 16:23:14 UTC
Steps:
1, Create new calc spreadsheet document
2, Create new sheet named "Sheet2"
3, Fill every sheets like this:

A1: 45
B1: 2
C1: =A1*B1

4, Cut the A1:C1 range from Sheet1
5, Paste the clipboard to A2:C2 on Sheet2

Facts:
- In C1 cell the expected result is =A1*B1 but there is =Sheet2.A1*Sheet2.B1
- Formula with the current sheet name is unnecessary and hard to read in the case of complicated forumas.
- This bug rewrites every formulas in the document.
- This bug can crash the calc in the case of big document.
- Sometimes the forumla rewrite can breaks the foruma.
- Tested on platform OSX and linux
- Copy/paste not affected.
Comment 1 Karoly Gossler 'connor' 2016-11-12 17:31:23 UTC
... - 4.3.0.4: not affeced
4.3.1.2 - 4.3.7.2: partially affected (rewrites only the pasted formula)
4.4.0.3 - master~2016-11-12_00.32.05 build: affected
Comment 2 Joel Madero 2016-11-12 17:57:35 UTC
> 
> Facts:
> - In C1 cell the expected result is =A1*B1 but there is =Sheet2.A1*Sheet2.B1

This seems like it might have been done on purpose....I don't see the problem.

> - Formula with the current sheet name is unnecessary and hard to read in the
> case of complicated forumas.
"unnecessary" based on? It might be necessary in some way that you are not aware of (or that I'm not aware of). It also is nice because it indicates that a copy/paste was done which I think could in theory be useful.

> - This bug rewrites every formulas in the document.
Further proof that it was intentional.

> - This bug can crash the calc in the case of big document.
Sample document?

> - Sometimes the forumla rewrite can breaks the foruma.
Sample document?
Comment 3 Karoly Gossler 'connor' 2016-11-12 18:15:56 UTC
Created attachment 128698 [details]
sample document

The bug rewrites everything on Sheet3.
My modifications only done on Sheet1 and Sheet2.
Comment 4 Karoly Gossler 'connor' 2016-11-12 19:23:35 UTC
Created attachment 128699 [details]
original document before the cut/paste
Comment 5 MM 2016-11-13 01:32:42 UTC
Unconfirmed with v3.3.4 under windows 7 x64.
Confirmed with v5.1.6.2 under windows 7 x64.

I see the problem.

When -copying- for example A1:C3 from sheet 1 to sheet 2, nothing happens, the formula stays the same.
When doing a -cut- & -paste- A1:C3 from sheet 1 to sheet 2, the formula not only changes in sheet 2, but also in sheet 1 & 3. But, the forumla only gets changed after you paste it.
Happens with options > formula > default *and* custom... (opencl).

Dunno if it's intented, looks pretty weird to me if suddenly *all* of these formulas in a document got changed. Maybe it still gives the right outcome, but I don't think any user wants it intentionally changed.
Comment 6 Terrence Enger 2016-11-17 17:45:31 UTC
It seems to me that the qualification of cell references after
copy-and-paste is not clearly wrong.  However, I note that if the
program has qualified cell references other than those is Sheet2.C1,
the other references remain qualified after <Undo><Undo>.

I have bibisected in the Linux 44max bibisect repository on
debian-sid; to summarize the results ...

    commit    s-h       references after cut-and-paste
    --------  --------  ------------------------------------------
    feed1c07  52d21ee6  Sheet2.C1 and Sheet1.C2 unqualified
    7c055d90  5e55d5ff  Sheet2.C1 qualified, Sheet1.C2 unqualified
    93992fcd  5b7920ee  Sheet2.C1 qualified, Sheet1.C2 unqualified
    1b5ce0c2  31abf4ce  Sheet2.C1 and Sheet1.C2 qualified

Details coming soon.

I am removing keyword bibisectRequest and adding bisected, and I am
adding Matthew Francis to cc.
Comment 7 Terrence Enger 2016-11-17 17:47:05 UTC
Created attachment 128821 [details]
details of bibisecting "partial" qualification
Comment 8 Terrence Enger 2016-11-17 17:48:37 UTC
Created attachment 128822 [details]
details of bibisect "all" qualification
Comment 9 Terrence Enger 2016-11-17 17:51:39 UTC
Removing Matthew Francis from cc.  I apologize for the noise.
Comment 10 Xisco Faulí 2016-11-18 21:34:16 UTC
Hello Terrence,
so which bibisect output do we have to take into account? the partial one or the all one?
Comment 11 Terrence Enger 2016-11-21 19:22:44 UTC
When MM confirmed the bug in comment 5, he mentioned seeing only the
"all" behaviour.  I guess that means that the "all" behaviour is the
bug.

I will admit that the result is a bit strange, but I, myself, do not
find it clearly wrong.
Comment 12 MM 2017-01-26 19:19:43 UTC
(In reply to Terrence Enger from comment #11)
> When MM confirmed the bug in comment 5, he mentioned seeing only the
> "all" behaviour.  I guess that means that the "all" behaviour is the
> bug.
> 
> I will admit that the result is a bit strange, but I, myself, do not
> find it clearly wrong.

Well, it's more than a bit strange, it's also unwanted. If you change just one thing in 1 sheet and every formula in every other sheet is changed, that's not good, as the user didn't opted for that.
Comment 13 Kohei Yoshida 2017-02-09 04:01:35 UTC
I'm looking into this.
Comment 14 Commit Notification 2017-02-09 14:06:17 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

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

tdf#103890: Fix the logic on setting 3D flag on reference.

It will be available in 5.4.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.
Comment 15 Commit Notification 2017-02-09 14:06:24 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

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

tdf#103890: Add unit test for this.

It will be available in 5.4.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.
Comment 16 Commit Notification 2017-02-09 16:00: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=6e1efe7b6bd16e3183cdb7c87d786cb714a61959

preserve 3D flag if sheet reference is absolute, tdf#103890 follow-up

It will be available in 5.4.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.
Comment 17 Commit Notification 2017-02-09 16:44:24 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

add absolute sheet reference unit test for tdf#103890

It will be available in 5.4.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.
Comment 18 Commit Notification 2017-02-09 17:56:23 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

yet more 3D flag to preserve cases, tdf#103890 follow-up

It will be available in 5.4.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.
Comment 19 Commit Notification 2017-02-09 17:56:31 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

and more unit tests for tdf#103890

It will be available in 5.4.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.
Comment 20 Kohei Yoshida 2017-02-09 22:38:29 UTC
Not sure whether Eike's done with his follow-up fixes... I'll give it some time and close this as fixed unless we have new discoveries.
Comment 21 Kohei Yoshida 2017-02-10 22:11:51 UTC
Alright.  It's been one day, but...   I'll call this fixed.
Comment 22 Commit Notification 2017-02-14 12:09:58 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=68b53bb080a73027661260b9927245b64a940161&h=libreoffice-5-3

tdf#103890: Fix the logic on setting 3D flag on reference.

It will be available in 5.3.1.

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 23 Commit Notification 2017-02-15 16:46:06 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d7a6b6dbec77f6ca6aee013ba3887d1decba8069&h=libreoffice-5-2

tdf#103890: Fix the logic on setting 3D flag on reference.

It will be available in 5.2.6.

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.