Bug 169122 - Writer: Consistent Write Error When Overwriting XML (parser error : Attribute style:writing-mode redefined)
Summary: Writer: Consistent Write Error When Overwriting XML (parser error : Attribute...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.0.3 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0 target:25.8.4
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2025-10-28 21:46 UTC by rosanatv70@gmail.com
Modified: 2025-11-24 13:17 UTC (History)
3 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 rosanatv70@gmail.com 2025-10-28 21:46:47 UTC
Description:
When opening an XML file formatted as DocBook (DTD 4.1.2) in Writer, editing its content, and attempting to re-save it, the process consistently fails with a write error.

Steps to Reproduce:
1. Create a file named test.xml with UTF-8 encoding and paste the following XML content:

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
 <article lang="">
   <para>Test</para>
 </article>

2. Open LibreOffice Writer (or start LibreOffice).
3. Go to File Menu → Open… (Ctrl+OCtrl+O).
4. Select and open the test.xml file. The file opens in Writer’s edit mode (without the visible XML tags).
5. Edit the content (e.g., add a character to the paragraph, like “Test 1”).
6. Go to File Menu → Save (Ctrl+SCtrl+S).
7. The “Non-Standard File Format” warning dialog will appear.
8. Click the “Use DocBook format” button.


Actual Results:
After Step 8, an error dialog titled “Error” appears, containing the following message:

    Error saving the document test:
    Write Error.
    The file could not be written.

The document is not saved.


Expected Results:
The document should be saved successfully, overwriting the test.xml file.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
History and Additional Observations (Crucial for Diagnosis):

    100% Reproducible: This write error is consistent and 100% reproducible exclusively when attempting to overwrite the DocBook XML file, as per the listed steps.

    Historical Context (Path/Encoding Issues):
        Previously (Identified in 2020): The local (offline) help failed to open if the LibreOffice installation path contained non-ASCII characters (e.g., accented characters). This was attributed to a failure in encoding the URI of the local file path.
        Fix and Possible Regression/Side Effect (Estimated 2022): An update fixed the local help issue (correct URI encoding). However, the problem of intermittent write errors when saving any file (Writer or Calc) persisted or emerged if the installation path still contained non-ASCII characters.
        Personal Mitigation (Action that resolved intermittency): To stop the intermittent write errors, LibreOffice was installed in a path without accented characters (pure ASCII). This action made the intermittent errors disappear completely.

    Current Conclusion (The Problem Connection):
        Despite using a pure ASCII installation path (which resolved intermittent issues), the write error persists and is constant in the specific scenario of overwriting the DocBook file.
        Inference/Hypothesis: The write error in the DocBook filter (consistent) manifests the same error message that occurred in other (intermittent) scenarios involving non-ASCII installation paths. This suggests that the DocBook filter’s specific save routine may be utilizing path or file URI handling logic that ignores the fixes implemented in the native filters (for ODT/ODS), or that it remains vulnerable to the original encoding problem, failing even when the path is pure ASCII.

    Ethics Statement:
        This report was constructed and translated with the aid of generative AI for the sole purpose of ensuring the text is concise, organized, and technically fluent.

Version: 25.8.2.2 (X86_64)
Build ID: d401f2107ccab8f924a8e2df40f573aab7605b6f
CPU threads: 8; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Raster; VCL: win
Locale: pt-BR (pt_BR); UI: pt-BR
Calc: CL threaded
Comment 1 raal 2025-11-04 23:03:54 UTC
No repro with Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c7b3ea692f293346fbbdf2a391d9d971c34fa1f2
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
Comment 2 jcline 2025-11-14 04:33:45 UTC
reproduced in versions:

Version: 25.8.2.2 (X86_64)
Build ID: d401f2107ccab8f924a8e2df40f573aab7605b6f
CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 620(Build:0)
CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 3 Buovjaga 2025-11-20 15:47:36 UTC
Bibisected with linux-64-7.5 to c70ee4a6b9071468255e5d4fdb893e9c9bdf4fad
tdf#149551 use 'WritingMode' instead of TextPreRotateAngle

We see this error in the console:
Entity: line 3: parser error : Attribute style:writing-mode redefined
nt-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"
                                                                               ^

Could be it's not really a regression, but just exposing some existing problematic code.
Comment 4 Regina Henschel 2025-11-20 19:09:03 UTC
(In reply to Buovjaga from comment #3)
> Bibisected with linux-64-7.5 to c70ee4a6b9071468255e5d4fdb893e9c9bdf4fad
> tdf#149551 use 'WritingMode' instead of TextPreRotateAngle
..
> Could be it's not really a regression, but just exposing some existing
> problematic code.

At a first glance, I think the part #1596... in sdpropls.cxx is suspicious. It removes duplicate writing-mode attributes in case of pShapeWritingMode, but not in case of my new pGraphicWritingMode2.
Comment 5 Commit Notification 2025-11-23 14:20:21 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

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

tdf#169122 no TextWritingMode if GraphicWritingMode2

It will be available in 26.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 6 Regina Henschel 2025-11-23 14:27:44 UTC
This solves the export error, but I'm not really satisfied with the solution. I'm not sure if the DocBook format even has an attribute that reflects the “writing-mode” property. At least, I haven't seen anything like that in my export tests. So in case this fix breaks something in another area, it should be reverted.
Comment 7 Commit Notification 2025-11-24 13:17:57 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

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

tdf#169122 no TextWritingMode if GraphicWritingMode2

It will be available in 25.8.4.

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.