Bug 148072 - Sheet-local named expression destroyed with Cut-Paste-Undo
Summary: Sheet-local named expression destroyed with Cut-Paste-Undo
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:7.4.0 target:7.3.5 target:7.5.0
Keywords:
Depends on:
Blocks: Cell-Name
  Show dependency treegraph
 
Reported: 2022-03-18 13:39 UTC by Eike Rathke
Modified: 2022-06-16 13:53 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eike Rathke 2022-03-18 13:39:46 UTC
This is a spin-off of
https://bugs.documentfoundation.org/show_bug.cgi?id=81435#c16
Use https://bugs.documentfoundation.org/attachment.cgi?id=157283 as the test case.

Copied description (reformatted for readability):

problem: the name-reference is changed on move, but not rechanged on undo.

it's two issues, one for moving into one sheet, another for moving to another sheet, the steps to reproduce the issue are noted in the sheet, copied here:

A) name references messed up by moving of content into the sheet and undo
steps to reproduce
1.  check name reference 'testfield_1' to sheet1.B2 (hit ctrl-F3),
    scope of reference: sheet1
2.  move sheet1.B2:sheet1.B3 to sheet1.C2:sheet1.C3 (ctrl-X, ctrl-V)
3.  check new name reference 'testfield_1' with target C2 and scope
    sheet1, in the lower part of the box 'ctrl-F3' the scope is
    announced as global!
4.  undo move – ctrl-Z – ctrl-Z
5.  check result in sheet1.B3: '=#NAME?'
    despite 'testfield_1' still defined, but pointing to $C$2
    imho the change by the move should be undone by undo
(if you undo the move by another move with exchanged source-target references are handeled correctly)

B) name references messed up by moving of content to another sheet and undo
steps to reproduce
1.  check name reference 'testfield_1' to sheet1.B2 (hit ctrl-F3), scope
    of reference: sheet1
2.  move sheet1.B2:sheet1.B3 to sheet2.B2:sheet2.B3 (ctrl-X, ctrl-V)
3.  check new name reference 'testfield_1' with scope sheet2,
3a. check old reference with scope sheet1 remains, but now points to new
    location (on sheet2)
4.  check result in sheet2.B3: '=#NAME?'
5.  undo move – ctrl-Z – ctrl-Z
6.  check sheet1.B3 result now '0', it still references to testfield_1
    on sheet2
    test by input number to sheet2.B2
7.  remove name reference testfield_1 from sheet2
8.  observe result in sheet1.B3 unaffected,
9.  change value in sheet2.B2
10. observe sheet1.B3 still calculating with the removed reference

(if you undo the move by another move with exchanged source-target references are NOT handeled correctly)
Comment 1 Eike Rathke 2022-06-09 18:02:43 UTC
Scenario slightly changed:
For A)3. the scope in the dialog is still Sheet1 as it should, not Global.
For B)3. and B)4. the formula in Sheet2.B3 is =Sheet1.testfield_1 where testfield_1 with scope Sheet1 points correctly to $Sheet2.$B$2, nothing with scope Sheet2.
For B)8. nope, deleting testfield_1 name results in #NAME? in Sheet1.B3 as it should.
Similar B)9. and B)10. do not occur.

Actual problems:
A)5. after Ctrl+Z Ctrl+Z the testfield_1 name is gone.
B)6. after Ctrl+Z Ctrl+Z the Sheet1 scope testfield_1 still points to $Sheet2.$B$2 instead of $Sheet1.$B$2
Comment 2 Commit Notification 2022-06-10 09:24:44 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

Resolves: tdf#148072 Restore sheet-local names for Undo of Cut

It will be available in 7.4.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 3 Eike Rathke 2022-06-10 11:09:17 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/135587 for 7-3
Comment 4 Commit Notification 2022-06-12 08:13:57 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

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

Resolves: tdf#148072 Restore sheet-local names for Undo of Cut

It will be available in 7.3.5.

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 5 Commit Notification 2022-06-16 13:53:32 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#148072: sc: Add UItest

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