Bug 161876 - Readonly attribute of target file is ignored on "save as" in an other format.
Summary: Readonly attribute of target file is ignored on "save as" in an other format.
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:25.2.0 target:24.8.2
Keywords: bibisected, bisected, regression
Depends on:
Blocks: rename-before-copy-regressions
  Show dependency treegraph
 
Reported: 2024-07-02 18:40 UTC by S
Modified: 2024-09-17 07:48 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 S 2024-07-02 18:40:23 UTC
Description:
Libreoffice ignores the readonly attributes when in "save as" an other format is selected and the target file is readonly.

Steps to Reproduce:
1.two files: one ods and one xlsx file, both readonly on the filesystem
2.open ods file -> loaded as readonly
3.save as xlsx file
4.answer ok to overwrite existing file
5.file is overwritten, but should not.

Actual Results:
The readonly xlxs file is overwritten. In deed it is readonly again after the overwrite.

Expected Results:
The file should not be overwritten. An error should be shown and the readonly bits should be respected.


Reproducible: Always


User Profile Reset: No

Additional Info:
During overwrite I see a tmp file is created. The readonly attribute maybe is circumvented by deleting and renaming files.

With lo 3.6.7.2 the readonly state is correctly respected.
7.4.7.2 shows the same error.

Maybe related:
With 3.6.7.2 it is also possible to open a readonly file, set the file to readwrite in the system and then save the file.
With newer versions this is not possible any more, as the changed attributes seams not updated before saving. So I have to close the file and open again after changing the file attributes.
Comment 1 m_a_riosv 2024-07-02 22:42:59 UTC
I have no Linux, but not possible to do it with Win11.
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: bff48f885e3aad560776a42e451a735ed6c72c57
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded

Please paste the information in Menu/Help/About LibreOffice, there is a copy icon.
Comment 2 S 2024-07-03 09:13:26 UTC
Files are on mounted nfsv4 filesystem, but ext4 shows the same error.

Affected Versions:
Version: 7.4.7.2 / LibreOffice Community
Build ID: 723314e595e8007d3cf785c16538505a1c878ca5
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (en_IE.UTF-8); UI: de-DE
Calc: threaded

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: de-DE (en_IE.UTF-8); UI: de-DE
Calc: threaded
   (VCL=kf5 is not starting on Ubuntu 20.04 caused by missing symbol
/opt/libreoffice24.2/program/soffice.bin: symbol lookup error: /opt/libreoffice24.2/program/libvclplug_qt5lo.so: undefined symbol: _ZN15QGuiApplication35setHighDpiScaleFactorRoundingPolicyEN2Qt32HighDpiScaleFactorRoundingPolicyE, version Qt_5)

Version: 6.3.6.2
Build-ID: 2196df99b074d8a661f4036fca8fa0cbfa33a497
CPU-Threads: 8; BS: Linux 5.15; UI-Render: Standard; VCL: kde5; 
Gebietsschema: de-DE (en_IE.UTF-8); UI-Sprache: de-DE
Calc: threaded

Not affected:
Version 3.6.7.2 (Build ID: e183d5b)
Comment 3 S 2024-07-16 12:28:12 UTC
Is there no one else using LO in linux?
Comment 4 Buovjaga 2024-08-27 11:43:03 UTC
Bibisected with linux-64-6.1 to 2157a3536f97ff5ae7c82611a801fef7e3708983
sfx2 store: try rename before copying
Comment 5 Commit Notification 2024-09-16 12:24:07 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/63cb8d9ddd6db64e41f66df937f42875637bede5

tdf#161876 sfx2 store: refuse to overwrite read-only files

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 6 Commit Notification 2024-09-17 07:48:23 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/14abfac4efed74876ea9f2ed3d6fa4105a508c52

tdf#161876 sfx2 store: refuse to overwrite read-only files

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