[okular] [Bug 440986] Okular is able to overwrite read-only files

argonel bugzilla_noreply at kde.org
Mon Aug 16 06:38:04 BST 2021


https://bugs.kde.org/show_bug.cgi?id=440986

argonel <argonel at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |argonel at gmail.com

--- Comment #3 from argonel <argonel at gmail.com> ---
(In reply to Adriano Vilela from comment #0)

> I reported this on a Debian mailing list (I'm using Debian Testing), and
> somebody suggested that this probably happens because Okular is saving the
> modifications to a temporary file and then deleting the original file and
> writing the temporary file to a new file with the same name as the original
> file. I understand that. However, I think that this behavior is unexpected
> and very problematic.

That description is almost correct. What actually happens is that the file is
saved as a new file which is then renamed to have the old file's name. This
method of saving a file is to preserve the original data if something goes
wrong during save, taking advantage of the POSIX rules regarding renaming
files.

A discussion about why the lack of a "write" permission doesn't make a file
"read-only" belongs elsewhere, but the "write" permission doesn't apply to the
file's name (or any of its other metadata).

A proper solution for truly making files "read-only" isn't in Okular's scope,
but to be friendly Okular could check to see if the file is "writable" and
prompt if it isn't.


(In reply to David Hurka from comment #2)

> This is AFAIK the only way of saving files that is used by existing
> applications. Modifying files in-place maybe makes sense for databases,
> which Okular isn’t.

The lack of a "write" permission actually _prevents_ "in-place" modification,
so technically the behavior here is correct.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list