Permission error saving a file

Bug #1567565 reported by Alex D
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
evince (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

On Ubuntu 15.10, using evince 3.16.1-0ubuntu1, I fill out a PDF form. When I save the form, I get the message "Error renaming temporary file: Permission denied", and the file is not saved. I don't have permissions trouble in any other apps.

The problem happens only when I'm using a filesystem that I mount in /mnt, and not for example in my home directory or in /tmp. Although I launch evince from the terminal, there are no unusual error messages printed there. However, journalctl shows a string of error messages (see attached log).

Revision history for this message
Alex D (iueoqre) wrote :
description: updated
description: updated
description: updated
Revision history for this message
Alex D (iueoqre) wrote :

I found the cause of the bug and would like to propose a fix. The AppArmor profile for Evince contains a specific clause to handle saving files that looks like this:

  # evince creates a temporary stream file like '.goutputstream-XXXXXX' in the
  # directory a file is saved. This allows that behavior.
  owner /**/.goutputstream-* w,

However, write permission is not sufficient to rename a file - the permission should be write AND read:

  owner /**/.goutputstream-* rw,

Making this change has fixed the problem.

Alex D (iueoqre)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in evince (Ubuntu):
status: New → Confirmed
Revision history for this message
MichaelB (mrbou) wrote :

Same problem here, all our files are on a NAS (cifs share). Ubuntu 16.04 / Evince 3.18.2

When we want to "edit" a pdf file with evince (create annotation in my case) and overwrite the file.. is not possible, i got the same error "Error renaming temporary file: Permission denied". So we still work with Adobe Acrobat PRO by example and this is stupid because this functionality work great with local file in evince.

I'll test the workaround proposed by Alex D (owner /**/.goutputstream-* rw)

Revision history for this message
MichaelB (mrbou) wrote :

So in my case it doesn't work with this workaround because i use a CIFS mount directly in fstab. :(

Someone can propose another workaround that work with cifs file mounted in fstab??

Thanks!

Revision history for this message
Wayne Stark (w-stark) wrote :

This is the same problem I'm having in Xubuntu 16.04.
@Alex D. I cannot find the file you mention anywhere, to edit it.
Could you give me a heads up as to where to look.
Thanks.

Revision history for this message
Wayne Stark (w-stark) wrote :

Actually I think I found the file in question.
/etc/appamor.d/usr.bin.evince.
I changed the line as in #2, but the problem still remains for me.

Revision history for this message
MichaelB (mrbou) wrote :

Just test it with Ubuntu 17.10 (Evince 3.26.0) and problem persist!

It is impossible to SAVE (overwrite) the opened pdf file when this file is in a CIFS mount point (fstab). It appear a permission error.. and much more bad, the file is totally erased!!

Please correct this problem.. and for the upcoming 18.04 LTS.

Thanks!
Michael

Revision history for this message
MichaelB (mrbou) wrote :

Just opened a bug in upstream gnome:
https://bugzilla.gnome.org/show_bug.cgi?id=792191

Revision history for this message
Vassilis Papavassiliou (vapapav) wrote :

For me, the fix in comment #2 worked only after I restarted apparmor:

sudo /etc/init.d/apparmor restart

Revision history for this message
Philipp Wendler (philw85) wrote :

This problem persists with recent versions of Ubuntu and Evince when editing files on CIFS/SMB shares, even after disabling AppArmor.

The reason for this is that Evince attempts to move the temporary file over the original PDF while it still has the latter file open, and overwriting open files is not supported by SMB:
https://lists.samba.org/archive/samba/2021-November/238366.html
https://lists.samba.org/archive/samba/2021-November/238367.html

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.