Bug 160139 - Header/footer contents removed and cannot be restored after some paste actions (from shape; as RTF; Zotero refresh...) (steps in comment 2)
Summary: Header/footer contents removed and cannot be restored after some paste action...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha1+
Hardware: All All
: high critical
Assignee: Not Assigned
URL:
Whiteboard: target:24.8.0 target:24.2.3 target:25...
Keywords: bibisected, bisected, dataLoss, regression
: 160045 160236 160263 160759 161356 161564 161630 161952 162170 162350 162500 (view as bug list)
Depends on:
Blocks: Writer-Header-Footer Paste Crash Regressions-ooxml-handle-first-hdr-ftr
  Show dependency treegraph
 
Reported: 2024-03-10 17:48 UTC by smsourov.bd
Modified: 2024-10-17 17:10 UTC (History)
18 users (show)

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 smsourov.bd 2024-03-10 17:48:27 UTC
Description:
A weird problem. I've made a proper document with header(page numbers) and a footer(my name). In some cases, if I make a normal copy and paste in the body of the document, the header and footer gets removed and ctrl+z doesn't restore them.

Steps to Reproduce:
1. Open Impress and close the template selection window.
2. Write something in the "Click to add Title" field. I've given "Something" and copy the texts of that field. In my case, I'll be copying the text "Something"
3. Open Writer.
4. Give a header and footer. In my case, I'll be giving the page number as header(via Insert Page Number) and the text "LibreOffice" as footer.
5. Now paste the text "Something" in the page body.
6. Undo the text by pressing ctrl+z.

Actual Results:
When the text is pasted, the header and footer is gone. Moreover, when ctrl+z is pressed, the header and footer is not restored.

Expected Results:
When the text will be pasted, the header and footer will stay there as in the way were, those shouldn't be erased in the first place. 
Moveover, when ctrl+z is pressed, everything should be restored in the previous stated, including the header and footer.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
This is very annoying.
Comment 1 BogdanB 2024-03-10 19:44:23 UTC
Confirm with
Version: 24.2.1.1 (X86_64) / LibreOffice Community
Build ID: 359ef544e625d2ffbfced462ab37bd593ca85fa7
CPU threads: 16; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 2 smsourov.bd 2024-03-15 10:01:41 UTC
The bug can be reproduced in another way without the need of Impress.

Steps to reproduce:
1. Open Writer and give a header and footer.
2. Insert a shape and insert a text in it.
3. Copy that text and paste in the document body. After pasting it, the header and footer will disappear.
Comment 3 BogdanB 2024-03-15 10:37:48 UTC
Yes, it's easier to test like this.

Version: 24.2.1.2 (X86_64) / LibreOffice Community
Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: ro-RO (en_US); UI: en-US
Calc: threaded
Comment 4 Xisco Faulí 2024-03-22 13:37:58 UTC
Regression introduced by:

author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2023-11-28 13:46:21 +0900
committer	Tomaž Vajngerl <quikee@gmail.com>	2023-12-01 08:26:38 +0100
commit 4b0fa253a4540f5461397815d290586f9ddabe61 (patch)
tree c58c59871244dc75e538caeea40658303da00b8b
parent 93357349ff1998b41ea1ebedf09dc1cc5da316f7 (diff)
tdf#136472 adjust ooxml import to handle first header/footer

Bisected with: bibisect-linux64-24.2
Comment 5 Xisco Faulí 2024-03-22 13:44:46 UTC
The header being removed after pasting the text started to happen after

author	Miklos Vajna <vmiklos@collabora.com>	2024-02-05 10:38:06 +0100
committer	Miklos Vajna <vmiklos@collabora.com>	2024-02-05 12:36:44 +0100
commit d918beda2ab42668014b0dd42996b6ccc97e8c3a (patch)
tree caf41debedf8d50d3c90df7255222a13e406e702
parent 1ae7a81e542c9b072e519d0ea0d4773ed26ca251 (diff)
tdf#158814 DOCX import: fix unwanted header with type="first" & no titlePg

