Bug 399870 - save (of annotations) overwrites symlinked PDF with copy
Summary: save (of annotations) overwrites symlinked PDF with copy
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.5.2
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Okular developers
Keywords: usability
Depends on:
Reported: 2018-10-16 09:04 UTC by azrdev
Modified: 2018-10-23 22:48 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:

Screenshot (165.80 KB, image/png)
2018-10-23 21:38 UTC, S. Umar

Note You need to log in before you can comment on or make changes to this bug.
Description azrdev 2018-10-16 09:04:28 UTC
For some versions now okular marks a document as modified (* in title) after adding annotations, and allows to safe these to the document file.
If the file is a symlink, "save" does not add the annotations to the original file (as I'd expect), but copies the file and replaces the symlink with the now annotated file, leaving me with to versions & copies of the file.

KDE Plasma Version: 5.14.0
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.2
Comment 1 Nate Graham 2018-10-17 14:47:28 UTC
Whoops! That's not great.
Comment 2 Albert Astals Cid 2018-10-21 21:11:13 UTC
Comment 3 Albert Astals Cid 2018-10-22 19:41:16 UTC
Git commit 99fe8fa6cfa7741351844f70fb86ff297378e4c2 by Albert Astals Cid.
Committed on 22/10/2018 at 19:41.
Pushed by aacid into branch 'Applications/18.08'.

Resolve symlinks before saving so we don't "break" them

Summary: BUGS: 399870

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: shubham, ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D16364

M  +9    -5    part.cpp

Comment 4 S. Umar 2018-10-23 21:18:19 UTC
I am not able to save any file after this patch! Please check.
Comment 5 Nate Graham 2018-10-23 21:22:52 UTC
Works for me. How did you apply the patch?
Comment 6 S. Umar 2018-10-23 21:26:08 UTC
I am not sure what you mean? I apply all the patches on 18.08 git
and rebuild okular rpm for my system. When I remove this I can save
again. Do you have all the patches applied?
Comment 7 Nate Graham 2018-10-23 21:27:29 UTC

Please attach a screen recording showing the problem.
Comment 8 S. Umar 2018-10-23 21:38:00 UTC
Created attachment 115859 [details]
Comment 9 Nate Graham 2018-10-23 21:40:40 UTC
Thanks, that's helpful. I found that error while reviewing the patch, and Albert fixed it already before the patch landed. I wonder if there is some corner case we're hitting.

Are you trying to save a PDF with annotations, or doing File > Save As... to save the PDF in a different location?
Comment 10 S. Umar 2018-10-23 21:43:37 UTC
No annotations but I am doing Save as...to save it to my home directory.
It appears in /tmp/mozilla_umar0/ by default. It would be nice if one
tries to save it defaults to home directory.
Comment 11 Nate Graham 2018-10-23 21:46:34 UTC
This is why I asked for a screen recording (not a screenshot). It would be much easier to see what you're doing to trigger the bug.

Do I understand correctly that you
1. Downloaded a PDF file from Firefox
2. ...and it wound up in /tmp/mozilla_umar0/
3. ...and how you want to save it to a location in your home folder?
Comment 12 S. Umar 2018-10-23 21:48:53 UTC
Exactly...I configured firefox to open pdf using okular.
Comment 13 Nate Graham 2018-10-23 21:50:27 UTC
OK, will test and report back.
Comment 14 Albert Astals Cid 2018-10-23 22:07:16 UTC
Just commited a fix for that regression.

Thanks for signaling it :)
Comment 15 S. Umar 2018-10-23 22:48:20 UTC
That fixes it!