Permission error saving a file

Bug #1567565 reported by Alex D on 2016-04-07
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
evince (Ubuntu)
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).

Alex D (iueoqre) wrote :
description: updated
description: updated
description: updated
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) on 2016-04-12
description: updated
Launchpad Janitor (janitor) wrote :

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

Changed in evince (Ubuntu):
status: New → Confirmed
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)

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!

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.

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.

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

MichaelB (mrbou) wrote :

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

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

sudo /etc/init.d/apparmor restart

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

Other bug subscribers

Remote bug watches

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