Adding also Miklos to the loop
Comment 6 Miklos Vajna 2024-03-22 15:35:01 UTC
Let me see (at least the header removal part).
Comment 7 BogdanB 2024-03-22 18:24:11 UTC
In debug version I get this:

warn:writerfilter:72853:72853:writerfilter/source/dmapper/PropertyMap.cxx:606: Paper source not found com.sun.star.lang.IllegalArgumentException message: "at /home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/unocore/unostyle.cxx:1701" ArgumentPosition: 0

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 71efd6046488b952f679936ea1c4a415f4989b18
CPU threads: 16; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 8 Commit Notification 2024-03-22 18:35:50 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

Relatted: tdf#160139 RTF paste: don't turn off headers/footers

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 9 BogdanB 2024-03-22 18:58:52 UTC
MIklos, I build LibreOffice with your latest patch, and I still repro with text copied from a shape.

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c900850742efd4e1fb7c79c13c1b9a17fcd4981d
CPU threads: 16; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 10 Xisco Faulí 2024-03-22 19:48:14 UTC
(In reply to BogdanB from comment #9)
> MIklos, I build LibreOffice with your latest patch, and I still repro with
> text copied from a shape.

Miklos' patch fixes the bisection from comment 7, which is the header being turned off. The shape disappearing is the bisection from comment 4
Comment 11 Stéphane Guillou (stragu) 2024-03-23 01:44:22 UTC
(In reply to Commit Notification from comment #8)
> Miklos Vajna committed a patch related to this issue.
> https://git.libreoffice.org/core/commit/
> c900850742efd4e1fb7c79c13c1b9a17fcd4981d
With this patch included in my own build:
- comment 0 steps: still reproduced
- comment 2 steps: still reproduced

(tested on Linux, gtk3 VCL plugin)

To any of those STR, you can add the following steps for a crash:
a. keep undoing
b. if it doesn't crash on undoing, close LO

Results: crash in either a or b.
Comment 12 Stéphane Guillou (stragu) 2024-03-23 01:52:59 UTC
Crash reports in 24.2.1 annoyingly have the <name omitted> signature but both crash STR + undo × 2 lead to the same crash in sw/inc/bparr.hxx:105:
- https://crashreport.libreoffice.org/stats/crash_details/c1e2e71d-e087-4252-ad6d-0a2e595f4b56
- https://crashreport.libreoffice.org/stats/crash_details/bc7501f7-41d7-4c1f-8abf-6c2a7e613a92
Comment 13 Miklos Vajna 2024-03-25 08:14:33 UTC
(In reply to Xisco Faulí from comment #10)
> Miklos' patch fixes the bisection from comment 7, which is the header being
> turned off.

Exactly. :-) I didn't do anything regarding turning the filled in header into an "empty but on" header.
Comment 14 Commit Notification 2024-03-25 08:59:56 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/2e31c7cd2976be3d43b0845e50d0bb4ca7e50179

Relatted: tdf#160139 RTF paste: don't turn off headers/footers

It will be available in 24.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 15 smsourov.bd 2024-03-28 17:07:20 UTC Comment hidden (me-too)
Comment 16 Stéphane Guillou (stragu) 2024-04-03 00:26:23 UTC
*** Bug 160263 has been marked as a duplicate of this bug. ***
Comment 17 Stéphane Guillou (stragu) 2024-04-03 07:12:07 UTC
*** Bug 160236 has been marked as a duplicate of this bug. ***
Comment 18 Stéphane Guillou (stragu) 2024-04-03 07:14:51 UTC
As shown in bug 160236, this also severely affects Zotero users, as adding or refreshing a bibliography (which happens very frequently) seems to use the same pasting path.
Comment 19 Stéphane Guillou (stragu) 2024-04-23 01:05:06 UTC
*** Bug 160759 has been marked as a duplicate of this bug. ***
Comment 20 Stéphane Guillou (stragu) 2024-04-23 01:58:42 UTC
Indeed, Miklos' c900850742efd4e1fb7c79c13c1b9a17fcd4981d does fix the removal of the header on paste.
This is the situation since that commit:

1. Writer
2. Type "header" in header and "footer" in footer
3. Insert a shape and type text inside it
4. Copy that text and paste in the document body: header and footer emptied _but still exist_
5. Ctrl + Z: pasted text removed
6. Ctrl + Z: shape text removed
7. Ctrl + Z: shape removed
8. Ctrl + Z: nothing (supposed to be "undo typing 'footer'", so cursor moves to footer)
9. Ctrl + Z: header text restored; footer removed
10. Ctrl + Z: header text removed
11. Ctrl + Z: header removed
12. Close Writer: crash

@Miklos: note that I couldn't crash it at c900850742~1, nor at d918beda2a~1, so maybe something you want to have a look at?

@Quikee: any chance you could look at the regression caused by 4b0fa253a4540f5461397815d290586f9ddabe61?
Comment 21 Stéphane Guillou (stragu) 2024-06-11 05:46:35 UTC
*** Bug 160045 has been marked as a duplicate of this bug. ***
Comment 22 Stéphane Guillou (stragu) 2024-06-11 05:56:18 UTC
Minimal steps from duplicate bug 160045:

1. Insert any text into the header
2. Copy it
3. Paste with Ctrl + Shift + V, select RTF
Comment 23 sbagliato 2024-06-14 08:32:03 UTC
But the problem occurs only when copying from Calc.
if I copy from another source the header is not deleted
Comment 24 Stéphane Guillou (stragu) 2024-06-15 00:59:32 UTC
(In reply to sbagliato from comment #23)
> But the problem occurs only when copying from Calc.
> if I copy from another source the header is not deleted
That's because the default Paste format when copying Calc data is RTF. You can see with other paste formats in Ctrl + Shift + V that the bug does not occur.
Comment 25 Stéphane Guillou (stragu) 2024-06-18 10:21:49 UTC
*** Bug 161630 has been marked as a duplicate of this bug. ***
Comment 26 Stéphane Guillou (stragu) 2024-07-01 14:59:22 UTC
*** Bug 161564 has been marked as a duplicate of this bug. ***
Comment 27 Stéphane Guillou (stragu) 2024-07-08 15:08:33 UTC
*** Bug 161952 has been marked as a duplicate of this bug. ***
Comment 28 Commit Notification 2024-07-11 10:34:04 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#160139 sw RTF paste: don't empty headers/footers

It will be available in 25.2.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 29 Commit Notification 2024-07-11 16:07:12 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/54410768676b247c2524aae229574527c67dc1d5

tdf#160139 sw RTF paste: don't empty headers/footers

It will be available in 24.8.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.
Comment 30 Commit Notification 2024-07-14 22:05:53 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/82b9c13bc59b94ee5b42d0d7384d807d323aaf67

tdf#160139 sw RTF paste: don't empty headers/footers

It will be available in 24.2.6.

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 31 Stéphane Guillou (stragu) 2024-07-15 01:09:47 UTC
Fix verified for pasting something from Header, from shape, from Calc and from Impress in:

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ccc3996cfcbebe14e9d5f3511906cfc64ddf3452
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Thanks Justin! I think you can mark as fixed :)
Comment 32 smsourov.bd 2024-07-15 04:16:26 UTC
I've tested the latest dev build of 25.2 and I can confirm that the bug no longer exist.
Thank you for your time and effort. <3
Comment 33 Stéphane Guillou (stragu) 2024-07-24 11:39:36 UTC
*** Bug 162170 has been marked as a duplicate of this bug. ***
Comment 34 Dieter 2024-08-20 08:59:16 UTC
*** Bug 162350 has been marked as a duplicate of this bug. ***
Comment 35 Justin L 2024-09-28 15:24:24 UTC
*** Bug 161356 has been marked as a duplicate of this bug. ***
Comment 36 Justin L 2024-10-17 17:10:39 UTC
*** Bug 162500 has been marked as a duplicate of this bug. ***