Bug 432271

Summary: Can't save a file out of Okular
Product: [Applications] okular Reporter: Joerg <joerge-e>
Component: generalAssignee: Okular developers <okular-devel>
Status: REPORTED ---    
Severity: major CC: aacid, dmaier, geloczigeri, nate, yurchor
Priority: NOR    
Version: 1.10.2   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Joerg 2021-01-29 10:30:54 UTC
SUMMARY
every time i try to save a file out of Okular to a folder in my home-directory, i get the reply "Datei kann nicht in „/tmp/okular.Lufxxf“ gespeichert werden." (file can't save in /tmp/okular.Lufxxf). 
Out of other applications i can save files without any problem.

STEPS TO REPRODUCE
1. I choose menue |file|save| (or |save as|) and select a sub folder in my home directory
2. When I confirm to save the file, i get the reply, that i can't save in /tmp/...
3. 

OBSERVED RESULT
It is not possible to save any file from okular.

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.18.6
KDE Frameworks Version: 5.71.0
Qt Version: 5.12.7
OS: Opensuse Leap 15.2

ADDITIONAL INFORMATION
Comment 1 Yuri Chornoivan 2021-01-29 10:37:38 UTC

*** This bug has been marked as a duplicate of bug 402017 ***
Comment 2 Laura David Hurka 2021-01-29 16:14:19 UTC
Why is this a duplicate of bug 402017?

This bug report describes that Okular attempts to save in a wrong place. Bug 402017 describes that Okular attempts to read a file from a not existing place.

The given example is /tmp/okular.Lufxxf, which does not look like the user opened a file from e. g. KMail, because the filename contains “okular”, not “kmail”.

@Joerg: Can you describe how you opened the file?
Comment 3 Yuri Chornoivan 2021-01-29 16:26:26 UTC
(In reply to David Hurka from comment #2)
> Why is this a duplicate of bug 402017?

Because the above-mentioned file names are typical for the browser-opened PDFs.
Comment 4 Joerg 2021-01-30 18:42:37 UTC
(In reply to David Hurka from comment #2)
> Why is this a duplicate of bug 402017?
> 
> This bug report describes that Okular attempts to save in a wrong place. Bug
> 402017 describes that Okular attempts to read a file from a not existing
> place.
> 
> The given example is /tmp/okular.Lufxxf, which does not look like the user
> opened a file from e. g. KMail, because the filename contains “okular”, not
> “kmail”.
> 
> @Joerg: Can you describe how you opened the file?

@David: thanks for your reply. I agree with you. 
 It's the same result, whether I open a local file and try to save it or i try to save a browser-opend file. Both don't work and i'm asked to choose another directory than /tmp/..., although i selected a folder in my home-directory.
Comment 5 Yuri Chornoivan 2021-01-30 18:44:50 UTC
Change the status for further investigation (cannot reproduce it btw).
Comment 6 Joerg 2021-02-01 19:29:52 UTC
An other problem with Okular occured today. I can't print from Okular. To get an error-report, i started Okular from console. When i tried to print, the reply on console was "/usr/bin/lpr: Fehler - Zugriff auf »/tmp/okular_IhOqaH.ps« nicht möglich - Keine Berechtigung" witch means: no access to /tmp ... - no authorization.
Comment 7 Albert Astals Cid 2021-02-01 21:02:40 UTC
This really smells like your system is broken/badly configured.
Comment 8 Joerg 2021-02-04 21:14:29 UTC
(In reply to Albert Astals Cid from comment #7)
> This really smells like your system is broken/badly configured.

I don't think so, because only okular shows the problems mentioned above. Other applications work without any problems.
Comment 9 Albert Astals Cid 2021-02-04 22:25:24 UTC
You're not authorized to write to /tmp, sorry but that means your system is broken.
Comment 10 Joerg 2021-02-05 21:27:41 UTC
(In reply to Albert Astals Cid from comment #9)
> You're not authorized to write to /tmp, sorry but that means your system is
> broken.

That's not the reason for my problem. I can write to /tmp (I just tested it and saved a file out of kate in /tmp). In the directory access control owner and group are set to root, all others are allowed to read and change. Only okular has some kind of problem with it. 
Anyway, I don't want to save in /tmp, when I try to save out of okular (I select my home directory), but okular complains, that it can't save to /tmp.
Comment 11 gggeri91 2024-06-01 10:18:16 UTC
The very same thing happened to me today. It happened to me several times in the past, but today I decided to google about this issue more and found this bug report. This ticket describes the bug very well.  

What lead to the issue in my case:
STEPS TO REPRODUCE
1. Open a PDF file in Okular
2. Make annotations, then press "Save" button. 
3. Make annotations, add text with the type tool, then press "Save" button. 
4. Repeat steps 2 and 3, keep doing modifications and then save the file. After some time you will run into the bug. 



OBSERVED RESULT
When pressing the "Save" button an error is shown: "File could not be saved in '/tmp/okular.bvEIkY'. Try to save it to another location."
The "Save As..." button also does not work, the file cannot be saved to any other location (for example, any folder in my home folder). 

As a work-around, to not loose an hour of work I had to print into PDF, that works but it is far from the ideal solution.

EXPECTED RESULT
File is saved, no data loss.
Comment 12 gggeri91 2024-06-01 10:24:08 UTC
This may be relevant: The issue happens to me only when I open files from a CIFS mount. If I copy over the file to my local home directory it never crashes. Maybe Okular uses the tmp files when opening from a CIFS file system?
Comment 13 dmaier 2024-06-25 12:34:59 UTC
Same here:
Pdf opened from samba share, after annotating 2-3 times, save/save as fail (file can't save in /tmp/okular.xyz).
Same pdf opened from the local file system, after annotation 2-3 times, save/save as work as expected.
Archlinux, i3wm, Okular version 24.05.1
Comment 14 Albert Astals Cid 2024-06-27 21:41:05 UTC
For when someone has time, please explain exactly how to setup that scenario you're describing, knowing about developing okular is a totally different skill to knowing what CIFS is or how to set it up.
Comment 15 dmaier 2024-06-28 09:11:35 UTC
(In reply to Albert Astals Cid from comment #14)
Hi, first of all thanks your code care efforts, cifs means a samba share, where files are offered within a network for a plenty of users. I suggest you set up a virtual machine for it, for example an Ubuntu Server 20.04 LTS. 

Samba setup on the server:
sudo apt install samba
sudo adduser --no-create-home --disabled-login --shell /bin/false testuser
sudo smbpasswd -a testuser
sudo mkdir /srv/data/all
sudo vim /etc/samba/smb.cnf
  ...
  workgroup = team
  ...
  [testusershare]
  comment = Testuser Directories
  path = /srv/data/all
  browsable = yes
  read only = no
  create mask = 0770
  force create mode = 0770
  directory mask = 0770
  force directory mode = 0770
  inherit permissions = yes
  inherit acls = yes
sudo systemctl restart smbd

On the client side, i. e. a current Ubuntu:
sudo mkdir /media/testusershare
sudo apt install cifs-utils 
vim /home/<localuser>/.smbcredentials
  username=testuser
  password=<secret>
chmod 600 /home/<localuser>/.smbcredentials 

vim /etc/fstab
  ...
  //<IP virtual server>/testusershare /media/testusershare cifs credentials=/home/<localuser>/.smbcredentials, uid=<uid localuser>,gid=<gid localuser>,vers=3.1.1,nobrl  0 0
...

sudo mount -a

Voilà, then you should be able to save pdf files on /media/testusershare for testing purpose.

Regards,
dm